From patchwork Thu Jan 4 21:40:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 123457 Delivered-To: patch@linaro.org Received: by 10.80.135.92 with SMTP id 28csp83788edv; Thu, 4 Jan 2018 13:42:31 -0800 (PST) X-Google-Smtp-Source: ACJfBou521VssI9DFyBYE5d1K91SDu01gnyIPK580rf+vB9ew67Wklwjnpu3qm5CrFHkhimsrShU X-Received: by 10.101.82.2 with SMTP id o2mr721088pgp.15.1515102151438; Thu, 04 Jan 2018 13:42:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515102151; cv=none; d=google.com; s=arc-20160816; b=Sa56oUghJDQPomPw+wJtZmq7D250Bp30LQ0hUT/r4pZcw1I9vjM0e2v0yiRbVKeQlq J26lwYxUtDlr0xN3+lwdhIzx2ti7B1qv8+pjrrpVTInKFmGiruFZ8dk8wMQ0X1MtpZkk GfpMonwr54GvhW5dfoLjwvS3O+RzUN2mjYkZDVv23rz67C5KwpQtFmZBYW9R2lV0IAx+ g50c6V9lheJGsLV9r/uFIqpRKQMzs1cQsJG5yMdRMGzgR7uDomJu1JCJcmsE7eQK2yb/ RuOqQTYahgl67Mqx/emdgRw5jAkR6nTl51F3ZLGqB+y2KJScpZ/HmJGJxdcdIoh6F6j2 BQkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Fvhfumd9ObJir52WcKwsbselXVyPA6zvXXAFhOHOOcc=; b=I635MqChuGYjvH0tcic6kVKIaNywf7ll/pBETsfmd3J2geq5/QswLA+4LDGzAFlkzP erc4nI3yOixKw3QLFKLxp1XZjnl6Hzs1luUzZHhbx8TFkn8KQvpRUaEeiOFmpzlmkB68 AdBq0Zpcz0V8KZpzO7towZUbtZZca8tBCs+5sbSOq7npuhEDPAHemj2AQN2ber1j76j6 oM2YQ8jmCxMZkoUtcsL8TbwH7BybIXML156uCgh3cgAZW4NV5J+HPhE48w035JYZUX/5 WdnLwkOtR55jY0UCAH5UmRgAxXqY9g4UKet7lT9PkK9EWHaoQz68LVMwQAfR/1Jytm35 0rUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ebos70Q9; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g207si2919198pfb.190.2018.01.04.13.42.30; Thu, 04 Jan 2018 13:42:31 -0800 (PST) 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; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ebos70Q9; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752690AbeADVma (ORCPT + 6 others); Thu, 4 Jan 2018 16:42:30 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34234 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751829AbeADVm3 (ORCPT ); Thu, 4 Jan 2018 16:42:29 -0500 Received: by mail-lf0-f68.google.com with SMTP id h140so3213165lfg.1 for ; Thu, 04 Jan 2018 13:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=XNks10VKHR3jweFAJcAi3Ago9fFu5i8z/0Di7WecX6E=; b=ebos70Q96US8mPZroVUjGEOv0O88wS93SdEUII1dPTe0JBxdjuuf5UBJHdNNgHsTqX 50xh+dq4QVfyW/0s1GrUgSyhVTvX85WXlaEuYxG0GaLLMGyFER0cnQykD/RvXDkYr2h1 rbitlsYtfPU9Uo+1mlOHhe5jnCQ78r8L5Hpfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XNks10VKHR3jweFAJcAi3Ago9fFu5i8z/0Di7WecX6E=; b=sBN58QiX6jeypmHsYzasC26CMCvJO/KSkoVLAWKNxD1jiVHy9RzFvzjb2ZORPnqBdl HBzX0MoImRBMyixfKIzaWmLpMMMFkN5w7uzL9ppxW56RtV18IiczExdPI6STES7YzobE V8zA82/oQDXgw/l8GNHZNUkORn8XGAxeLFcNzpkVufzo4XXIpbqqSroe1dzvMfEJNRNL aNNmjKZ3zqH4MMFsSPs4i9o4fzJSmiNfzYTfIfB9XSz57rYJ8bxerznb1T5R+M+4H5WV Epjzdt5Dw34YHIhjBBTlJtUkDlCWr+/szT6sgymRl2GrWgQQenWJnVztdg+HJFh5zZc1 qR9w== X-Gm-Message-State: AKwxyteBF/RYV5nu18LtBBQSHIPGL1gPI/pGh6YCjWhAvtmWiR+LSP5s Q+yB6nlI4s0RCjpVpvBLYMD7PAnc7zs= X-Received: by 10.46.83.74 with SMTP id t10mr474824ljd.127.1515102148226; Thu, 04 Jan 2018 13:42:28 -0800 (PST) Received: from localhost.localdomain (c-cb7471d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.116.203]) by smtp.gmail.com with ESMTPSA id q24sm784532lja.9.2018.01.04.13.42.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jan 2018 13:42:27 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , "Reported-by : Jason Kridner" Subject: [PATCH] gpio: label descriptors using the device name Date: Thu, 4 Jan 2018 22:40:23 +0100 Message-Id: <20180104214023.17400-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Some GPIO lines appear named "?" in the lsgpio dump due to their requesting drivers not passing a reasonable label. Most typically this happens if a device tree node just defines gpios = <...> and not foo-gpios = <...>, the former gets named "foo" and the latter gets named "?". However the struct device passed in is always valid so let's just label the GPIO with dev_name() on the device if no proper label was passed. Cc: Reported-by: Jason Kridner Reported-by: Jason Kridner Signed-off-by: Linus Walleij --- Jason: would be great if you can test this and check if it gives you reasonable consumer names. --- drivers/gpio/gpiolib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 7dde703b6da2..986293143068 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -3650,7 +3650,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, return desc; } - status = gpiod_request(desc, con_id); + /* If a connection label was passed use that, else use the device name as label */ + status = gpiod_request(desc, con_id ? con_id : dev_name(dev)); if (status < 0) return ERR_PTR(status);