]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: Convert gpio-switch to platform_driver
authorandrzej zaborowski <balrog@zabor.org>
Thu, 9 Nov 2006 23:28:48 +0000 (01:28 +0200)
committerTony Lindgren <tony@atomide.com>
Thu, 9 Nov 2006 23:34:23 +0000 (01:34 +0200)
Converts the gpio-switch driver to platform_driver to avoid bad cast
which occurs because the bus type is set to platform bus. Also
silences the following warnings:

arch/arm/plat-omap/gpio-switch.c:292: warning: ignoring return value
of 'device_create_file', declared with attribute warn_unused_result
arch/arm/plat-omap/gpio-switch.c:293: warning: ignoring return value
of 'device_create_file', declared with attribute warn_unused_result
arch/arm/plat-omap/gpio-switch.c:294: warning: ignoring return value
of 'device_create_file', declared with attribute warn_unused_result

Signed-off-by: Andrzej Zaborowski <balrog@zabor.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/plat-omap/gpio-switch.c

index f2e09e2cd8909e3e80bffa1bc46b32cfd54c5035..7cf47cce754964f8cd0d143da9b068dbb9c6852a 100644 (file)
@@ -49,7 +49,7 @@ struct gpio_switch {
 
 static LIST_HEAD(gpio_switches);
 static struct platform_device *gpio_sw_platform_dev;
-static struct device_driver gpio_sw_driver;
+static struct platform_driver gpio_sw_driver;
 
 static const struct omap_gpio_switch *board_gpio_sw_table;
 static int board_gpio_sw_count;
@@ -266,7 +266,7 @@ static int __init new_switch(struct gpio_switch *sw)
        sw->pdev.id     = -1;
 
        sw->pdev.dev.parent = &gpio_sw_platform_dev->dev;
-       sw->pdev.dev.driver = &gpio_sw_driver;
+       sw->pdev.dev.driver = &gpio_sw_driver.driver;
        sw->pdev.dev.release = gpio_sw_release;
 
        r = platform_device_register(&sw->pdev);
@@ -289,9 +289,13 @@ static int __init new_switch(struct gpio_switch *sw)
 
        sw->state = gpio_sw_get_state(sw);
 
-       device_create_file(&sw->pdev.dev, &dev_attr_state);
-       device_create_file(&sw->pdev.dev, &dev_attr_type);
-       device_create_file(&sw->pdev.dev, &dev_attr_direction);
+       r = 0;
+       r |= device_create_file(&sw->pdev.dev, &dev_attr_state);
+       r |= device_create_file(&sw->pdev.dev, &dev_attr_type);
+       r |= device_create_file(&sw->pdev.dev, &dev_attr_direction);
+       if (r)
+               printk(KERN_ERR "gpio-switch: attribute file creation "
+                      "failed for %s\n", sw->name);
 
        if (!direction)
                return 0;
@@ -469,14 +473,16 @@ static void __init report_initial_state(void)
        }
 }
 
-static void gpio_sw_shutdown(struct device *dev)
+static int gpio_sw_remove(struct platform_device *dev)
 {
+       return 0;
 }
 
-static struct device_driver gpio_sw_driver = {
-       .name           = "gpio-switch",
-       .bus            = &platform_bus_type,
-       .shutdown       = gpio_sw_shutdown,
+static struct platform_driver gpio_sw_driver = {
+       .remove         = gpio_sw_remove,
+       .driver         = {
+               .name   = "gpio-switch",
+       },
 };
 
 void __init omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
@@ -494,7 +500,7 @@ static int __init gpio_sw_init(void)
 
        printk(KERN_INFO "OMAP GPIO switch handler initializing\n");
 
-       r = driver_register(&gpio_sw_driver);
+       r = platform_driver_register(&gpio_sw_driver);
        if (r)
                return r;
 
@@ -520,7 +526,7 @@ err2:
        gpio_sw_cleanup();
        platform_device_unregister(gpio_sw_platform_dev);
 err1:
-       driver_unregister(&gpio_sw_driver);
+       platform_driver_unregister(&gpio_sw_driver);
        return r;
 }
 
@@ -528,7 +534,7 @@ static void __exit gpio_sw_exit(void)
 {
        gpio_sw_cleanup();
        platform_device_unregister(gpio_sw_platform_dev);
-       driver_unregister(&gpio_sw_driver);
+       platform_driver_unregister(&gpio_sw_driver);
 }
 
 #ifndef MODULE