Commit 6433b741 authored by andrzej zaborowski's avatar andrzej zaborowski Committed by Tony Lindgren

ARM: OMAP: Convert gpio-switch to platform_driver

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: default avatarAndrzej Zaborowski <balrog@zabor.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent d9e757b4
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment