Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1397898

[PATCH 1/5] reset: hisilicon: change the definition of hisi_reset_init

From Jiancheng Xue <xuejiancheng@hisilicon.com>
Newsgroups linux.kernel
Subject [PATCH 1/5] reset: hisilicon: change the definition of hisi_reset_init
Date 2016-05-10 11:40 +0200
Message-ID <rxcj0-8b4-23@gated-at.bofh.it> (permalink)
References <rxcj0-8b4-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Change the input arguments type to struct platform_device pointer.

Signed-off-by: Jiancheng Xue <xuejiancheng@hisilicon.com>
---
 drivers/clk/hisilicon/reset.c | 19 +++++++++----------
 drivers/clk/hisilicon/reset.h |  5 +++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c
index 6aa49c2..2a5015c 100644
--- a/drivers/clk/hisilicon/reset.c
+++ b/drivers/clk/hisilicon/reset.c
@@ -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);
diff --git a/drivers/clk/hisilicon/reset.h b/drivers/clk/hisilicon/reset.h
index 677d773..9a69374 100644
--- a/drivers/clk/hisilicon/reset.h
+++ b/drivers/clk/hisilicon/reset.h
@@ -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;
 }
-- 
1.9.1

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] clk: hisilicon: Fix some problems of clk-hi3519 Jiancheng Xue <xuejiancheng@hisilicon.com> - 2016-05-10 11:40 +0200
  [PATCH 1/5] reset: hisilicon: change the definition of hisi_reset_init Jiancheng Xue <xuejiancheng@hisilicon.com> - 2016-05-10 11:40 +0200
    Re: [PATCH 1/5] reset: hisilicon: change the definition of  hisi_reset_init Philipp Zabel <p.zabel@pengutronix.de> - 2016-05-10 13:20 +0200
  [PATCH 3/5] clk: hisilicon: add error processing for hisi_clk_register_* functions Jiancheng Xue <xuejiancheng@hisilicon.com> - 2016-05-10 11:40 +0200
  [PATCH 2/5] clk: hisilicon: add hisi_clk_alloc function. Jiancheng Xue <xuejiancheng@hisilicon.com> - 2016-05-10 11:40 +0200
  [PATCH 5/5] clk: hisilicon: hi3519: add driver remove path and fix some issues Jiancheng Xue <xuejiancheng@hisilicon.com> - 2016-05-10 11:40 +0200
    Re: [PATCH 5/5] clk: hisilicon: hi3519: add driver remove path and  fix some issues Philipp Zabel <p.zabel@pengutronix.de> - 2016-05-10 13:20 +0200
      Re: [PATCH 5/5] clk: hisilicon: hi3519: add driver remove path and  fix some issues Jiancheng Xue <xuejiancheng@hisilicon.com> - 2016-05-10 13:50 +0200

csiph-web