Input: gameport - let device core tell us if device was registered
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 6 Jan 2010 01:56:03 +0000 (17:56 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 6 Jan 2010 08:23:51 +0000 (00:23 -0800)
No need to keep track of it by ourselves.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/gameport/gameport.c
include/linux/gameport.h

index ac11be08585e9fc70d75e466ebd9942006c78d0f..f9e5f8e1690ba0ba159adcf2ec105684c6beda75 100644 (file)
@@ -561,8 +561,6 @@ static void gameport_add_port(struct gameport *gameport)
                printk(KERN_ERR
                        "gameport: device_add() failed for %s (%s), error: %d\n",
                        gameport->phys, gameport->name, error);
-       else
-               gameport->registered = 1;
 }
 
 /*
@@ -584,10 +582,8 @@ static void gameport_destroy_port(struct gameport *gameport)
                gameport->parent = NULL;
        }
 
-       if (gameport->registered) {
+       if (device_is_registered(&gameport->dev))
                device_del(&gameport->dev);
-               gameport->registered = 0;
-       }
 
        list_del_init(&gameport->node);
 
index 1bc08541c2b9cff63e3ae58267244321034edb5b..48e68da097f6f50000b80e8dd10a82581233179b 100644 (file)
@@ -46,7 +46,6 @@ struct gameport {
        struct mutex drv_mutex;         /* protects serio->drv so attributes can pin driver */
 
        struct device dev;
-       unsigned int registered;        /* port has been fully registered with driver core */
 
        struct list_head node;
 };