Skip to content

Commit

Permalink
miscdevice: Use module_misc_device() macro
Browse files Browse the repository at this point in the history
This patch removes module_init()/module_exit() from driver code by using
module_misc_device() macro. All modules in this patch has a print
statement which is removed when module_misc_device() macro is used.
If undesirable this patch can be dropped entirely, this is the only
purpose of making this as a separate patch.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
PrasannaKumar Muralidharan authored and Greg Kroah-Hartman committed Aug 31, 2016
1 parent ca75d60 commit d6a38c0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 96 deletions.
25 changes: 1 addition & 24 deletions arch/um/drivers/harddog_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,4 @@ static struct miscdevice harddog_miscdev = {
.name = "watchdog",
.fops = &harddog_fops,
};

static char banner[] __initdata = KERN_INFO "UML Watchdog Timer\n";

static int __init harddog_init(void)
{
int ret;

ret = misc_register(&harddog_miscdev);

if (ret)
return ret;

printk(banner);

return 0;
}

static void __exit harddog_exit(void)
{
misc_deregister(&harddog_miscdev);
}

module_init(harddog_init);
module_exit(harddog_exit);
module_misc_device(harddog_miscdev);
16 changes: 1 addition & 15 deletions drivers/bluetooth/hci_vhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,21 +377,7 @@ static struct miscdevice vhci_miscdev = {
.fops = &vhci_fops,
.minor = VHCI_MINOR,
};

static int __init vhci_init(void)
{
BT_INFO("Virtual HCI driver ver %s", VERSION);

return misc_register(&vhci_miscdev);
}

static void __exit vhci_exit(void)
{
misc_deregister(&vhci_miscdev);
}

module_init(vhci_init);
module_exit(vhci_exit);
module_misc_device(vhci_miscdev);

module_param(amp, bool, 0644);
MODULE_PARM_DESC(amp, "Create AMP controller device");
Expand Down
40 changes: 1 addition & 39 deletions drivers/char/bfin-otp.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,45 +230,7 @@ static struct miscdevice bfin_otp_misc_device = {
.name = DRIVER_NAME,
.fops = &bfin_otp_fops,
};

/**
* bfin_otp_init - Initialize module
*
* Registers the device and notifier handler. Actual device
* initialization is handled by bfin_otp_open().
*/
static int __init bfin_otp_init(void)
{
int ret;

stampit();

ret = misc_register(&bfin_otp_misc_device);
if (ret) {
pr_init(KERN_ERR PFX "unable to register a misc device\n");
return ret;
}

pr_init(KERN_INFO PFX "initialized\n");

return 0;
}

/**
* bfin_otp_exit - Deinitialize module
*
* Unregisters the device and notifier handler. Actual device
* deinitialization is handled by bfin_otp_close().
*/
static void __exit bfin_otp_exit(void)
{
stampit();

misc_deregister(&bfin_otp_misc_device);
}

module_init(bfin_otp_init);
module_exit(bfin_otp_exit);
module_misc_device(bfin_otp_misc_device);

MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>");
MODULE_DESCRIPTION("Blackfin OTP Memory Interface");
Expand Down
19 changes: 1 addition & 18 deletions drivers/lightnvm/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,27 +1171,10 @@ static struct miscdevice _nvm_misc = {
.nodename = "lightnvm/control",
.fops = &_ctl_fops,
};
module_misc_device(_nvm_misc);

MODULE_ALIAS_MISCDEV(MISC_DYNAMIC_MINOR);

static int __init nvm_mod_init(void)
{
int ret;

ret = misc_register(&_nvm_misc);
if (ret)
pr_err("nvm: misc_register failed for control device");

return ret;
}

static void __exit nvm_mod_exit(void)
{
misc_deregister(&_nvm_misc);
}

MODULE_AUTHOR("Matias Bjorling <m@bjorling.me>");
MODULE_LICENSE("GPL v2");
MODULE_VERSION("0.1");
module_init(nvm_mod_init);
module_exit(nvm_mod_exit);

0 comments on commit d6a38c0

Please sign in to comment.