Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2473503lqp; Sun, 24 Mar 2024 22:18:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTcn2AcACdtHbtDIRHHX5joIZNRjX6m9tg0b3HJz4FrI2YfRaE0LD6vEX2IpUJWnDmyp02Ha35jMvtZUt1VLuM4WnrE5bKzM53KzEx+A== X-Google-Smtp-Source: AGHT+IGVVq2rgPMHzOLGbouSIIBlu5Yfg0U1RUNIBwyipO7k8UGeL7qGPxxpP8AhnbGrZC2DzujO X-Received: by 2002:a50:bae7:0:b0:56c:d35:1775 with SMTP id x94-20020a50bae7000000b0056c0d351775mr2007381ede.35.1711343931320; Sun, 24 Mar 2024 22:18:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711343931; cv=pass; d=google.com; s=arc-20160816; b=m8zjN9XL6HTTxiNSOLfZpMDaSU5rl+omXXV37TbvLPp8sq0VkoD9iHKt2zGWfKK/jo DY8lpkwmgvge/nLao/oIY9gq9+yII9DzoQNlMTEGVPC+xfZYM9mprFqH4tegL9zZY3YQ 8KsdUlTr9kef4Way2s5pUg2WmWuPzAJbySqEMkaoq+77EV9k/DtOjZTPtspWS/ok9pld 9aQ6JVtBL86Cd0KGiezCsZ2oc+1lf4jWr+y1Fn5rMyhWZ/lLYievJA+/RBrFLkF6HZoG znqL+3XZrVbrtUnKPggM7kQT7MwckeroHgcEG6fw0aHC/9F/2tJaxF0bM+OSoAYjws95 UHLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3MNqKIz5QSLwsKXLG1PthpS1F3WIA0GGcP6xyc0h5Hk=; fh=pElPEJEatKiQ0BU5mUfWqSL2Kh5FWsWzV8auHtHiWSw=; b=smcD1sWK2jJJueP4F01WzacC+/FuvrmHHkalyeg7R61XsFCd2dnBCG88N3HBAPXpTJ RJ9j/hMGQZbjAd/PJ/LA3MljGFIm1QmtYlPMey0oOry34e8ZnGPcR1Pbyg/VSIkGz/m/ MmNHtfRvSFpTRG/kB/UmMk3IcTXI47sHaTBKMIgmep6ssxkdG+hxoE3GK6Sz4V2oygOx 4iKOFklkIBmaWo8MZgvsIKtQKYLs3z4nNKf6nSpTpzx5tl0PCCb8x+A4FZJn466cgOOQ LQPtOyOUACLqcSE9smZeqGRMEFoIq6znctfXJ7d9cN5mGBRi2SrtH8iyogLAp6prF+V9 TTrw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I7AafBdZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ef6-20020a05640228c600b005657c432df5si2209987edb.16.2024.03.24.22.18.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 22:18:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I7AafBdZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 101841F319B8 for ; Mon, 25 Mar 2024 05:18:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63D5214A639; Sun, 24 Mar 2024 22:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I7AafBdZ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76DDA1D8DCE; Sun, 24 Mar 2024 22:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320754; cv=none; b=E455hct8S7q+E/7Qi3/hfWanhOMbfxTfTafESBZu/aEtRCHt/19qojQ4z96pj3XLu8ZGF9/aptK5xUd9SU5A3o3m/Xeb9Epq4fvBTdWbD8AcDlg+pdVMr8hapcw6WwzptRAkTiuQDBqP0OM9+55kftsXmf6pX6OAUcQhX4L5u/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320754; c=relaxed/simple; bh=l5VQlAyCqA+YBYutp6QsOdh0u8gIR7VkiFb2R+hyqs0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UCeBlvyxUk4pZbUQroTaMMu641ysIhNE//fcLK5kO2R+23eX0d+qOSx2XV+1J77CBEb5M6SgSNz1vzUh+6z8zXNwHA0hMG80Fe3FZzMb+KryORVo+vnOf2k9zNkv7H28AwzS4i9OPSkhi58LVEGFyiyb09cIrZJeTr7jFLIap8Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I7AafBdZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E0DBC43394; Sun, 24 Mar 2024 22:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320753; bh=l5VQlAyCqA+YBYutp6QsOdh0u8gIR7VkiFb2R+hyqs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I7AafBdZ2YHvDTchwVDfClVA17yQ5uNPZsAN6SXM2j8RHYWNpSqjh7P6b9gRer2QG j4mQkfNRFvtISBayE/sEZO1k95QIwfBYV2RhniAyBBCOd3NDBrerm+LtUiwunHYDIM v5O9KhWunFd+BuHKsdQeexfUvixoxnHCGLcixYKFB8CusXdsgDlZ0k5epCyt2VNszg eLG09YIwMuYZNOa+nyCPG0EduLwcNbDC2VqSpX5F9vUK6N0zx5wnZip96ssEsuDzv9 By5psv6t3XyPZ6IFpqBchwXu5MJkS9HGE8BeoZ/WVk2WFNr5cgkbYnRibyue1r3UAp Xa9xpA2Ve2LBg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephen Boyd , Dmitry Torokhov , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.7 317/713] gpiolib: Pass consumer device through to core in devm_fwnode_gpiod_get_index() Date: Sun, 24 Mar 2024 18:40:43 -0400 Message-ID: <20240324224720.1345309-318-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324224720.1345309-1-sashal@kernel.org> References: <20240324224720.1345309-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Stephen Boyd [ Upstream commit 0d776cfd5e5b559fdf2e38285c2aea4b7048acbd ] This devm API takes a consumer device as an argument to setup the devm action, but throws it away when calling further into gpiolib. This leads to odd debug messages like this: (NULL device *): using DT '/gpio-keys/switch-pen-insert' for '(null)' GPIO lookup Let's pass the consumer device down, by directly calling what fwnode_gpiod_get_index() calls but pass the device used for devm. This changes the message to look like this instead: gpio-keys gpio-keys: using DT '/gpio-keys/switch-pen-insert' for '(null)' GPIO lookup Note that callers of fwnode_gpiod_get_index() will still see the NULL device pointer debug message, but there's not much we can do about that because the API doesn't take a struct device. Cc: Dmitry Torokhov Fixes: 8eb1f71e7acc ("gpiolib: consolidate GPIO lookups") Signed-off-by: Stephen Boyd Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib-devres.c | 2 +- drivers/gpio/gpiolib.c | 14 +++++++------- drivers/gpio/gpiolib.h | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c index fe9ce6b19f15c..4987e62dcb3d1 100644 --- a/drivers/gpio/gpiolib-devres.c +++ b/drivers/gpio/gpiolib-devres.c @@ -158,7 +158,7 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, if (!dr) return ERR_PTR(-ENOMEM); - desc = fwnode_gpiod_get_index(fwnode, con_id, index, flags, label); + desc = gpiod_find_and_request(dev, fwnode, con_id, index, flags, label, false); if (IS_ERR(desc)) { devres_free(dr); return desc; diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 1d033106cf396..2d8c07a442227 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4127,13 +4127,13 @@ static struct gpio_desc *gpiod_find_by_fwnode(struct fwnode_handle *fwnode, return desc; } -static struct gpio_desc *gpiod_find_and_request(struct device *consumer, - struct fwnode_handle *fwnode, - const char *con_id, - unsigned int idx, - enum gpiod_flags flags, - const char *label, - bool platform_lookup_allowed) +struct gpio_desc *gpiod_find_and_request(struct device *consumer, + struct fwnode_handle *fwnode, + const char *con_id, + unsigned int idx, + enum gpiod_flags flags, + const char *label, + bool platform_lookup_allowed) { unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT; struct gpio_desc *desc; diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 3ccacf3c1288e..87ec7ba5b6b38 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -207,6 +207,14 @@ static inline int gpiod_request_user(struct gpio_desc *desc, const char *label) return ret; } +struct gpio_desc *gpiod_find_and_request(struct device *consumer, + struct fwnode_handle *fwnode, + const char *con_id, + unsigned int idx, + enum gpiod_flags flags, + const char *label, + bool platform_lookup_allowed); + int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, unsigned long lflags, enum gpiod_flags dflags); int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce); -- 2.43.0