From patchwork Tue Jan 28 00:39:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 3544901 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1069A9F382 for ; Tue, 28 Jan 2014 01:56:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AD902011E for ; Tue, 28 Jan 2014 01:56:55 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 1A47B20117 for ; Tue, 28 Jan 2014 01:56:54 +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 1W7xut-0004Fi-Q3; Tue, 28 Jan 2014 01:56:43 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W7xur-0008E1-C1; Tue, 28 Jan 2014 01:56:41 +0000 Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W7xuo-0008Ci-7Y for linux-arm-kernel@lists.infradead.org; Tue, 28 Jan 2014 01:56:38 +0000 Received: by mail-ea0-f176.google.com with SMTP id h14so2600968eaj.21 for ; Mon, 27 Jan 2014 17:56:14 -0800 (PST) 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=OuMpC/1n3FrcIFM0bwhxOCb38MYhwTV83g2ADfD7iIU=; b=07/PR1xMCjZhEPj1YfZSTyrC9c105fqv0yNFu54DZ6bYKVUEFuIn8VdP8yKc51FgZZ TPrvfN0IWq5ECPAeJf2IHyIMaNXkzrX5/0XdQ/KIlvUsIAhbIIqP4DJMdlLbEcQ0L4Nw 7J+TcUheKdbAJljw6z/JbugYhydRSp4x0+OXBCO2YvX8H6miu+L2iMCmjMeSt3kIR0v7 KmiOe5Aaeq8DeRfWrgeHfPOFaZ+Ogu3wdgjpAxaIOkVCZ2ys8yqtbwn6Vf0jys48o1Yw v5FrHNpGGAsumKQnK/7KfGevEolXaplIreZXtIEvw2Gj4zzCuTlm7x4OBlVNT6L1CHf1 pMkQ== X-Received: by 10.14.176.195 with SMTP id b43mr28276441eem.39.1390874174155; Mon, 27 Jan 2014 17:56:14 -0800 (PST) Received: from topkick.lan (dslc-082-083-251-183.pools.arcor-ip.net. [82.83.251.183]) by mx.google.com with ESMTPSA id m1sm27824463een.7.2014.01.27.17.56.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jan 2014 17:56:13 -0800 (PST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v2 07/21] pinctrl: mvebu: move generic group name generation Date: Tue, 28 Jan 2014 01:39:19 +0100 Message-Id: <1390869573-27624-8-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1390869573-27624-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1390674856-4993-1-git-send-email-sebastian.hesselbarth@gmail.com> <1390869573-27624-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140127_205638_420222_019A4192 X-CRM114-Status: GOOD ( 12.80 ) X-Spam-Score: -2.0 (--) Cc: Thomas Petazzoni , Andrew Lunn , Jason Cooper , Linus Walleij , linux-kernel@vger.kernel.org, Gregory Clement , linux-arm-kernel@lists.infradead.org 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=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, 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 MVEBU SoC pinctrl allows SoC specific drivers to pass a range of mpp pins without a corresponding name. Each pin in this range is then translated into a single-pin group with an auto-generated name. To allow some redesign of the driver, move name generation for those pin ranges down to where the groups are created. Signed-off-by: Sebastian Hesselbarth --- Cc: Jason Cooper Cc: Andrew Lunn Cc: Gregory Clement Cc: Thomas Petazzoni Cc: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index 90c35b20a7af..375666b0abc3 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -631,7 +631,6 @@ int mvebu_pinctrl_probe(struct platform_device *pdev, void __iomem *base) pctl->desc.npins = 0; for (n = 0; n < soc->ncontrols; n++) { struct mvebu_mpp_ctrl *ctrl = &soc->controls[n]; - char *names; pctl->desc.npins += ctrl->npins; /* initial control pins */ @@ -649,14 +648,6 @@ int mvebu_pinctrl_probe(struct platform_device *pdev, void __iomem *base) } /* generic mvebu register control */ - names = devm_kzalloc(&pdev->dev, ctrl->npins * 8, GFP_KERNEL); - if (!names) { - dev_err(&pdev->dev, "failed to alloc mpp names\n"); - return -ENOMEM; - } - for (k = 0; k < ctrl->npins; k++) - sprintf(names + 8*k, "mpp%d", ctrl->pid+k); - ctrl->name = names; pctl->num_groups += ctrl->npins; } @@ -689,7 +680,18 @@ int mvebu_pinctrl_probe(struct platform_device *pdev, void __iomem *base) pctl->groups[gid].npins = ctrl->npins; /* generic mvebu register control maps to a number of groups */ - if (!ctrl->mpp_get && !ctrl->mpp_set) { + if (!ctrl->name) { + char *names = devm_kzalloc(&pdev->dev, + ctrl->npins * 8, GFP_KERNEL); + if (!names) { + dev_err(&pdev->dev, "failed to alloc mpp names\n"); + return -ENOMEM; + } + for (k = 0; k < ctrl->npins; k++) + sprintf(names + 8*k, "mpp%d", ctrl->pid+k); + ctrl->name = names; + + pctl->groups[gid].name = &ctrl->name[0]; pctl->groups[gid].npins = 1; for (k = 1; k < ctrl->npins; k++) {