summaryrefslogtreecommitdiffstats
path: root/drivers/ssbi/ssbi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 13:25:35 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 13:25:35 -0700
commitd2033f2c1d1de2239ded15e478ddb4028f192a15 (patch)
treed60e4f447134ca008ef212c04f0e75256681ed04 /drivers/ssbi/ssbi.c
parent22237d5a588cfad92525d2998ff14d3666399dce (diff)
parent0ee8090c1d059eca4d60e8e473bee91fb5d1996b (diff)
Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups from Arnd Bergmann: "This contains cleanups as preparation for other branches adding new features, we pulled 16 branches for 9 platforms into this one. Most notable here is the removal of support for ATAGS based OMAP4 systems. Since all OMAP4 machines are fully functional with DT based booting in 3.10, we can remove a lot of code here. Also noteworthy is Maxime Ripard's cleanup of the machine descriptors, which means we need no machine descriptors in a lot more cases and can boot additional machines by just having the respective device drivers enabled." * tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (76 commits) ARM: picoxcell: remove .nr_irqs reference ARM: s5p64x0: avoid build warning for uncompress.h ARM: SAMSUNG: Remove unused plat/regs-watchdog.h header ARM: SAMSUNG: Remove legacy watchdog reset code ARM: SAMSUNG: Let platforms use the new watchdog reset driver ARM: SAMSUNG: Add watchdog reset driver ARM: SAMSUNG: Use local definitions of watchdog registers watchdog: s3c2410_wdt: Use local register definitions ARM: S5P64X0: Use common uncompress.h part for plat-samsung ARM: SAMSUNG: Consolidate uncompress subroutine ARM: at91: drop rm9200dk board support ARM: dts: msm: Fix merge resolution ARM: OMAP1: Remove dma.h ARM: OMAP1: Remove legacy irda.h and irda setup from board files ARM: OMAP1: Remove duplicated DMA channel definitions ARM: OMAP1: Remove McBSP DMA channel definitions ARM: OMAP2+: Remove dma.h ARM: OMAP2+: hwmod: Remove remaining DMA channel definitions ARM: OMAP2+: Remove duplicated DMA channel definitions ARM: OMAP2+: Remove AES crypto device DMA channel definitions ...
Diffstat (limited to 'drivers/ssbi/ssbi.c')
-rw-r--r--drivers/ssbi/ssbi.c69
1 files changed, 11 insertions, 58 deletions
diff --git a/drivers/ssbi/ssbi.c b/drivers/ssbi/ssbi.c
index e561d3be54a..102a2284429 100644
--- a/drivers/ssbi/ssbi.c
+++ b/drivers/ssbi/ssbi.c
@@ -268,35 +268,23 @@ static int ssbi_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct resource *mem_res;
struct ssbi *ssbi;
- int ret = 0;
const char *type;
- ssbi = kzalloc(sizeof(struct ssbi), GFP_KERNEL);
- if (!ssbi) {
- pr_err("can not allocate ssbi_data\n");
+ ssbi = devm_kzalloc(&pdev->dev, sizeof(*ssbi), GFP_KERNEL);
+ if (!ssbi)
return -ENOMEM;
- }
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem_res) {
- pr_err("missing mem resource\n");
- ret = -EINVAL;
- goto err_get_mem_res;
- }
+ ssbi->base = devm_ioremap_resource(&pdev->dev, mem_res);
+ if (IS_ERR(ssbi->base))
+ return PTR_ERR(ssbi->base);
- ssbi->base = ioremap(mem_res->start, resource_size(mem_res));
- if (!ssbi->base) {
- pr_err("ioremap of 0x%p failed\n", (void *)mem_res->start);
- ret = -EINVAL;
- goto err_ioremap;
- }
platform_set_drvdata(pdev, ssbi);
type = of_get_property(np, "qcom,controller-type", NULL);
if (type == NULL) {
- pr_err("Missing qcom,controller-type property\n");
- ret = -EINVAL;
- goto err_ssbi_controller;
+ dev_err(&pdev->dev, "Missing qcom,controller-type property\n");
+ return -EINVAL;
}
dev_info(&pdev->dev, "SSBI controller type: '%s'\n", type);
if (strcmp(type, "ssbi") == 0)
@@ -306,9 +294,8 @@ static int ssbi_probe(struct platform_device *pdev)
else if (strcmp(type, "pmic-arbiter") == 0)
ssbi->controller_type = MSM_SBI_CTRL_PMIC_ARBITER;
else {
- pr_err("Unknown qcom,controller-type\n");
- ret = -EINVAL;
- goto err_ssbi_controller;
+ dev_err(&pdev->dev, "Unknown qcom,controller-type\n");
+ return -EINVAL;
}
if (ssbi->controller_type == MSM_SBI_CTRL_PMIC_ARBITER) {
@@ -321,29 +308,7 @@ static int ssbi_probe(struct platform_device *pdev)
spin_lock_init(&ssbi->lock);
- ret = of_platform_populate(np, NULL, NULL, &pdev->dev);
- if (ret)
- goto err_ssbi_controller;
-
- return 0;
-
-err_ssbi_controller:
- platform_set_drvdata(pdev, NULL);
- iounmap(ssbi->base);
-err_ioremap:
-err_get_mem_res:
- kfree(ssbi);
- return ret;
-}
-
-static int ssbi_remove(struct platform_device *pdev)
-{
- struct ssbi *ssbi = platform_get_drvdata(pdev);
-
- platform_set_drvdata(pdev, NULL);
- iounmap(ssbi->base);
- kfree(ssbi);
- return 0;
+ return of_platform_populate(np, NULL, NULL, &pdev->dev);
}
static struct of_device_id ssbi_match_table[] = {
@@ -354,25 +319,13 @@ MODULE_DEVICE_TABLE(of, ssbi_match_table);
static struct platform_driver ssbi_driver = {
.probe = ssbi_probe,
- .remove = ssbi_remove,
.driver = {
.name = "ssbi",
.owner = THIS_MODULE,
.of_match_table = ssbi_match_table,
},
};
-
-static int __init ssbi_init(void)
-{
- return platform_driver_register(&ssbi_driver);
-}
-module_init(ssbi_init);
-
-static void __exit ssbi_exit(void)
-{
- platform_driver_unregister(&ssbi_driver);
-}
-module_exit(ssbi_exit)
+module_platform_driver(ssbi_driver);
MODULE_LICENSE("GPL v2");
MODULE_VERSION("1.0");