From patchwork Mon Mar 6 23:32:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 9607827 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18E38602B4 for ; Mon, 6 Mar 2017 23:32:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8A952845E for ; Mon, 6 Mar 2017 23:32:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB12D28478; Mon, 6 Mar 2017 23:32:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5F1952845E for ; Mon, 6 Mar 2017 23:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VNCeJYvrYVBpcLFUz8/IIwdZcuPr8jmWdoPxKtD2DCE=; b=V3b1SUAl6Wzlhj rRyAeCz8d/46k3Hb250J9u98usebWakdrfHjONccSs4NHPYSw6M0+r29555KfVEy8+fd9kSIgGqJo XoPs+Bz4SxnGvZvM1g6stP3RCs2HDrwCP2yixXkqYjCBvBI7eC9k0rsoMn/SWmX6uG/3NMD8vqIzY KfdgLlTJ7esmE7kNSZPE1w37l4mxbs0om0sngFZ1GlAZbe/L6RXGpkKmnDOczo4D10a3+mKFH8aNs UKoa73m4Ei+XIM8InpUYbbvG+ukm5cUPFhk73lNkroGipljx+MNBYZoPXfjKMdzhcBlCczVFSC3O8 As+hRukkgpceOtmwqZEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cl27X-0007qn-PK; Mon, 06 Mar 2017 23:32:51 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cl279-0007pm-7f for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2017 23:32:28 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BBAD96073E; Mon, 6 Mar 2017 23:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1488843125; bh=K6oLWqpSxusoNIpUNaSzE3P1Nn9Vp6KYo9E9SbPjhO4=; h=From:To:Subject:Date:From; b=NOoGsf0CUs1/4ceD9ZEPnvhy/rs4LIvUpmEtkF+jV4GmPacqNX21HSIXhk8+6as5G rkc3YZ+7DoTdJUxSe8DdhkwAqYM4UXDmBBd0LX+LmgJ8nvevriDg61hpp9WeG5tDSp 14NpvXcXDSUhALG4TZ8Q94ox0MebpfBh1J8s5NV0= Received: from timur-ubuntu.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: timur@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9EA3B6073E; Mon, 6 Mar 2017 23:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1488843125; bh=K6oLWqpSxusoNIpUNaSzE3P1Nn9Vp6KYo9E9SbPjhO4=; h=From:To:Subject:Date:From; b=NOoGsf0CUs1/4ceD9ZEPnvhy/rs4LIvUpmEtkF+jV4GmPacqNX21HSIXhk8+6as5G rkc3YZ+7DoTdJUxSe8DdhkwAqYM4UXDmBBd0LX+LmgJ8nvevriDg61hpp9WeG5tDSp 14NpvXcXDSUhALG4TZ8Q94ox0MebpfBh1J8s5NV0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9EA3B6073E Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=timur@codeaurora.org From: Timur Tabi To: Stephen Boyd , Linus Walleij , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] pinctrl: qcom: qdf2xxx: add names to the gpios Date: Mon, 6 Mar 2017 17:32:02 -0600 Message-Id: <1488843122-7960-1-git-send-email-timur@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170306_153227_304643_BEF4E249 X-CRM114-Status: GOOD ( 12.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 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-Virus-Scanned: ClamAV using ClamSMTP The sysfs and debugfs entries for pin control drivers work better when the individual pins are given real names, even if they are all just "gpio0", "gpio1", etc. Signed-off-by: Timur Tabi Acked-by: Bjorn Andersson --- drivers/pinctrl/qcom/pinctrl-qdf2xxx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c index f448534..bb3ce5c 100644 --- a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c +++ b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c @@ -35,10 +35,14 @@ /* A reasonable limit to the number of GPIOS */ #define MAX_GPIOS 256 +/* maximum size of each gpio name (enough room for "gpioXXX" + null) */ +#define NAME_SIZE 8 + static int qdf2xxx_pinctrl_probe(struct platform_device *pdev) { struct pinctrl_pin_desc *pins; struct msm_pingroup *groups; + char (*names)[NAME_SIZE]; unsigned int i; u32 num_gpios; int ret; @@ -59,15 +63,21 @@ static int qdf2xxx_pinctrl_probe(struct platform_device *pdev) sizeof(struct pinctrl_pin_desc), GFP_KERNEL); groups = devm_kcalloc(&pdev->dev, num_gpios, sizeof(struct msm_pingroup), GFP_KERNEL); + names = devm_kcalloc(&pdev->dev, num_gpios, NAME_SIZE, GFP_KERNEL); - if (!pins || !groups) + if (!pins || !groups || !names) return -ENOMEM; for (i = 0; i < num_gpios; i++) { + snprintf(names[i], NAME_SIZE, "gpio%u", i); + pins[i].number = i; + pins[i].name = names[i]; - groups[i].npins = 1, + groups[i].npins = 1; + groups[i].name = names[i]; groups[i].pins = &pins[i].number; + groups[i].ctl_reg = 0x10000 * i; groups[i].io_reg = 0x04 + 0x10000 * i; groups[i].intr_cfg_reg = 0x08 + 0x10000 * i;