From patchwork Wed Aug 14 19:02:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 19156 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 70FF8246B8 for ; Wed, 14 Aug 2013 19:02:55 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id gf11sf7668895vcb.2 for ; Wed, 14 Aug 2013 12:02:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=LaqG7Ha0dWjJgshvnT0Im8jMJV8k4TVYomLYFkTb834=; b=p0l8byH5tQ9usJsJfzy6qNZKsUPuWSAQyOYSI6fpPOsdkLgfjJdn06gfRDq4fbbI8k Yp5c0R+0FqgahctDoGDE6uEo1mF4ZFq4skJUb85HQWT2YzCe4cH7+p3u8Mt5kzanh98h X6i8eDVkiLghXWsJ9qPSqVsWYA6kBz39NBgzfbTwI1AY7DtUcZkcHtOFmCzzB/dcM11W DITeQRTLAOICpCcYkdsn4YFyUTayw9zhf1m8mF3A2y3o06HBvA/dGkTSqbd+sgYaZfMQ raNCVJcSfdf8tjQmeDsL7L3SM8omMO1dCbhB9x6Kf/R9XnYSFCvos5EUCSIvN6Mslzv9 cJRQ== X-Received: by 10.58.18.180 with SMTP id x20mr2785979ved.38.1376506974661; Wed, 14 Aug 2013 12:02:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.195 with SMTP id lm3ls278qeb.89.gmail; Wed, 14 Aug 2013 12:02:54 -0700 (PDT) X-Received: by 10.52.240.145 with SMTP id wa17mr1388692vdc.40.1376506974506; Wed, 14 Aug 2013 12:02:54 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id ix2si11469493vdb.111.2013.08.14.12.02.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 12:02:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id oz10so8077823veb.17 for ; Wed, 14 Aug 2013 12:02:54 -0700 (PDT) X-Gm-Message-State: ALoCoQlvbeT8AzuJL+yEupc7vr4Q1G0OdtSzRybPM1fyhFqvOuawG/xsG/7UEimdRcWQGR1GdGEv X-Received: by 10.58.6.210 with SMTP id d18mr80457vea.96.1376506974382; Wed, 14 Aug 2013 12:02:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp229486vcz; Wed, 14 Aug 2013 12:02:53 -0700 (PDT) X-Received: by 10.152.22.65 with SMTP id b1mr60947laf.46.1376506973013; Wed, 14 Aug 2013 12:02:53 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com [209.85.217.176]) by mx.google.com with ESMTPS id nw5si20856069lbb.146.2013.08.14.12.02.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 12:02:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.176 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id w10so7026092lbi.7 for ; Wed, 14 Aug 2013 12:02:52 -0700 (PDT) X-Received: by 10.152.6.97 with SMTP id z1mr9746048laz.26.1376506972181; Wed, 14 Aug 2013 12:02:52 -0700 (PDT) Received: from localhost.localdomain (c83-249-208-76.bredband.comhem.se. [83.249.208.76]) by mx.google.com with ESMTPSA id ay4sm1478136lbb.2.2013.08.14.12.02.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 14 Aug 2013 12:02:51 -0700 (PDT) From: Linus Walleij To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Stephen Warren , Linus Walleij , Sonic Zhang Subject: [PATCH v2] pinctrl: improve warning messages Date: Wed, 14 Aug 2013 21:02:46 +0200 Message-Id: <1376506966-11623-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Print out the affected group name on activation of pin mux settings, and warn if you cannot free a pin that should have been part of a certain setting. ChangeLog v1->v2: - Also print the pin name in the error messages. Cc: Sonic Zhang Signed-off-by: Linus Walleij --- drivers/pinctrl/pinmux.c | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 5f51588..9d144a2 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -400,10 +400,14 @@ int pinmux_enable_setting(struct pinctrl_setting const *setting) ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, &pins, &num_pins); if (ret) { + const char *gname; + /* errors only affect debug data, so just warn */ + gname = pctlops->get_group_name(pctldev, + setting->data.mux.group); dev_warn(pctldev->dev, - "could not get pins for group selector %d\n", - setting->data.mux.group); + "could not get pins for group %s\n", + gname); num_pins = 0; } @@ -411,9 +415,18 @@ int pinmux_enable_setting(struct pinctrl_setting const *setting) for (i = 0; i < num_pins; i++) { ret = pin_request(pctldev, pins[i], setting->dev_name, NULL); if (ret) { + const char *gname; + const char *pname; + + desc = pin_desc_get(pctldev, pins[i]); + pname = desc ? desc->name : "non-existing"; + gname = pctlops->get_group_name(pctldev, + setting->data.mux.group); dev_err(pctldev->dev, - "could not request pin %d on device %s\n", - pins[i], pinctrl_dev_get_name(pctldev)); + "could not request pin %d (%s) from group %s " + " on device %s\n", + pins[i], pname, gname, + pinctrl_dev_get_name(pctldev)); goto err_pin_request; } } @@ -466,10 +479,14 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting) ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, &pins, &num_pins); if (ret) { + const char *gname; + /* errors only affect debug data, so just warn */ + gname = pctlops->get_group_name(pctldev, + setting->data.mux.group); dev_warn(pctldev->dev, - "could not get pins for group selector %d\n", - setting->data.mux.group); + "could not get pins for group %s\n", + gname); num_pins = 0; } @@ -486,6 +503,18 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting) desc->mux_setting = NULL; /* And release the pin */ pin_free(pctldev, pins[i], NULL); + } else { + const char *gname; + const char *pname; + + pname = desc ? desc->name : "non-existing"; + gname = pctlops->get_group_name(pctldev, + setting->data.mux.group); + dev_warn(pctldev->dev, + "not freeing pin %d (%s) as part of " + "deactivating group %s - it is already " + "used for some other setting", + pins[i], pname, gname); } }