Skip to content

Commit 26df076

Browse files
committed
Merge branch 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/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. ...
2 parents 5802876 + a6de51b commit 26df076

30 files changed

Lines changed: 658 additions & 253 deletions

File tree

‎Documentation/cpu-hotplug.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Maintainers:
44
CPU Hotplug Core:
5-
Rusty Russell <rusty@rustycorp.com.au>
5+
Rusty Russell <rusty@rustcorp.com.au>
66
Srivatsa Vaddagiri <vatsa@in.ibm.com>
77
i386:
88
Zwane Mwaikambo <zwane@arm.linux.org.uk>

‎arch/um/drivers/hostaudio_kern.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ static int hostaudio_open(struct inode *inode, struct file *file)
187187
int ret;
188188

189189
#ifdef DEBUG
190+
kparam_block_sysfs_write(dsp);
190191
printk(KERN_DEBUG "hostaudio: open called (host: %s)\n", dsp);
192+
kparam_unblock_sysfs_write(dsp);
191193
#endif
192194

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

204+
kparam_block_sysfs_write(dsp);
202205
lock_kernel();
203206
ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);
204207
unlock_kernel();
208+
kparam_unblock_sysfs_write(dsp);
205209

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

265+
kparam_block_sysfs_write(mixer);
261266
lock_kernel();
262267
ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);
263268
unlock_kernel();
269+
kparam_unblock_sysfs_write(mixer);
264270

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

321329
static int __init hostaudio_init_module(void)
322330
{
331+
__kernel_param_lock();
323332
printk(KERN_INFO "UML Audio Relay (host dsp = %s, host mixer = %s)\n",
324333
dsp, mixer);
334+
__kernel_param_unlock();
325335

326336
module_data.dev_audio = register_sound_dsp(&hostaudio_fops, -1);
327337
if (module_data.dev_audio < 0) {

‎drivers/acpi/debug.c‎

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ static const struct acpi_dlevel acpi_debug_levels[] = {
9696
/* --------------------------------------------------------------------------
9797
FS Interface (/sys)
9898
-------------------------------------------------------------------------- */
99-
static int param_get_debug_layer(char *buffer, struct kernel_param *kp) {
99+
static int param_get_debug_layer(char *buffer, const struct kernel_param *kp)
100+
{
100101
int result = 0;
101102
int i;
102103

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

121-
static int param_get_debug_level(char *buffer, struct kernel_param *kp) {
122+
static int param_get_debug_level(char *buffer, const struct kernel_param *kp)
123+
{
122124
int result = 0;
123125
int i;
124126

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

140-
module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644);
141-
module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644);
142+
static struct kernel_param_ops acpi_debug_layer_ops = {
143+
.set = param_set_uint,
144+
.get = param_get_debug_layer,
145+
};
146+
147+
static struct kernel_param_ops acpi_debug_level_ops = {
148+
.set = param_set_uint,
149+
.get = param_get_debug_level,
150+
};
151+
152+
module_param_cb(debug_layer, &acpi_debug_layer_ops, &acpi_dbg_layer, 0644);
153+
module_param_cb(debug_level, &acpi_debug_level_ops, &acpi_dbg_level, 0644);
142154

143155
static char trace_method_name[6];
144156
module_param_string(trace_method_name, trace_method_name, 6, 0644);
@@ -147,7 +159,7 @@ module_param(trace_debug_layer, uint, 0644);
147159
static unsigned int trace_debug_level;
148160
module_param(trace_debug_level, uint, 0644);
149161

150-
static int param_set_trace_state(const char *val, struct kernel_param *kp)
162+
static int param_set_trace_state(const char *val, const struct kernel_param *kp)
151163
{
152164
int result = 0;
153165

@@ -181,7 +193,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp)
181193
return result;
182194
}
183195

184-
static int param_get_trace_state(char *buffer, struct kernel_param *kp)
196+
static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
185197
{
186198
if (!acpi_gbl_trace_method_name)
187199
return sprintf(buffer, "disable");
@@ -194,8 +206,12 @@ static int param_get_trace_state(char *buffer, struct kernel_param *kp)
194206
return 0;
195207
}
196208

197-
module_param_call(trace_state, param_set_trace_state, param_get_trace_state,
198-
NULL, 0644);
209+
static struct kernel_param_ops param_ops_trace_state = {
210+
.set = param_set_trace_state,
211+
.get = param_get_trace_state,
212+
};
213+
214+
module_param_cb(trace_state, &param_ops_trace_state, NULL, 0644);
199215

200216
/* --------------------------------------------------------------------------
201217
DebugFS Interface

‎drivers/char/hvc_iucv.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ static int hvc_iucv_setup_filter(const char *val)
11491149
* Note: If it is called early in the boot process, @val is stored and
11501150
* parsed later in hvc_iucv_init().
11511151
*/
1152-
static int param_set_vmidfilter(const char *val, struct kernel_param *kp)
1152+
static int param_set_vmidfilter(const char *val, const struct kernel_param *kp)
11531153
{
11541154
int rc;
11551155

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

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

1206+
static struct kernel_param_ops param_ops_vmidfilter = {
1207+
.set = param_set_vmidfilter,
1208+
.get = param_get_vmidfilter,
1209+
};
1210+
12061211
/**
12071212
* hvc_iucv_init() - z/VM IUCV HVC device driver initialization
12081213
*/

‎drivers/char/ipmi/ipmi_watchdog.c‎

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static void ipmi_unregister_watchdog(int ipmi_intf);
196196
*/
197197
static int start_now;
198198

199-
static int set_param_int(const char *val, struct kernel_param *kp)
199+
static int set_param_timeout(const char *val, const struct kernel_param *kp)
200200
{
201201
char *endp;
202202
int l;
@@ -215,10 +215,11 @@ static int set_param_int(const char *val, struct kernel_param *kp)
215215
return rv;
216216
}
217217

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

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

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

230-
static int set_param_str(const char *val, struct kernel_param *kp)
231+
static int set_param_str(const char *val, const struct kernel_param *kp)
231232
{
232233
action_fn fn = (action_fn) kp->arg;
233234
int rv = 0;
@@ -251,7 +252,7 @@ static int set_param_str(const char *val, struct kernel_param *kp)
251252
return rv;
252253
}
253254

254-
static int get_param_str(char *buffer, struct kernel_param *kp)
255+
static int get_param_str(char *buffer, const struct kernel_param *kp)
255256
{
256257
action_fn fn = (action_fn) kp->arg;
257258
int rv;
@@ -263,7 +264,7 @@ static int get_param_str(char *buffer, struct kernel_param *kp)
263264
}
264265

265266

266-
static int set_param_wdog_ifnum(const char *val, struct kernel_param *kp)
267+
static int set_param_wdog_ifnum(const char *val, const struct kernel_param *kp)
267268
{
268269
int rv = param_set_int(val, kp);
269270
if (rv)
@@ -276,27 +277,38 @@ static int set_param_wdog_ifnum(const char *val, struct kernel_param *kp)
276277
return 0;
277278
}
278279

279-
module_param_call(ifnum_to_use, set_param_wdog_ifnum, get_param_int,
280-
&ifnum_to_use, 0644);
280+
static struct kernel_param_ops param_ops_wdog_ifnum = {
281+
.set = set_param_wdog_ifnum,
282+
.get = param_get_int,
283+
};
284+
285+
#define param_check_wdog_ifnum param_check_int
286+
287+
static struct kernel_param_ops param_ops_str = {
288+
.set = set_param_str,
289+
.get = get_param_str,
290+
};
291+
292+
module_param(ifnum_to_use, wdog_ifnum, 0644);
281293
MODULE_PARM_DESC(ifnum_to_use, "The interface number to use for the watchdog "
282294
"timer. Setting to -1 defaults to the first registered "
283295
"interface");
284296

285-
module_param_call(timeout, set_param_int, get_param_int, &timeout, 0644);
297+
module_param(timeout, timeout, 0644);
286298
MODULE_PARM_DESC(timeout, "Timeout value in seconds.");
287299

288-
module_param_call(pretimeout, set_param_int, get_param_int, &pretimeout, 0644);
300+
module_param(pretimeout, timeout, 0644);
289301
MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds.");
290302

291-
module_param_call(action, set_param_str, get_param_str, action_op, 0644);
303+
module_param_cb(action, &param_ops_str, action_op, 0644);
292304
MODULE_PARM_DESC(action, "Timeout action. One of: "
293305
"reset, none, power_cycle, power_off.");
294306

295-
module_param_call(preaction, set_param_str, get_param_str, preaction_op, 0644);
307+
module_param_cb(preaction, &param_ops_str, preaction_op, 0644);
296308
MODULE_PARM_DESC(preaction, "Pretimeout action. One of: "
297309
"pre_none, pre_smi, pre_nmi, pre_int.");
298310

299-
module_param_call(preop, set_param_str, get_param_str, preop_op, 0644);
311+
module_param_cb(preop, &param_ops_str, preop_op, 0644);
300312
MODULE_PARM_DESC(preop, "Pretimeout driver operation. One of: "
301313
"preop_none, preop_panic, preop_give_data.");
302314

‎drivers/ide/ide.c‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ EXPORT_SYMBOL_GPL(ide_pci_clk);
177177
module_param_named(pci_clock, ide_pci_clk, int, 0);
178178
MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
179179

180-
static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp)
180+
static int ide_set_dev_param_mask(const char *s, const struct kernel_param *kp)
181181
{
182182
int a, b, i, j = 1;
183183
unsigned int *dev_param_mask = (unsigned int *)kp->arg;
@@ -200,34 +200,40 @@ static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp)
200200
return 0;
201201
}
202202

203+
static struct kernel_param_ops param_ops_ide_dev_mask = {
204+
.set = ide_set_dev_param_mask
205+
};
206+
207+
#define param_check_ide_dev_mask(name, p) param_check_uint(name, p)
208+
203209
static unsigned int ide_nodma;
204210

205-
module_param_call(nodma, ide_set_dev_param_mask, NULL, &ide_nodma, 0);
211+
module_param_named(nodma, ide_nodma, ide_dev_mask, 0);
206212
MODULE_PARM_DESC(nodma, "disallow DMA for a device");
207213

208214
static unsigned int ide_noflush;
209215

210-
module_param_call(noflush, ide_set_dev_param_mask, NULL, &ide_noflush, 0);
216+
module_param_named(noflush, ide_noflush, ide_dev_mask, 0);
211217
MODULE_PARM_DESC(noflush, "disable flush requests for a device");
212218

213219
static unsigned int ide_nohpa;
214220

215-
module_param_call(nohpa, ide_set_dev_param_mask, NULL, &ide_nohpa, 0);
221+
module_param_named(nohpa, ide_nohpa, ide_dev_mask, 0);
216222
MODULE_PARM_DESC(nohpa, "disable Host Protected Area for a device");
217223

218224
static unsigned int ide_noprobe;
219225

220-
module_param_call(noprobe, ide_set_dev_param_mask, NULL, &ide_noprobe, 0);
226+
module_param_named(noprobe, ide_noprobe, ide_dev_mask, 0);
221227
MODULE_PARM_DESC(noprobe, "skip probing for a device");
222228

223229
static unsigned int ide_nowerr;
224230

225-
module_param_call(nowerr, ide_set_dev_param_mask, NULL, &ide_nowerr, 0);
231+
module_param_named(nowerr, ide_nowerr, ide_dev_mask, 0);
226232
MODULE_PARM_DESC(nowerr, "ignore the ATA_DF bit for a device");
227233

228234
static unsigned int ide_cdroms;
229235

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

233239
struct chs_geom {

‎drivers/input/misc/ati_remote2.c‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ enum {
3838
};
3939

4040
static int ati_remote2_set_mask(const char *val,
41-
struct kernel_param *kp, unsigned int max)
41+
const struct kernel_param *kp,
42+
unsigned int max)
4243
{
4344
unsigned long mask;
4445
int ret;
@@ -59,28 +60,31 @@ static int ati_remote2_set_mask(const char *val,
5960
}
6061

6162
static int ati_remote2_set_channel_mask(const char *val,
62-
struct kernel_param *kp)
63+
const struct kernel_param *kp)
6364
{
6465
pr_debug("%s()\n", __func__);
6566

6667
return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_CHANNEL_MASK);
6768
}
6869

69-
static int ati_remote2_get_channel_mask(char *buffer, struct kernel_param *kp)
70+
static int ati_remote2_get_channel_mask(char *buffer,
71+
const struct kernel_param *kp)
7072
{
7173
pr_debug("%s()\n", __func__);
7274

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

76-
static int ati_remote2_set_mode_mask(const char *val, struct kernel_param *kp)
78+
static int ati_remote2_set_mode_mask(const char *val,
79+
const struct kernel_param *kp)
7780
{
7881
pr_debug("%s()\n", __func__);
7982

8083
return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_MODE_MASK);
8184
}
8285

83-
static int ati_remote2_get_mode_mask(char *buffer, struct kernel_param *kp)
86+
static int ati_remote2_get_mode_mask(char *buffer,
87+
const struct kernel_param *kp)
8488
{
8589
pr_debug("%s()\n", __func__);
8690

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

9094
static unsigned int channel_mask = ATI_REMOTE2_MAX_CHANNEL_MASK;
9195
#define param_check_channel_mask(name, p) __param_check(name, p, unsigned int)
92-
#define param_set_channel_mask ati_remote2_set_channel_mask
93-
#define param_get_channel_mask ati_remote2_get_channel_mask
96+
static struct kernel_param_ops param_ops_channel_mask = {
97+
.set = ati_remote2_set_channel_mask,
98+
.get = ati_remote2_get_channel_mask,
99+
};
94100
module_param(channel_mask, channel_mask, 0644);
95101
MODULE_PARM_DESC(channel_mask, "Bitmask of channels to accept <15:Channel16>...<1:Channel2><0:Channel1>");
96102

97103
static unsigned int mode_mask = ATI_REMOTE2_MAX_MODE_MASK;
98104
#define param_check_mode_mask(name, p) __param_check(name, p, unsigned int)
99-
#define param_set_mode_mask ati_remote2_set_mode_mask
100-
#define param_get_mode_mask ati_remote2_get_mode_mask
105+
static struct kernel_param_ops param_ops_mode_mask = {
106+
.set = ati_remote2_set_mode_mask,
107+
.get = ati_remote2_get_mode_mask,
108+
};
101109
module_param(mode_mask, mode_mask, 0644);
102110
MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>");
103111

0 commit comments

Comments
 (0)