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;
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);
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;
}
}
-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,
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;
gpio_sw_cleanup();
platform_device_unregister(gpio_sw_platform_dev);
err1:
- driver_unregister(&gpio_sw_driver);
+ platform_driver_unregister(&gpio_sw_driver);
return r;
}
{
gpio_sw_cleanup();
platform_device_unregister(gpio_sw_platform_dev);
- driver_unregister(&gpio_sw_driver);
+ platform_driver_unregister(&gpio_sw_driver);
}
#ifndef MODULE