Skip to content

Commit b187dd7

Browse files
author
Dmitry Torokhov
committed
Input: gameport - rearrange gameport_bus initialization
Initialize gameport_bus structure at compile time instead of at runtime in gameport_init(). Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent 1ea2a69 commit b187dd7

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎drivers/input/gameport/gameport.c‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -730,12 +730,6 @@ static int gameport_driver_remove(struct device *dev)
730730
return 0;
731731
}
732732

733-
static struct bus_type gameport_bus = {
734-
.name = "gameport",
735-
.probe = gameport_driver_probe,
736-
.remove = gameport_driver_remove,
737-
};
738-
739733
static void gameport_add_driver(struct gameport_driver *drv)
740734
{
741735
int error;
@@ -781,6 +775,15 @@ static int gameport_bus_match(struct device *dev, struct device_driver *drv)
781775
return !gameport_drv->ignore;
782776
}
783777

778+
static struct bus_type gameport_bus = {
779+
.name = "gameport",
780+
.dev_attrs = gameport_device_attrs,
781+
.drv_attrs = gameport_driver_attrs,
782+
.match = gameport_bus_match,
783+
.probe = gameport_driver_probe,
784+
.remove = gameport_driver_remove,
785+
};
786+
784787
static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *drv)
785788
{
786789
mutex_lock(&gameport->drv_mutex);
@@ -790,7 +793,6 @@ static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *
790793

791794
int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode)
792795
{
793-
794796
if (gameport->open) {
795797
if (gameport->open(gameport, mode)) {
796798
return -1;
@@ -818,9 +820,6 @@ static int __init gameport_init(void)
818820
{
819821
int error;
820822

821-
gameport_bus.dev_attrs = gameport_device_attrs;
822-
gameport_bus.drv_attrs = gameport_driver_attrs;
823-
gameport_bus.match = gameport_bus_match;
824823
error = bus_register(&gameport_bus);
825824
if (error) {
826825
printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error);

0 commit comments

Comments
 (0)