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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Cc: Dmitry Torokhov <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>

 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux