Skip to content

Commit

Permalink
Merge branch 'params' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/rusty/linux-2.6-for-linus

* 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: (22 commits)
  param: don't deref arg in __same_type() checks
  param: update drivers/acpi/debug.c to new scheme
  param: use module_param in drivers/message/fusion/mptbase.c
  ide: use module_param_named rather than module_param_call
  param: update drivers/char/ipmi/ipmi_watchdog.c to new scheme
  param: lock if_sdio's lbs_helper_name and lbs_fw_name against sysfs changes.
  param: lock myri10ge_fw_name against sysfs changes.
  param: simple locking for sysfs-writable charp parameters
  param: remove unnecessary writable charp
  param: add kerneldoc to moduleparam.h
  param: locking for kernel parameters
  param: make param sections const.
  param: use free hook for charp (fix leak of charp parameters)
  param: add a free hook to kernel_param_ops.
  param: silence .init.text references from param ops
  Add param ops struct for hvc_iucv driver.
  nfs: update for module_param_named API change
  AppArmor: update for module_param_named API change
  param: use ops in struct kernel_param, rather than get and set fns directly
  param: move the EXPORT_SYMBOL to after the definitions.
  ...
  • Loading branch information
torvalds committed Aug 12, 2010
2 parents 5802876 + a6de51b commit 26df076
Show file tree
Hide file tree
Showing 30 changed files with 658 additions and 253 deletions.
2 changes: 1 addition & 1 deletion Documentation/cpu-hotplug.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Maintainers:
CPU Hotplug Core:
Rusty Russell <rusty@rustycorp.com.au>
Rusty Russell <rusty@rustcorp.com.au>
Srivatsa Vaddagiri <[email protected]>
i386:
Zwane Mwaikambo <[email protected]>
Expand Down
10 changes: 10 additions & 0 deletions arch/um/drivers/hostaudio_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ static int hostaudio_open(struct inode *inode, struct file *file)
int ret;

#ifdef DEBUG
kparam_block_sysfs_write(dsp);
printk(KERN_DEBUG "hostaudio: open called (host: %s)\n", dsp);
kparam_unblock_sysfs_write(dsp);
#endif

state = kmalloc(sizeof(struct hostaudio_state), GFP_KERNEL);
Expand All @@ -199,9 +201,11 @@ static int hostaudio_open(struct inode *inode, struct file *file)
if (file->f_mode & FMODE_WRITE)
w = 1;

kparam_block_sysfs_write(dsp);
lock_kernel();
ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);
unlock_kernel();
kparam_unblock_sysfs_write(dsp);

if (ret < 0) {
kfree(state);
Expand Down Expand Up @@ -258,13 +262,17 @@ static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
if (file->f_mode & FMODE_WRITE)
w = 1;

kparam_block_sysfs_write(mixer);
lock_kernel();
ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);
unlock_kernel();
kparam_unblock_sysfs_write(mixer);

if (ret < 0) {
kparam_block_sysfs_write(dsp);
printk(KERN_ERR "hostaudio_open_mixdev failed to open '%s', "
"err = %d\n", dsp, -ret);
kparam_unblock_sysfs_write(dsp);
kfree(state);
return ret;
}
Expand Down Expand Up @@ -320,8 +328,10 @@ MODULE_LICENSE("GPL");

static int __init hostaudio_init_module(void)
{
__kernel_param_lock();
printk(KERN_INFO "UML Audio Relay (host dsp = %s, host mixer = %s)\n",
dsp, mixer);
__kernel_param_unlock();

module_data.dev_audio = register_sound_dsp(&hostaudio_fops, -1);
if (module_data.dev_audio < 0) {
Expand Down
32 changes: 24 additions & 8 deletions drivers/acpi/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ static const struct acpi_dlevel acpi_debug_levels[] = {
/* --------------------------------------------------------------------------
FS Interface (/sys)
-------------------------------------------------------------------------- */
static int param_get_debug_layer(char *buffer, struct kernel_param *kp) {
static int param_get_debug_layer(char *buffer, const struct kernel_param *kp)
{
int result = 0;
int i;

Expand All @@ -118,7 +119,8 @@ static int param_get_debug_layer(char *buffer, struct kernel_param *kp) {
return result;
}

static int param_get_debug_level(char *buffer, struct kernel_param *kp) {
static int param_get_debug_level(char *buffer, const struct kernel_param *kp)
{
int result = 0;
int i;

Expand All @@ -137,8 +139,18 @@ static int param_get_debug_level(char *buffer, struct kernel_param *kp) {
return result;
}

module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644);
module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644);
static struct kernel_param_ops acpi_debug_layer_ops = {
.set = param_set_uint,
.get = param_get_debug_layer,
};

static struct kernel_param_ops acpi_debug_level_ops = {
.set = param_set_uint,
.get = param_get_debug_level,
};

module_param_cb(debug_layer, &acpi_debug_layer_ops, &acpi_dbg_layer, 0644);
module_param_cb(debug_level, &acpi_debug_level_ops, &acpi_dbg_level, 0644);

static char trace_method_name[6];
module_param_string(trace_method_name, trace_method_name, 6, 0644);
Expand All @@ -147,7 +159,7 @@ module_param(trace_debug_layer, uint, 0644);
static unsigned int trace_debug_level;
module_param(trace_debug_level, uint, 0644);

static int param_set_trace_state(const char *val, struct kernel_param *kp)
static int param_set_trace_state(const char *val, const struct kernel_param *kp)
{
int result = 0;

Expand Down Expand Up @@ -181,7 +193,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp)
return result;
}

static int param_get_trace_state(char *buffer, struct kernel_param *kp)
static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
{
if (!acpi_gbl_trace_method_name)
return sprintf(buffer, "disable");
Expand All @@ -194,8 +206,12 @@ static int param_get_trace_state(char *buffer, struct kernel_param *kp)
return 0;
}

module_param_call(trace_state, param_set_trace_state, param_get_trace_state,
NULL, 0644);
static struct kernel_param_ops param_ops_trace_state = {
.set = param_set_trace_state,
.get = param_get_trace_state,
};

module_param_cb(trace_state, &param_ops_trace_state, NULL, 0644);

/* --------------------------------------------------------------------------
DebugFS Interface
Expand Down
9 changes: 7 additions & 2 deletions drivers/char/hvc_iucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ static int hvc_iucv_setup_filter(const char *val)
* Note: If it is called early in the boot process, @val is stored and
* parsed later in hvc_iucv_init().
*/
static int param_set_vmidfilter(const char *val, struct kernel_param *kp)
static int param_set_vmidfilter(const char *val, const struct kernel_param *kp)
{
int rc;

Expand All @@ -1176,7 +1176,7 @@ static int param_set_vmidfilter(const char *val, struct kernel_param *kp)
* The function stores the filter as a comma-separated list of z/VM user IDs
* in @buffer. Typically, sysfs routines call this function for attr show.
*/
static int param_get_vmidfilter(char *buffer, struct kernel_param *kp)
static int param_get_vmidfilter(char *buffer, const struct kernel_param *kp)
{
int rc;
size_t index, len;
Expand All @@ -1203,6 +1203,11 @@ static int param_get_vmidfilter(char *buffer, struct kernel_param *kp)

#define param_check_vmidfilter(name, p) __param_check(name, p, void)

static struct kernel_param_ops param_ops_vmidfilter = {
.set = param_set_vmidfilter,
.get = param_get_vmidfilter,
};

/**
* hvc_iucv_init() - z/VM IUCV HVC device driver initialization
*/
Expand Down
42 changes: 27 additions & 15 deletions drivers/char/ipmi/ipmi_watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static void ipmi_unregister_watchdog(int ipmi_intf);
*/
static int start_now;

static int set_param_int(const char *val, struct kernel_param *kp)
static int set_param_timeout(const char *val, const struct kernel_param *kp)
{
char *endp;
int l;
Expand All @@ -215,10 +215,11 @@ static int set_param_int(const char *val, struct kernel_param *kp)
return rv;
}

static int get_param_int(char *buffer, struct kernel_param *kp)
{
return sprintf(buffer, "%i", *((int *)kp->arg));
}
static struct kernel_param_ops param_ops_timeout = {
.set = set_param_timeout,
.get = param_get_int,
};
#define param_check_timeout param_check_int

typedef int (*action_fn)(const char *intval, char *outval);

Expand All @@ -227,7 +228,7 @@ static int preaction_op(const char *inval, char *outval);
static int preop_op(const char *inval, char *outval);
static void check_parms(void);

static int set_param_str(const char *val, struct kernel_param *kp)
static int set_param_str(const char *val, const struct kernel_param *kp)
{
action_fn fn = (action_fn) kp->arg;
int rv = 0;
Expand All @@ -251,7 +252,7 @@ static int set_param_str(const char *val, struct kernel_param *kp)
return rv;
}

static int get_param_str(char *buffer, struct kernel_param *kp)
static int get_param_str(char *buffer, const struct kernel_param *kp)
{
action_fn fn = (action_fn) kp->arg;
int rv;
Expand All @@ -263,7 +264,7 @@ static int get_param_str(char *buffer, struct kernel_param *kp)
}


static int set_param_wdog_ifnum(const char *val, struct kernel_param *kp)
static int set_param_wdog_ifnum(const char *val, const struct kernel_param *kp)
{
int rv = param_set_int(val, kp);
if (rv)
Expand All @@ -276,27 +277,38 @@ static int set_param_wdog_ifnum(const char *val, struct kernel_param *kp)
return 0;
}

module_param_call(ifnum_to_use, set_param_wdog_ifnum, get_param_int,
&ifnum_to_use, 0644);
static struct kernel_param_ops param_ops_wdog_ifnum = {
.set = set_param_wdog_ifnum,
.get = param_get_int,
};

#define param_check_wdog_ifnum param_check_int

static struct kernel_param_ops param_ops_str = {
.set = set_param_str,
.get = get_param_str,
};

module_param(ifnum_to_use, wdog_ifnum, 0644);
MODULE_PARM_DESC(ifnum_to_use, "The interface number to use for the watchdog "
"timer. Setting to -1 defaults to the first registered "
"interface");

module_param_call(timeout, set_param_int, get_param_int, &timeout, 0644);
module_param(timeout, timeout, 0644);
MODULE_PARM_DESC(timeout, "Timeout value in seconds.");

module_param_call(pretimeout, set_param_int, get_param_int, &pretimeout, 0644);
module_param(pretimeout, timeout, 0644);
MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds.");

module_param_call(action, set_param_str, get_param_str, action_op, 0644);
module_param_cb(action, &param_ops_str, action_op, 0644);
MODULE_PARM_DESC(action, "Timeout action. One of: "
"reset, none, power_cycle, power_off.");

module_param_call(preaction, set_param_str, get_param_str, preaction_op, 0644);
module_param_cb(preaction, &param_ops_str, preaction_op, 0644);
MODULE_PARM_DESC(preaction, "Pretimeout action. One of: "
"pre_none, pre_smi, pre_nmi, pre_int.");

module_param_call(preop, set_param_str, get_param_str, preop_op, 0644);
module_param_cb(preop, &param_ops_str, preop_op, 0644);
MODULE_PARM_DESC(preop, "Pretimeout driver operation. One of: "
"preop_none, preop_panic, preop_give_data.");

Expand Down
20 changes: 13 additions & 7 deletions drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ EXPORT_SYMBOL_GPL(ide_pci_clk);
module_param_named(pci_clock, ide_pci_clk, int, 0);
MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");

static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp)
static int ide_set_dev_param_mask(const char *s, const struct kernel_param *kp)
{
int a, b, i, j = 1;
unsigned int *dev_param_mask = (unsigned int *)kp->arg;
Expand All @@ -200,34 +200,40 @@ static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp)
return 0;
}

static struct kernel_param_ops param_ops_ide_dev_mask = {
.set = ide_set_dev_param_mask
};

#define param_check_ide_dev_mask(name, p) param_check_uint(name, p)

static unsigned int ide_nodma;

module_param_call(nodma, ide_set_dev_param_mask, NULL, &ide_nodma, 0);
module_param_named(nodma, ide_nodma, ide_dev_mask, 0);
MODULE_PARM_DESC(nodma, "disallow DMA for a device");

static unsigned int ide_noflush;

module_param_call(noflush, ide_set_dev_param_mask, NULL, &ide_noflush, 0);
module_param_named(noflush, ide_noflush, ide_dev_mask, 0);
MODULE_PARM_DESC(noflush, "disable flush requests for a device");

static unsigned int ide_nohpa;

module_param_call(nohpa, ide_set_dev_param_mask, NULL, &ide_nohpa, 0);
module_param_named(nohpa, ide_nohpa, ide_dev_mask, 0);
MODULE_PARM_DESC(nohpa, "disable Host Protected Area for a device");

static unsigned int ide_noprobe;

module_param_call(noprobe, ide_set_dev_param_mask, NULL, &ide_noprobe, 0);
module_param_named(noprobe, ide_noprobe, ide_dev_mask, 0);
MODULE_PARM_DESC(noprobe, "skip probing for a device");

static unsigned int ide_nowerr;

module_param_call(nowerr, ide_set_dev_param_mask, NULL, &ide_nowerr, 0);
module_param_named(nowerr, ide_nowerr, ide_dev_mask, 0);
MODULE_PARM_DESC(nowerr, "ignore the ATA_DF bit for a device");

static unsigned int ide_cdroms;

module_param_call(cdrom, ide_set_dev_param_mask, NULL, &ide_cdroms, 0);
module_param_named(cdrom, ide_cdroms, ide_dev_mask, 0);
MODULE_PARM_DESC(cdrom, "force device as a CD-ROM");

struct chs_geom {
Expand Down
26 changes: 17 additions & 9 deletions drivers/input/misc/ati_remote2.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ enum {
};

static int ati_remote2_set_mask(const char *val,
struct kernel_param *kp, unsigned int max)
const struct kernel_param *kp,
unsigned int max)
{
unsigned long mask;
int ret;
Expand All @@ -59,28 +60,31 @@ static int ati_remote2_set_mask(const char *val,
}

static int ati_remote2_set_channel_mask(const char *val,
struct kernel_param *kp)
const struct kernel_param *kp)
{
pr_debug("%s()\n", __func__);

return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_CHANNEL_MASK);
}

static int ati_remote2_get_channel_mask(char *buffer, struct kernel_param *kp)
static int ati_remote2_get_channel_mask(char *buffer,
const struct kernel_param *kp)
{
pr_debug("%s()\n", __func__);

return sprintf(buffer, "0x%04x", *(unsigned int *)kp->arg);
}

static int ati_remote2_set_mode_mask(const char *val, struct kernel_param *kp)
static int ati_remote2_set_mode_mask(const char *val,
const struct kernel_param *kp)
{
pr_debug("%s()\n", __func__);

return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_MODE_MASK);
}

static int ati_remote2_get_mode_mask(char *buffer, struct kernel_param *kp)
static int ati_remote2_get_mode_mask(char *buffer,
const struct kernel_param *kp)
{
pr_debug("%s()\n", __func__);

Expand All @@ -89,15 +93,19 @@ static int ati_remote2_get_mode_mask(char *buffer, struct kernel_param *kp)

static unsigned int channel_mask = ATI_REMOTE2_MAX_CHANNEL_MASK;
#define param_check_channel_mask(name, p) __param_check(name, p, unsigned int)
#define param_set_channel_mask ati_remote2_set_channel_mask
#define param_get_channel_mask ati_remote2_get_channel_mask
static struct kernel_param_ops param_ops_channel_mask = {
.set = ati_remote2_set_channel_mask,
.get = ati_remote2_get_channel_mask,
};
module_param(channel_mask, channel_mask, 0644);
MODULE_PARM_DESC(channel_mask, "Bitmask of channels to accept <15:Channel16>...<1:Channel2><0:Channel1>");

static unsigned int mode_mask = ATI_REMOTE2_MAX_MODE_MASK;
#define param_check_mode_mask(name, p) __param_check(name, p, unsigned int)
#define param_set_mode_mask ati_remote2_set_mode_mask
#define param_get_mode_mask ati_remote2_get_mode_mask
static struct kernel_param_ops param_ops_mode_mask = {
.set = ati_remote2_set_mode_mask,
.get = ati_remote2_get_mode_mask,
};
module_param(mode_mask, mode_mask, 0644);
MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>");

Expand Down
Loading

0 comments on commit 26df076

Please sign in to comment.