Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26df0766 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* '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.
  ...
parents 58028762 a6de51b2
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@


		Maintainers:
		Maintainers:
		CPU Hotplug Core:
		CPU Hotplug Core:
			Rusty Russell <rusty@rustycorp.com.au>
			Rusty Russell <rusty@rustcorp.com.au>
			Srivatsa Vaddagiri <vatsa@in.ibm.com>
			Srivatsa Vaddagiri <vatsa@in.ibm.com>
		i386:
		i386:
			Zwane Mwaikambo <zwane@arm.linux.org.uk>
			Zwane Mwaikambo <zwane@arm.linux.org.uk>
+10 −0
Original line number Original line Diff line number Diff line
@@ -187,7 +187,9 @@ static int hostaudio_open(struct inode *inode, struct file *file)
	int ret;
	int ret;


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


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


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


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


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


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


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


	module_data.dev_audio = register_sound_dsp(&hostaudio_fops, -1);
	module_data.dev_audio = register_sound_dsp(&hostaudio_fops, -1);
	if (module_data.dev_audio < 0) {
	if (module_data.dev_audio < 0) {
+24 −8
Original line number Original line Diff line number Diff line
@@ -96,7 +96,8 @@ static const struct acpi_dlevel acpi_debug_levels[] = {
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
                              FS Interface (/sys)
                              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 result = 0;
	int i;
	int i;


@@ -118,7 +119,8 @@ static int param_get_debug_layer(char *buffer, struct kernel_param *kp) {
	return result;
	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 result = 0;
	int i;
	int i;


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


module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644);
static struct kernel_param_ops acpi_debug_layer_ops = {
module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644);
	.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];
static char trace_method_name[6];
module_param_string(trace_method_name, trace_method_name, 6, 0644);
module_param_string(trace_method_name, trace_method_name, 6, 0644);
@@ -147,7 +159,7 @@ module_param(trace_debug_layer, uint, 0644);
static unsigned int trace_debug_level;
static unsigned int trace_debug_level;
module_param(trace_debug_level, uint, 0644);
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;
	int result = 0;


@@ -181,7 +193,7 @@ exit:
	return result;
	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)
	if (!acpi_gbl_trace_method_name)
		return sprintf(buffer, "disable");
		return sprintf(buffer, "disable");
@@ -194,8 +206,12 @@ static int param_get_trace_state(char *buffer, struct kernel_param *kp)
	return 0;
	return 0;
}
}


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

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


/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
				DebugFS Interface
				DebugFS Interface
+7 −2
Original line number Original line Diff line number Diff line
@@ -1149,7 +1149,7 @@ out_err:
 * Note: If it is called early in the boot process, @val is stored and
 * Note: If it is called early in the boot process, @val is stored and
 *	 parsed later in hvc_iucv_init().
 *	 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;
	int rc;


@@ -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
 * 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.
 * 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;
	int rc;
	size_t index, len;
	size_t index, len;
@@ -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)
#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
 * hvc_iucv_init() - z/VM IUCV HVC device driver initialization
 */
 */
+27 −15
Original line number Original line Diff line number Diff line
@@ -196,7 +196,7 @@ static void ipmi_unregister_watchdog(int ipmi_intf);
 */
 */
static int start_now;
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;
	char *endp;
	int  l;
	int  l;
@@ -215,10 +215,11 @@ static int set_param_int(const char *val, struct kernel_param *kp)
	return rv;
	return rv;
}
}


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


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


@@ -227,7 +228,7 @@ static int preaction_op(const char *inval, char *outval);
static int preop_op(const char *inval, char *outval);
static int preop_op(const char *inval, char *outval);
static void check_parms(void);
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;
	action_fn  fn = (action_fn) kp->arg;
	int        rv = 0;
	int        rv = 0;
@@ -251,7 +252,7 @@ static int set_param_str(const char *val, struct kernel_param *kp)
	return rv;
	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;
	action_fn fn = (action_fn) kp->arg;
	int       rv;
	int       rv;
@@ -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);
	int rv = param_set_int(val, kp);
	if (rv)
	if (rv)
@@ -276,27 +277,38 @@ static int set_param_wdog_ifnum(const char *val, struct kernel_param *kp)
	return 0;
	return 0;
}
}


module_param_call(ifnum_to_use, set_param_wdog_ifnum, get_param_int,
static struct kernel_param_ops param_ops_wdog_ifnum = {
		  &ifnum_to_use, 0644);
	.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 "
MODULE_PARM_DESC(ifnum_to_use, "The interface number to use for the watchdog "
		 "timer.  Setting to -1 defaults to the first registered "
		 "timer.  Setting to -1 defaults to the first registered "
		 "interface");
		 "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_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_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: "
MODULE_PARM_DESC(action, "Timeout action. One of: "
		 "reset, none, power_cycle, power_off.");
		 "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: "
MODULE_PARM_DESC(preaction, "Pretimeout action.  One of: "
		 "pre_none, pre_smi, pre_nmi, pre_int.");
		 "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: "
MODULE_PARM_DESC(preop, "Pretimeout driver operation.  One of: "
		 "preop_none, preop_panic, preop_give_data.");
		 "preop_none, preop_panic, preop_give_data.");


Loading