From patchwork Fri May 15 13:25:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Grygorii.Strashko@linaro.org" X-Patchwork-Id: 48564 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D4C7214BA for ; Fri, 15 May 2015 13:26:04 +0000 (UTC) Received: by laed2 with SMTP id d2sf7804839lae.0 for ; Fri, 15 May 2015 06:26:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=so2jzyaILvzJwral1wfQNiw8ijqfE3SZzV9AugN/fP0=; b=iQNkdW1mZOCmCymSipDp1aaseWilwleZwJZp5zW8pUMTIYFfSQny2Q5Lo5UlawJiiq S0kMOfRsXcbOH2I+7gdJJB2dYKlNeAAJmtMYRydQAL3FgmpjCip1RPYGRkstJsO6ntQt eQ4Hx0CZWm1cmWSDzw8PAeiWk5EEql5/WvBzMtnKxwQoSstbfnRLsYc5Z5XBXO3fOHfS 9SFjOcluzvLFMxPN72Cgn+/5y7wfnY7+IBvEp0Xy4R59PpqvXiEC63/S2TTDtiHVzjgr 8q9Z+Z9EDmatXTe7r0hpye9WHisSiwSf0t2uOi7/NUFukANWjBql/fA8Ds4gOssqLLkB etIQ== X-Gm-Message-State: ALoCoQmhPgugLlOGzR+ecrUnqiI1qUn2JHHdDzJQQXkwZ85L2zKA+11fNsmrYrNewc87vkIbpwvd X-Received: by 10.112.53.102 with SMTP id a6mr7088738lbp.16.1431696363363; Fri, 15 May 2015 06:26:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.12 with SMTP id dc12ls173904lac.17.gmail; Fri, 15 May 2015 06:26:03 -0700 (PDT) X-Received: by 10.152.42.141 with SMTP id o13mr7216088lal.33.1431696363011; Fri, 15 May 2015 06:26:03 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id l8si1068921lah.54.2015.05.15.06.26.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2015 06:26:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lagv1 with SMTP id v1so119308072lag.3 for ; Fri, 15 May 2015 06:26:02 -0700 (PDT) X-Received: by 10.152.27.98 with SMTP id s2mr7364257lag.106.1431696362727; Fri, 15 May 2015 06:26:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2034878lbb; Fri, 15 May 2015 06:26:01 -0700 (PDT) X-Received: by 10.68.252.106 with SMTP id zr10mr18420344pbc.79.1431696360348; Fri, 15 May 2015 06:26:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13si2618399pdf.62.2015.05.15.06.25.59; Fri, 15 May 2015 06:26:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161219AbbEONZd (ORCPT + 1 other); Fri, 15 May 2015 09:25:33 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:34041 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161213AbbEONZb (ORCPT ); Fri, 15 May 2015 09:25:31 -0400 Received: by wguv19 with SMTP id v19so50842388wgu.1 for ; Fri, 15 May 2015 06:25:29 -0700 (PDT) X-Received: by 10.194.63.80 with SMTP id e16mr18680528wjs.56.1431696329769; Fri, 15 May 2015 06:25:29 -0700 (PDT) Received: from localhost ([195.238.92.128]) by mx.google.com with ESMTPSA id v3sm1830353wiz.14.2015.05.15.06.25.28 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 15 May 2015 06:25:29 -0700 (PDT) From: To: Linus Walleij , Alexandre Courbot Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Grygorii Strashko Subject: [PATCH] gpiolib: debugfs: display gpios requested as irq only Date: Fri, 15 May 2015 16:25:21 +0300 Message-Id: <1431696321-7257-1-git-send-email-grygorii.strashko@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grygorii.strashko@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Grygorii Strashko Now GPIOs, wich are requested as IRQ only, will not be displayed through GPIO debugfs. For example: # cat /proc/interrupts CPU0 CPU1 ... 209: 0 0 4805d000.gpio 11 Edge 0-0021 # cat /debug/gpio ... GPIOs 160-191, platform/4805d000.gpio, gpio: <--- no info about gpio used as IRQ only here GPIOs 192-223, platform/48051000.gpio, gpio: gpio-203 (vtt_fixed ) out hi ... Hence, improve GPIO debugfs code to show such kind of gpio and print IRQ number also. In addition, add marker "requested" for GPIOs wich were requested by using gpioX_request(). After this patch sys/kernel/debug/gpio will produce following output: # cat /debug/gpio ... GPIOs 160-191, platform/4805d000.gpio, gpio: gpio-171 ((null) ) in hi IRQ209 GPIOs 192-223, platform/48051000.gpio, gpio: gpio-203 (vtt_fixed ) out hi requested Signed-off-by: Grygorii Strashko --- drivers/gpio/gpiolib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 59eaa23..ea11706 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2259,19 +2259,23 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip) int is_irq; for (i = 0; i < chip->ngpio; i++, gpio++, gdesc++) { - if (!test_bit(FLAG_REQUESTED, &gdesc->flags)) + if (!test_bit(FLAG_REQUESTED, &gdesc->flags) && + !test_bit(FLAG_USED_AS_IRQ, &gdesc->flags)) continue; gpiod_get_direction(gdesc); is_out = test_bit(FLAG_IS_OUT, &gdesc->flags); is_irq = test_bit(FLAG_USED_AS_IRQ, &gdesc->flags); - seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s", + seq_printf(s, " gpio-%-3d (%-20.20s) %s %s", gpio, gdesc->label, is_out ? "out" : "in ", chip->get ? (chip->get(chip, i) ? "hi" : "lo") - : "? ", - is_irq ? "IRQ" : " "); + : "? "); + if (is_irq) + seq_printf(s, " IRQ%d", gpiod_to_irq(gdesc)); + if (test_bit(FLAG_REQUESTED, &gdesc->flags)) + seq_puts(s, " requested"); seq_printf(s, "\n"); } }