Skip to content

Commit 1a8bff5

Browse files
committed
ide: use module_param_named rather than module_param_call
It has the additional benefit of typechecking (in this case, an unsigned int). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Takashi Iwai <tiwai@suse.de>
1 parent c8ba6c5 commit 1a8bff5

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

‎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 {

0 commit comments

Comments
 (0)