[PATCH 3/4] input: check whether serio dirver registration is completed

From: Akinobu Mita
Date: Wed Nov 08 2006 - 07:40:38 EST


This patch adds a flag to serio driver indicating whether registration is
complete and check that flag in serio_unregister_driver.

Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>

drivers/input/serio/serio.c | 7 ++++++-
include/linux/serio.h | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)

Index: work-fault-inject/include/linux/serio.h
===================================================================
--- work-fault-inject.orig/include/linux/serio.h
+++ work-fault-inject/include/linux/serio.h
@@ -68,6 +68,7 @@ struct serio_driver {
void (*cleanup)(struct serio *);

struct device_driver driver;
+ int registered;
};
#define to_serio_driver(d) container_of(d, struct serio_driver, driver)

Index: work-fault-inject/drivers/input/serio/serio.c
===================================================================
--- work-fault-inject.orig/drivers/input/serio/serio.c
+++ work-fault-inject/drivers/input/serio/serio.c
@@ -804,6 +804,8 @@ static void serio_add_driver(struct seri
printk(KERN_ERR
"serio: driver_register() failed for %s, error: %d\n",
drv->driver.name, error);
+ else
+ drv->registered = 1;
}

int __serio_register_driver(struct serio_driver *drv, struct module *owner)
@@ -830,7 +832,10 @@ start_over:
}
}

- driver_unregister(&drv->driver);
+ if (drv->registered) {
+ driver_unregister(&drv->driver);
+ drv->registered = 0;
+ }
mutex_unlock(&serio_mutex);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/