i2c: parport: Switch to use module_parport_driver()
Switch to use module_parport_driver() to reduce boilerplate code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
Родитель
60aea76d85
Коммит
9c5b1daa3b
|
@ -267,6 +267,16 @@ static void i2c_parport_attach(struct parport *port)
|
||||||
int i;
|
int i;
|
||||||
struct pardev_cb i2c_parport_cb;
|
struct pardev_cb i2c_parport_cb;
|
||||||
|
|
||||||
|
if (type < 0) {
|
||||||
|
pr_warn("adapter type unspecified\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type >= ARRAY_SIZE(adapter_parm)) {
|
||||||
|
pr_warn("invalid type (%d)\n", type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_DEVICE; i++) {
|
for (i = 0; i < MAX_DEVICE; i++) {
|
||||||
if (parport[i] == -1)
|
if (parport[i] == -1)
|
||||||
continue;
|
continue;
|
||||||
|
@ -392,32 +402,8 @@ static struct parport_driver i2c_parport_driver = {
|
||||||
.detach = i2c_parport_detach,
|
.detach = i2c_parport_detach,
|
||||||
.devmodel = true,
|
.devmodel = true,
|
||||||
};
|
};
|
||||||
|
module_parport_driver(i2c_parport_driver);
|
||||||
/* ----- Module loading, unloading and information ------------------------ */
|
|
||||||
|
|
||||||
static int __init i2c_parport_init(void)
|
|
||||||
{
|
|
||||||
if (type < 0) {
|
|
||||||
pr_warn("adapter type unspecified\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type >= ARRAY_SIZE(adapter_parm)) {
|
|
||||||
pr_warn("invalid type (%d)\n", type);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parport_register_driver(&i2c_parport_driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __exit i2c_parport_exit(void)
|
|
||||||
{
|
|
||||||
parport_unregister_driver(&i2c_parport_driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>");
|
MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>");
|
||||||
MODULE_DESCRIPTION("I2C bus over parallel port");
|
MODULE_DESCRIPTION("I2C bus over parallel port");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
module_init(i2c_parport_init);
|
|
||||||
module_exit(i2c_parport_exit);
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче