Commit 490e280a authored by Fabio Estevam's avatar Fabio Estevam Committed by David Woodhouse

mtd: gpmi-nand: Convert to module_platform_driver()

Using module_platform_driver() makes the code smaller and cleaner.
Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 3d10095a
...@@ -1651,6 +1651,8 @@ static int __devinit gpmi_nand_probe(struct platform_device *pdev) ...@@ -1651,6 +1651,8 @@ static int __devinit gpmi_nand_probe(struct platform_device *pdev)
if (ret) if (ret)
goto exit_nfc_init; goto exit_nfc_init;
dev_info(this->dev, "driver registered.\n");
return 0; return 0;
exit_nfc_init: exit_nfc_init:
...@@ -1658,10 +1660,12 @@ static int __devinit gpmi_nand_probe(struct platform_device *pdev) ...@@ -1658,10 +1660,12 @@ static int __devinit gpmi_nand_probe(struct platform_device *pdev)
exit_acquire_resources: exit_acquire_resources:
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
kfree(this); kfree(this);
dev_err(this->dev, "driver registration failed: %d\n", ret);
return ret; return ret;
} }
static int __exit gpmi_nand_remove(struct platform_device *pdev) static int __devexit gpmi_nand_remove(struct platform_device *pdev)
{ {
struct gpmi_nand_data *this = platform_get_drvdata(pdev); struct gpmi_nand_data *this = platform_get_drvdata(pdev);
...@@ -1678,29 +1682,10 @@ static struct platform_driver gpmi_nand_driver = { ...@@ -1678,29 +1682,10 @@ static struct platform_driver gpmi_nand_driver = {
.of_match_table = gpmi_nand_id_table, .of_match_table = gpmi_nand_id_table,
}, },
.probe = gpmi_nand_probe, .probe = gpmi_nand_probe,
.remove = __exit_p(gpmi_nand_remove), .remove = __devexit_p(gpmi_nand_remove),
.id_table = gpmi_ids, .id_table = gpmi_ids,
}; };
module_platform_driver(gpmi_nand_driver);
static int __init gpmi_nand_init(void)
{
int err;
err = platform_driver_register(&gpmi_nand_driver);
if (err == 0)
pr_info("driver registered.\n");
else
pr_err("driver registration failed.\n");
return err;
}
static void __exit gpmi_nand_exit(void)
{
platform_driver_unregister(&gpmi_nand_driver);
}
module_init(gpmi_nand_init);
module_exit(gpmi_nand_exit);
MODULE_AUTHOR("Freescale Semiconductor, Inc."); MODULE_AUTHOR("Freescale Semiconductor, Inc.");
MODULE_DESCRIPTION("i.MX GPMI NAND Flash Controller Driver"); MODULE_DESCRIPTION("i.MX GPMI NAND Flash Controller Driver");
......
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