reset: hisilicon: change the definition of hisi_reset_init
authorJiancheng Xue <xuejiancheng@hisilicon.com>
Wed, 15 Jun 2016 06:26:34 +0000 (14:26 +0800)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 30 Jun 2016 19:33:22 +0000 (12:33 -0700)
Change the input arguments type to struct platform_device pointer.

Signed-off-by: Jiancheng Xue <xuejiancheng@hisilicon.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/hisilicon/clk-hi3519.c
drivers/clk/hisilicon/reset.c
drivers/clk/hisilicon/reset.h

index 715c7301a66ab33cae34c3ee7260550b20de7f57..8d12700d0cffc5cc4a2df1c627d18e0d4880bcc1 100644 (file)
@@ -86,7 +86,7 @@ static int hi3519_clk_probe(struct platform_device *pdev)
        struct hisi_clock_data *clk_data;
        struct hisi_reset_controller *rstc;
 
-       rstc = hisi_reset_init(np);
+       rstc = hisi_reset_init(pdev);
        if (!rstc)
                return -ENOMEM;
 
index 6aa49c2204d0836da2faf86f17277f9581b88378..2a5015c736ce6d604d371c0bcd2a894d1ae4015f 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <linux/io.h>
 #include <linux/of_address.h>
+#include <linux/platform_device.h>
 #include <linux/reset-controller.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -98,25 +99,25 @@ static const struct reset_control_ops hisi_reset_ops = {
        .deassert       = hisi_reset_deassert,
 };
 
-struct hisi_reset_controller *hisi_reset_init(struct device_node *np)
+struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev)
 {
        struct hisi_reset_controller *rstc;
+       struct resource *res;
 
-       rstc = kzalloc(sizeof(*rstc), GFP_KERNEL);
+       rstc = devm_kmalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL);
        if (!rstc)
                return NULL;
 
-       rstc->membase = of_iomap(np, 0);
-       if (!rstc->membase) {
-               kfree(rstc);
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       rstc->membase = devm_ioremap(&pdev->dev,
+                               res->start, resource_size(res));
+       if (!rstc->membase)
                return NULL;
-       }
 
        spin_lock_init(&rstc->lock);
-
        rstc->rcdev.owner = THIS_MODULE;
        rstc->rcdev.ops = &hisi_reset_ops;
-       rstc->rcdev.of_node = np;
+       rstc->rcdev.of_node = pdev->dev.of_node;
        rstc->rcdev.of_reset_n_cells = 2;
        rstc->rcdev.of_xlate = hisi_reset_of_xlate;
        reset_controller_register(&rstc->rcdev);
@@ -128,7 +129,5 @@ EXPORT_SYMBOL_GPL(hisi_reset_init);
 void hisi_reset_exit(struct hisi_reset_controller *rstc)
 {
        reset_controller_unregister(&rstc->rcdev);
-       iounmap(rstc->membase);
-       kfree(rstc);
 }
 EXPORT_SYMBOL_GPL(hisi_reset_exit);
index 677d773ed27c09dc9a72b820bce47b5c743de7dc..9a69374a0b3287acee17457678366228caa24e98 100644 (file)
@@ -22,10 +22,11 @@ struct device_node;
 struct hisi_reset_controller;
 
 #ifdef CONFIG_RESET_CONTROLLER
-struct hisi_reset_controller *hisi_reset_init(struct device_node *np);
+struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev);
 void hisi_reset_exit(struct hisi_reset_controller *rstc);
 #else
-static inline hisi_reset_controller *hisi_reset_init(struct device_node *np)
+static inline
+struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev)
 {
        return 0;
 }