.get_ro = mmc_omap_get_ro,
};
-static int __init mmc_omap_probe(struct device *dev)
+static int __init mmc_omap_probe(struct platform_device *pdev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct omap_mmc_conf *minfo = dev->platform_data;
+ struct omap_mmc_conf *minfo = pdev->dev.platform_data;
struct mmc_host *mmc;
struct mmc_omap_host *host = NULL;
int ret = 0;
return -EBUSY;
}
- mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), dev);
+ mmc = mmc_alloc_host(sizeof(struct mmc_omap_host), &pdev->dev);
if (!mmc) {
ret = -ENOMEM;
goto out;
host->id = pdev->id;
if (cpu_is_omap24xx()) {
- host->iclk = clk_get(dev, "mmc_ick");
+ host->iclk = clk_get(&pdev->dev, "mmc_ick");
if (IS_ERR(host->iclk))
goto out;
clk_use(host->iclk);
}
if (!cpu_is_omap24xx())
- host->fclk = clk_get(dev,
+ host->fclk = clk_get(&pdev->dev,
(host->id == 1) ? "mmc1_ck" : "mmc2_ck");
else
- host->fclk = clk_get(dev, "mmc_fck");
+ host->fclk = clk_get(&pdev->dev, "mmc_fck");
if (IS_ERR(host->fclk)) {
ret = PTR_ERR(host->fclk);
if (ret)
goto out;
- host->dev = dev;
- dev_set_drvdata(dev, host);
+ host->dev = &pdev->dev;
+ platform_set_drvdata(pdev, host);
mmc_add_host(mmc);
host->switch_pin = -1;
goto no_switch;
}
- ret = device_create_file(dev, &dev_attr_cover_switch);
+ ret = device_create_file(&pdev->dev, &dev_attr_cover_switch);
if (ret == 0) {
- ret = device_create_file(dev, &dev_attr_enable_poll);
+ ret = device_create_file(&pdev->dev, &dev_attr_enable_poll);
if (ret != 0)
- device_remove_file(dev, &dev_attr_cover_switch);
+ device_remove_file(&pdev->dev, &dev_attr_cover_switch);
}
if (ret) {
printk(KERN_WARNING "MMC%d: Unable to create sysfs attributes\n",
return ret;
}
-static int __exit mmc_omap_remove(struct device *dev)
+static int mmc_omap_remove(struct platform_device *pdev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct mmc_omap_host *host = dev_get_drvdata(dev);
+ struct mmc_omap_host *host = platform_get_drvdata(pdev);
- dev_set_drvdata(dev, NULL);
+ platform_set_drvdata(pdev, NULL);
if (host) {
mmc_remove_host(host->mmc);
if (host->power_pin >= 0)
omap_free_gpio(host->power_pin);
if (host->switch_pin >= 0) {
- device_remove_file(dev, &dev_attr_enable_poll);
- device_remove_file(dev, &dev_attr_cover_switch);
+ device_remove_file(&pdev->dev, &dev_attr_enable_poll);
+ device_remove_file(&pdev->dev, &dev_attr_cover_switch);
free_irq(OMAP_GPIO_IRQ(host->switch_pin), host);
omap_free_gpio(host->switch_pin);
host->switch_pin = -1;
}
#ifdef CONFIG_PM
-static int mmc_omap_suspend(struct device *dev, pm_message_t mesg)
+static int mmc_omap_suspend(struct platform_device *pdev, pm_message_t mesg)
{
int ret = 0;
- struct mmc_omap_host *host = dev_get_drvdata(dev);
+ struct mmc_omap_host *host = platform_get_drvdata(pdev);
if (host && host->suspended)
return 0;
return ret;
}
-static int mmc_omap_resume(struct device *dev)
+static int mmc_omap_resume(struct platform_device *pdev)
{
int ret = 0;
- struct mmc_omap_host *host = dev_get_drvdata(dev);
+ struct mmc_omap_host *host = platform_get_drvdata(pdev);
if (host && !host->suspended)
return 0;
#define mmc_omap_resume NULL
#endif
-static struct device_driver mmc_omap_driver = {
- .name = DRIVER_NAME,
- .bus = &platform_bus_type,
+static struct platform_driver mmc_omap_driver = {
.probe = mmc_omap_probe,
- .remove = __exit_p(mmc_omap_remove),
+ .remove = mmc_omap_remove,
.suspend = mmc_omap_suspend,
.resume = mmc_omap_resume,
+ .driver = {
+ .name = DRIVER_NAME,
+ },
};
static int __init mmc_omap_init(void)
{
- return driver_register(&mmc_omap_driver);
+ return platform_driver_register(&mmc_omap_driver);
}
static void __exit mmc_omap_exit(void)
{
- driver_unregister(&mmc_omap_driver);
+ platform_driver_unregister(&mmc_omap_driver);
}
module_init(mmc_omap_init);