From patchwork Fri May 15 16:38:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Kuske X-Patchwork-Id: 6415541 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5D37DC0432 for ; Fri, 15 May 2015 16:43:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A86D204B0 for ; Fri, 15 May 2015 16:43:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AC31B204D2 for ; Fri, 15 May 2015 16:43:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YtIfU-0003MJ-8P; Fri, 15 May 2015 16:41:00 +0000 Received: from mail-wg0-x232.google.com ([2a00:1450:400c:c00::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YtIe8-0001cE-L8 for linux-arm-kernel@lists.infradead.org; Fri, 15 May 2015 16:39:38 +0000 Received: by wgbhc8 with SMTP id hc8so85547435wgb.3 for ; Fri, 15 May 2015 09:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U4Z6hFelRap8DYd1wTOV1N/RpNK1ee3uLxVKgDXvKpU=; b=piAKjEP7ElDq4zpyNiQ1j1vTiWUiHhrbK0Fi5sb5JnwnK1W8qHUJrUNBAhBp8XqKAw PjWfwpXe2UrOj75sr57HovIrtK/9DY+CYJLFh+eg3HlMAs8scJVKoHTl7v2bDijkzoar pYQLA/cg3gvKWNDQwtl8SQvOOnAsKhrNZ5Upm6i05ydHnwkyXXxaT/qn4DtXnLJ8ZV9l 2oILrVEZyQnPECCnMngP09aAbed5dP4VNbFxpgJkC5DC8GWTLnjCJjCJ1kIiYxysMUIG mHB55y0qXWV1LOOJ6UdntQJhQ8T4CM1Y3bfntrHOD8bl6H6zbyhQg0esQafJ8QPNgpO3 DPRg== X-Received: by 10.194.134.40 with SMTP id ph8mr20158765wjb.147.1431707954669; Fri, 15 May 2015 09:39:14 -0700 (PDT) Received: from pc-jens.localdomain (p5B2E8A8F.dip0.t-ipconnect.de. [91.46.138.143]) by mx.google.com with ESMTPSA id ek10sm3726040wid.1.2015.05.15.09.39.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 May 2015 09:39:14 -0700 (PDT) From: Jens Kuske To: Maxime Ripard , =?UTF-8?q?Emilio=20L=C3=B3pez?= , Mike Turquette , Linus Walleij , Rob Herring Subject: [PATCH v2 04/10] pinctrl: sunxi: Prepare for building SoC specific drivers as modules Date: Fri, 15 May 2015 18:38:54 +0200 Message-Id: <1431707940-19372-5-git-send-email-jenskuske@gmail.com> X-Mailer: git-send-email 2.4.0 In-Reply-To: <1431707940-19372-1-git-send-email-jenskuske@gmail.com> References: <1431707940-19372-1-git-send-email-jenskuske@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150515_093936_907015_733283A4 X-CRM114-Status: GOOD ( 13.51 ) X-Spam-Score: -0.8 (/) Cc: devicetree@vger.kernel.org, Vishnu Patekar , linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Hans de Goede , Chen-Yu Tsai , Jens Kuske , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 Add a remove function and export the init and remove function to allow us to build the SoC specific drivers as modules. Signed-off-by: Jens Kuske --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 25 +++++++++++++++++++------ drivers/pinctrl/sunxi/pinctrl-sunxi.h | 2 ++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index f8e171b..4ef6b3d 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -856,7 +856,6 @@ int sunxi_pinctrl_init(struct platform_device *pdev, struct sunxi_pinctrl *pctl; struct resource *res; int i, ret, last_pin; - struct clk *clk; pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); if (!pctl) @@ -954,13 +953,13 @@ int sunxi_pinctrl_init(struct platform_device *pdev, goto gpiochip_error; } - clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); + pctl->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(pctl->clk)) { + ret = PTR_ERR(pctl->clk); goto gpiochip_error; } - ret = clk_prepare_enable(clk); + ret = clk_prepare_enable(pctl->clk); if (ret) goto gpiochip_error; @@ -1015,10 +1014,24 @@ int sunxi_pinctrl_init(struct platform_device *pdev, return 0; clk_error: - clk_disable_unprepare(clk); + clk_disable_unprepare(pctl->clk); gpiochip_error: gpiochip_remove(pctl->chip); pinctrl_error: pinctrl_unregister(pctl->pctl_dev); return ret; } +EXPORT_SYMBOL(sunxi_pinctrl_init); + +int sunxi_pinctrl_remove(struct platform_device *pdev) +{ + struct sunxi_pinctrl *pctl = platform_get_drvdata(pdev); + + gpiochip_remove(pctl->chip); + pinctrl_unregister(pctl->pctl_dev); + + clk_disable_unprepare(pctl->clk); + + return 0; +} +EXPORT_SYMBOL(sunxi_pinctrl_remove); diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index e248e81..4442676 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h @@ -126,6 +126,7 @@ struct sunxi_pinctrl { unsigned *irq_array; spinlock_t lock; struct pinctrl_dev *pctl_dev; + struct clk *clk; }; #define SUNXI_PIN(_pin, ...) \ @@ -285,5 +286,6 @@ static inline u32 sunxi_irq_status_offset(u16 irq) int sunxi_pinctrl_init(struct platform_device *pdev, const struct sunxi_pinctrl_desc *desc); +int sunxi_pinctrl_remove(struct platform_device *pdev); #endif /* __PINCTRL_SUNXI_H */