From patchwork Wed Oct 3 12:38:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Sodagudi X-Patchwork-Id: 10624763 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2339914BD for ; Wed, 3 Oct 2018 12:38:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1256028B3F for ; Wed, 3 Oct 2018 12:38:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06ACE28B4D; Wed, 3 Oct 2018 12:38:27 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93ED528B3F for ; Wed, 3 Oct 2018 12:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726679AbeJCT0j (ORCPT ); Wed, 3 Oct 2018 15:26:39 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33156 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726630AbeJCT0j (ORCPT ); Wed, 3 Oct 2018 15:26:39 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 37C1860C61; Wed, 3 Oct 2018 12:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538570305; bh=t1v4pEJjPNE+FRpJ81BoYEO/76ocEr6eiBO4I5TX8jk=; h=Date:From:To:Cc:Subject:From; b=PCR0BaEq4UPIMelh6DV+gVuS89R1BKCIKCVb9GSbtPnyQcu6oV+OZ+lU13Pwt4oiR LYgMX/6fT+aJaSeg8hVKPqNYXiR4b/FFmeV0H1cYe7jmanxN7N0KAYizNg5IwThluc CS7F2IqyeGKoyGDReNbnRR0amebNrdyzMRN5nrBo= Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 9DB0D60C55; Wed, 3 Oct 2018 12:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538570304; bh=t1v4pEJjPNE+FRpJ81BoYEO/76ocEr6eiBO4I5TX8jk=; h=Date:From:To:Cc:Subject:From; b=KtbTm/IAgqKm4jkdRJ9CCzthDu7Zjo4VvxK95ZYrqP38rS3RYxIvxG+dd20rRuCmR 9HDcY/VKFRlwpMSG3Uy1bW0MUXANzX4oZWyF31+xlA1m3fhCOcjehQEIBlxjmrzaQE FJ6m9CDClKao10HnQhcT6J8RKIEvHBLNgK1NPRUY= MIME-Version: 1.0 Date: Wed, 03 Oct 2018 05:38:24 -0700 From: Sodagudi Prasad To: linus.walleij@linaro.org, sboyd@codeaurora.org, linux-gpio@vger.kernel.org, bjorn.andersson@linaro.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org Subject: protected pins and debugfs Message-ID: <9aec322678417753fe4022691f4bfdbe@codeaurora.org> X-Sender: psodagud@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi All, This is regarding the protected pins configuration reading and printing from non-secure operating systems. GPIO framework is checking whether pin is in use(flag FLAG_REQUESTED) or not in gpiolib_dbg_show(). If GPIO chip drivers are overriding the dbg_show callback, drivers are not checking whether a pin is really in use or not to print configuration details. if (chip->dbg_show) chip->dbg_show(s, chip); else gpiolib_dbg_show(s, gdev); I think, reserved-gpio-ranges solution may move the problem to dts settings maintenance as they change from platform to platform. https://lore.kernel.org/patchwork/patch/878107/ https://lore.kernel.org/patchwork/patch/878106/ https://lore.kernel.org/patchwork/patch/878109/ Can we use a simple/common solution like below? It will check whether a pin is in use or not before printing configuration data with the help of gpiochip_is_requested(). index fef0970..2ca1440 100644 } } -Thanks, Prasad --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -579,16 +579,20 @@ static void msm_gpio_dbg_show_one(struct seq_file *s, seq_printf(s, " %-8s: %-3s %d", g->name, is_out ? "out" : "in", func); seq_printf(s, " %dmA", msm_regval_to_drive(drive)); seq_printf(s, " %s", pulls[pull]); + seq_puts(s, "\n"); } static void msm_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) { unsigned gpio = chip->base; unsigned i; + const char *label; for (i = 0; i < chip->ngpio; i++, gpio++) { + label = gpiochip_is_requested(chip, i); + if (!label) + continue; msm_gpio_dbg_show_one(s, NULL, chip, i, gpio); - seq_puts(s, "\n");