From patchwork Sat Jun 29 04:27:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 2803081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AA3EDBF4A1 for ; Sat, 29 Jun 2013 04:31:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C122620111 for ; Sat, 29 Jun 2013 04:31:01 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90DA52010F for ; Sat, 29 Jun 2013 04:31:00 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Usmmr-0004kv-Hz; Sat, 29 Jun 2013 04:29:26 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UsmmX-0003zY-4D; Sat, 29 Jun 2013 04:29:05 +0000 Received: from smtp2.mail.ru ([94.100.176.130]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Usmly-0003wo-Mq for linux-arm-kernel@lists.infradead.org; Sat, 29 Jun 2013 04:28:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=evFApkWQj2ydpRRHjAMUV71OvMt0UgugATNwHvB6YN8=; b=hcLIxFOtX3HKbEhMkEd2T/i5YZzuUZs+Cz3Fq8+FdApz/QQVrHnGcNnZ5FKYCI2VYmD1astUGENMRnqRyBhDgz64sd1JRhL9iRzFO3Hmwoer67H26J4FDUgFi+1HJaMghTusShsgLnR9arnpUfl2VOE/zdabI+AQkyV9MHfmJ3g=; Received: from [188.134.40.128] (port=37063 helo=shc.zet) by smtp2.mail.ru with esmtpa (envelope-from ) id 1Usmla-000593-4l; Sat, 29 Jun 2013 08:28:06 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 1/5] drivers: bus: imx-weim: Remove private driver data Date: Sat, 29 Jun 2013 08:27:50 +0400 Message-Id: <1372480074-24740-1-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.1.5 X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130629_002831_236519_D63172F0 X-CRM114-Status: GOOD ( 13.91 ) X-Spam-Score: -2.0 (--) Cc: Arnd Bergmann , Alexander Shiyan , Sascha Hauer , Huang Shijie , Grant Likely , Shawn Guo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Driver uses only probe function so no reason to keep variables in private driver data. Signed-off-by: Alexander Shiyan --- drivers/bus/imx-weim.c | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c index 349f14e..0c0e6fe 100644 --- a/drivers/bus/imx-weim.c +++ b/drivers/bus/imx-weim.c @@ -12,11 +12,6 @@ #include #include -struct imx_weim { - void __iomem *base; - struct clk *clk; -}; - static const struct of_device_id weim_id_table[] = { { .compatible = "fsl,imx6q-weim", }, {} @@ -27,10 +22,8 @@ MODULE_DEVICE_TABLE(of, weim_id_table); #define CS_REG_RANGE 0x18 /* Parse and set the timing for this device. */ -static int -weim_timing_setup(struct platform_device *pdev, struct device_node *np) +static int weim_timing_setup(struct device_node *np, void __iomem *base) { - struct imx_weim *weim = platform_get_drvdata(pdev); u32 value[CS_TIMING_LEN]; u32 cs_idx; int ret; @@ -52,11 +45,11 @@ weim_timing_setup(struct platform_device *pdev, struct device_node *np) /* set the timing for WEIM */ for (i = 0; i < CS_TIMING_LEN; i++) - writel(value[i], weim->base + cs_idx * CS_REG_RANGE + i * 4); + writel(value[i], base + cs_idx * CS_REG_RANGE + i * 4); return 0; } -static int weim_parse_dt(struct platform_device *pdev) +static int weim_parse_dt(struct platform_device *pdev, void __iomem *base) { struct device_node *child; int ret; @@ -65,7 +58,7 @@ static int weim_parse_dt(struct platform_device *pdev) if (!child->name) continue; - ret = weim_timing_setup(pdev, child); + ret = weim_timing_setup(child, base); if (ret) { dev_err(&pdev->dev, "%s set timing failed.\n", child->full_name); @@ -82,38 +75,32 @@ static int weim_parse_dt(struct platform_device *pdev) static int weim_probe(struct platform_device *pdev) { - struct imx_weim *weim; struct resource *res; + struct clk *clk; + void __iomem *base; int ret = -EINVAL; - weim = devm_kzalloc(&pdev->dev, sizeof(*weim), GFP_KERNEL); - if (!weim) { - ret = -ENOMEM; - goto weim_err; - } - platform_set_drvdata(pdev, weim); - /* get the resource */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - weim->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(weim->base)) { - ret = PTR_ERR(weim->base); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); goto weim_err; } /* get the clock */ - weim->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(weim->clk)) + clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(clk)) goto weim_err; - ret = clk_prepare_enable(weim->clk); + ret = clk_prepare_enable(clk); if (ret) goto weim_err; /* parse the device node */ - ret = weim_parse_dt(pdev); + ret = weim_parse_dt(pdev, base); if (ret) { - clk_disable_unprepare(weim->clk); + clk_disable_unprepare(clk); goto weim_err; }