diff options
| author | PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> | 2016-08-25 13:00:49 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-31 08:12:35 -0400 |
| commit | ca75d601b5942e8cf5eed68f308be0526d0dac5d (patch) | |
| tree | ca411c99f5715a5976eb942a061dfa3b2b6e841d /drivers/vhost | |
| parent | 832c8232dd7be4977ae9fb9c7cbc4decce19a8fc (diff) | |
miscdevice: Add helper macro for misc device boilerplate
Many modules call misc_register and misc_deregister in its module init
and exit methods without any additional code. This ends up being
boilerplate. This patch adds helper macro module_misc_device(), that
replaces module_init()/ module_exit() with template functions.
This patch also converts drivers to use new macro.
Change since v1:
Add device.h include in miscdevice.h as module_driver macro was not
available from other include files in some architectures.
Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vhost')
| -rw-r--r-- | drivers/vhost/test.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index 388eec4e1a90..70c342c987f7 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c | |||
| @@ -322,18 +322,7 @@ static struct miscdevice vhost_test_misc = { | |||
| 322 | "vhost-test", | 322 | "vhost-test", |
| 323 | &vhost_test_fops, | 323 | &vhost_test_fops, |
| 324 | }; | 324 | }; |
| 325 | 325 | module_misc_device(vhost_test_misc); | |
| 326 | static int vhost_test_init(void) | ||
| 327 | { | ||
| 328 | return misc_register(&vhost_test_misc); | ||
| 329 | } | ||
| 330 | module_init(vhost_test_init); | ||
| 331 | |||
| 332 | static void vhost_test_exit(void) | ||
| 333 | { | ||
| 334 | misc_deregister(&vhost_test_misc); | ||
| 335 | } | ||
| 336 | module_exit(vhost_test_exit); | ||
| 337 | 326 | ||
| 338 | MODULE_VERSION("0.0.1"); | 327 | MODULE_VERSION("0.0.1"); |
| 339 | MODULE_LICENSE("GPL v2"); | 328 | MODULE_LICENSE("GPL v2"); |
