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: 472768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CE57314007F for ; Fri, 15 May 2015 23:25:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161219AbbEONZd (ORCPT ); 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hDV09WIwkCgQUgNuh4WrenPJ+vbqEQN0YWkksXQ+HO4=; b=VJWhhs7RJyM6iRM7j3zdizEZ2DdWERzhavj50bPRMnhpGoHmGeCd00oCl94PPyjtml GkT8LB8kwqToN7GuwYWtp6/0tckidIUTm4BK4aEx9gyGAU+DF/+zM0n9uWhfe3YA5Po+ 1WfTpv0scxXYydTGxHMg2A3nhqQy+do3fgxFpB8hFfWSoN6xyLi4n921b+MC82vFS+MZ IfTV46QbxHwpbB+Eut/SFcquoIhYTu5h7AbherEH7XL4hrOiN3zXwtLO1b+wwr737eN8 hGPJqDGgQp3FrWvvXZ+1rA8xSwoP9iro4w93NqWA6YEOW3iICjsuplnUyXnQXql63xcC 9MFQ== X-Gm-Message-State: ALoCoQnxJYzdRFwBJJ49Znky7Rqnlw+xpSkmy/bdx7jAWVC/9Rn6cv/rbw8cmUib8sODQsjB+f6y 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: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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"); } }