Message ID | 20230311111610.251774-1-krzysztof.kozlowski@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp234199wrd; Sat, 11 Mar 2023 03:21:10 -0800 (PST) X-Google-Smtp-Source: AK7set/BgN/4Go2pTdubYPxSlXHQo5NQ2CQpPcATv3/s0BZhnVCNxeDYtEgqEXAQGTQgeQG3PJgO X-Received: by 2002:a05:6a20:7f9c:b0:cc:aa7b:84e1 with SMTP id d28-20020a056a207f9c00b000ccaa7b84e1mr38407978pzj.21.1678533670502; Sat, 11 Mar 2023 03:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678533670; cv=none; d=google.com; s=arc-20160816; b=qXuVu7jG7EyJqT5wnYJCNPvZP4WPJUVM8lNEJ/iKahMjTfFOChd//Hi3qIZiB7xpd8 xCA7nhWYUImL+8GpNrfYe2E1OzD377U/RE64MYN5kg+CwAv14i9sH1wFy8JzRszd0Tv4 hxrnDKj7ZUWwIBET8M8eCAySnXczRsLmVpIzZoNGmE5HgV5suTjDM52UJe3FkCN+Tuor CKdnayqfT2OkRFFZNlqSN4XsZv+YrHq4M4zuJ8PVAQHsdllrXZ3sefv+CK2kOipYEy1J qqZzNTPgcvYDk8xLcvQb1V0JwzgKeITPy7eOjaq3dAr9O8bOQ2K7uZDO6s2zf/Qf732A fECw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OCzg8SfNWOR6ZGwqRQLrQy1Mo0FTE4MlBOnbJtRBfZ4=; b=k94aIqIUjmgns7uefOtc1jrBbm44hQiEmFtSkDzNjtGvRVwn9RtRQ8pmo5c2zGAW6B pYxI5uvC+skEkCZnb+alvqpgGI+ceXd/caNuauMi6YdrxTzp8bipcUprgwY9kMloGBDU k1ZqKlOzI8vgm+0bG/Bjy5L9MdG9uHk/nVbDArjVJ10Cgy5/FLoqRFkEEXPjLfy70Tqj fHEXNjnMcGtmdnQUukSGmVn975FGJdT2PxrIXZK/5nnFL9QpoyhYt+EppSF3OFXfy83M TAQrh6NlLfT5xf5pMeAlsCk9KaFonNpbNUYvb9lORVT/oNNG0IBfHTB+YA+/Jda87hEQ cqjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x6ny6ewh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q134-20020a632a8c000000b00502e3a1e8bdsi2021504pgq.280.2023.03.11.03.20.54; Sat, 11 Mar 2023 03:21:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x6ny6ewh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229948AbjCKLS2 (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Sat, 11 Mar 2023 06:18:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230052AbjCKLR0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 11 Mar 2023 06:17:26 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93B0D13F6AF for <linux-kernel@vger.kernel.org>; Sat, 11 Mar 2023 03:16:26 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id cy23so30636421edb.12 for <linux-kernel@vger.kernel.org>; Sat, 11 Mar 2023 03:16:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678533373; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OCzg8SfNWOR6ZGwqRQLrQy1Mo0FTE4MlBOnbJtRBfZ4=; b=x6ny6ewhdLvAMEqWw/3v72kyLaxkOEQQMYQmghS2Psgll1Kl6XAJkbVe7IVZPOjRQ/ Lz19EHwiTGVBsfi94BuHFfz+ITLVvmLB/R4E+rcM9UEvXuPZo1cDnpmuQ89F9w68mVsg jz+hHWlyHpmFzs4utE+du/L35nyBCVtkBHAgqrna5CADgVdD6RI0KmqUuT67/dfwqUlA xJkNduPizZaltQC3JRZtvS05az6SpWXuk/M/kfUQnOjd4E2OcZKO23x+Y7ucRZ3mKmcM hO4wBI3KXesk2mGPJoUKDBaNN7hPlXnByOVo5dpEjuOqzqtNmR1U5Zyqm+u536bHkG0Z jkMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678533373; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OCzg8SfNWOR6ZGwqRQLrQy1Mo0FTE4MlBOnbJtRBfZ4=; b=E0kSnpoMuZDCsMCrVmuNZ4dlL6QoEyBheQkme0wvM0YTDq7ATE+8BlkT6Q6BR1nnZE snY4JhD+h8iNaCNX56pbg/bvJ5Y4SttXEKHss+Fht3IgvNl1f5RTPK+ErJ8A0oA1L/KR i0NTpTWAPd+QdMxYAybrTXEBr4B8qUgTWYXAErGxP/8hZ8x6igTuIxiBvav6Dmg4ZqUh YvkwG2DSDX4sJOQuTBMYa9W8aK3T7FOj1p3UcOEJfl3xBdM5iNRG54GMu8WTMvrjpKEU WDqCZ99qmtdzNG8LGs1dWju4ZNk22MZUV9ygW2I/qvwNKgL6hnvJmyLR+BZ/toprlZgS DmHQ== X-Gm-Message-State: AO0yUKUti1MZeXghEMyXFFNw34LBedDuSY6hsbco6+8fDKFFtcyngABF fY2R4iOvtGG7ZsJwy59BHsKHZN3dKsY/4fEXnUA= X-Received: by 2002:aa7:d149:0:b0:4fa:dad6:4b63 with SMTP id r9-20020aa7d149000000b004fadad64b63mr573298edo.37.1678533373699; Sat, 11 Mar 2023 03:16:13 -0800 (PST) Received: from krzk-bin.. ([2a02:810d:15c0:828:fa97:2d7c:bdd7:e1b]) by smtp.gmail.com with ESMTPSA id a20-20020a1709065f9400b008be0b7242d5sm994267eju.90.2023.03.11.03.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Mar 2023 03:16:13 -0800 (PST) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>, Eric Tremblay <etremblay@distech-controls.com>, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Subject: [PATCH 1/2] hwmon: gpio-fan: mark OF related data as maybe unused Date: Sat, 11 Mar 2023 12:16:09 +0100 Message-Id: <20230311111610.251774-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760070122029739844?= X-GMAIL-MSGID: =?utf-8?q?1760070122029739844?= |
Series |
[1/2] hwmon: gpio-fan: mark OF related data as maybe unused
|
|
Commit Message
Krzysztof Kozlowski
March 11, 2023, 11:16 a.m. UTC
The driver can be compile tested with !CONFIG_OF making certain data
unused:
drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/hwmon/gpio-fan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Sat, Mar 11, 2023 at 12:16:09PM +0100, Krzysztof Kozlowski wrote: > The driver can be compile tested with !CONFIG_OF making certain data > unused: > > drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=] > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Applied. Thanks, Guenter > --- > drivers/hwmon/gpio-fan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c > index e75db6f64e8c..be7f06fb7f78 100644 > --- a/drivers/hwmon/gpio-fan.c > +++ b/drivers/hwmon/gpio-fan.c > @@ -481,7 +481,7 @@ static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data) > return 0; > } > > -static const struct of_device_id of_gpio_fan_match[] = { > +static const struct of_device_id of_gpio_fan_match[] __maybe_unused = { > { .compatible = "gpio-fan", }, > {}, > };
On Sat, Mar 11, 2023 at 12:16:09PM +0100, Krzysztof Kozlowski wrote: > The driver can be compile tested with !CONFIG_OF making certain data > unused: > > drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=] > How do you trigger that ? The driver depends on OF_GPIO which in turn depends on OF. Arguably that means that of_match_ptr() doesnot really make sense, but still I don't see how you can trigger the above error message. Thanks, Guenter > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > --- > drivers/hwmon/gpio-fan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c > index e75db6f64e8c..be7f06fb7f78 100644 > --- a/drivers/hwmon/gpio-fan.c > +++ b/drivers/hwmon/gpio-fan.c > @@ -481,7 +481,7 @@ static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data) > return 0; > } > > -static const struct of_device_id of_gpio_fan_match[] = { > +static const struct of_device_id of_gpio_fan_match[] __maybe_unused = { > { .compatible = "gpio-fan", }, > {}, > };
On 12/03/2023 19:06, Guenter Roeck wrote: > On Sat, Mar 11, 2023 at 12:16:09PM +0100, Krzysztof Kozlowski wrote: >> The driver can be compile tested with !CONFIG_OF making certain data >> unused: >> >> drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=] >> > > How do you trigger that ? The driver depends on OF_GPIO which > in turn depends on OF. Arguably that means that of_match_ptr() > doesnot really make sense, but still I don't see how you can > trigger the above error message. I can drop of_match_ptr, it's indeed in many cases not needed. I just build x86_64 allyesconfig minus OF, with W=1. Do you want to me to drop of_match_ptr? Best regards, Krzysztof
On 3/12/23 11:08, Krzysztof Kozlowski wrote: > On 12/03/2023 19:06, Guenter Roeck wrote: >> On Sat, Mar 11, 2023 at 12:16:09PM +0100, Krzysztof Kozlowski wrote: >>> The driver can be compile tested with !CONFIG_OF making certain data >>> unused: >>> >>> drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=] >>> >> >> How do you trigger that ? The driver depends on OF_GPIO which >> in turn depends on OF. Arguably that means that of_match_ptr() >> doesnot really make sense, but still I don't see how you can >> trigger the above error message. > > I can drop of_match_ptr, it's indeed in many cases not needed. > > I just build x86_64 allyesconfig minus OF, with W=1. > x86_64 allyesconfig minus OF minus results in SENSORS_GPIO_FAN being deselected (it doesn't show up in the configuration anymore at all after "make olddefconfig"). $ make allyesconfig $ grep SENSORS_GPIO_FAN .config CONFIG_SENSORS_GPIO_FAN=y $ sed -i -e 's/CONFIG_OF=y/# CONFIG_OF is not set/' .config $ make olddefconfig # # configuration written to .config # $ grep SENSORS_GPIO_FAN .config $ I suspect what you did is to disable CONFIG_OF, and then you built the driver without realizing that is was deselected. > Do you want to me to drop of_match_ptr? > Yes, sure, that makes more sense. The reason though is that the driver depends on CONFIG_OF=y, not because of the build failure. Thanks, Guenter
On 12/03/2023 19:48, Guenter Roeck wrote: > On 3/12/23 11:08, Krzysztof Kozlowski wrote: >> On 12/03/2023 19:06, Guenter Roeck wrote: >>> On Sat, Mar 11, 2023 at 12:16:09PM +0100, Krzysztof Kozlowski wrote: >>>> The driver can be compile tested with !CONFIG_OF making certain data >>>> unused: >>>> >>>> drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=] >>>> >>> >>> How do you trigger that ? The driver depends on OF_GPIO which >>> in turn depends on OF. Arguably that means that of_match_ptr() >>> doesnot really make sense, but still I don't see how you can >>> trigger the above error message. >> >> I can drop of_match_ptr, it's indeed in many cases not needed. >> >> I just build x86_64 allyesconfig minus OF, with W=1. >> > > x86_64 allyesconfig minus OF minus results in SENSORS_GPIO_FAN being > deselected (it doesn't show up in the configuration anymore at all > after "make olddefconfig"). > > $ make allyesconfig > $ grep SENSORS_GPIO_FAN .config > CONFIG_SENSORS_GPIO_FAN=y > $ sed -i -e 's/CONFIG_OF=y/# CONFIG_OF is not set/' .config > $ make olddefconfig > # > # configuration written to .config > # > $ grep SENSORS_GPIO_FAN .config > $ > > I suspect what you did is to disable CONFIG_OF, and then you built > the driver without realizing that is was deselected. The driver would not built. I mean, I did not cheat here to built it with incorrect config. I rather suspect that config is broken due to: WARNING: unmet direct dependencies detected for OF_GPIO WARNING: unmet direct dependencies detected for GPIO_SYSCON WARNING: unmet direct dependencies detected for MFD_STMFX This was next-20230308 > >> Do you want to me to drop of_match_ptr? >> > > Yes, sure, that makes more sense. The reason though is that the > driver depends on CONFIG_OF=y, not because of the build failure. I'll send v2 of both patches because anyway dropping of_match_ptr is preferred. Best regards, Krzysztof
On 3/12/23 12:32, Krzysztof Kozlowski wrote: > On 12/03/2023 19:48, Guenter Roeck wrote: >> On 3/12/23 11:08, Krzysztof Kozlowski wrote: >>> On 12/03/2023 19:06, Guenter Roeck wrote: >>>> On Sat, Mar 11, 2023 at 12:16:09PM +0100, Krzysztof Kozlowski wrote: >>>>> The driver can be compile tested with !CONFIG_OF making certain data >>>>> unused: >>>>> >>>>> drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=] >>>>> >>>> >>>> How do you trigger that ? The driver depends on OF_GPIO which >>>> in turn depends on OF. Arguably that means that of_match_ptr() >>>> doesnot really make sense, but still I don't see how you can >>>> trigger the above error message. >>> >>> I can drop of_match_ptr, it's indeed in many cases not needed. >>> >>> I just build x86_64 allyesconfig minus OF, with W=1. >>> >> >> x86_64 allyesconfig minus OF minus results in SENSORS_GPIO_FAN being >> deselected (it doesn't show up in the configuration anymore at all >> after "make olddefconfig"). >> >> $ make allyesconfig >> $ grep SENSORS_GPIO_FAN .config >> CONFIG_SENSORS_GPIO_FAN=y >> $ sed -i -e 's/CONFIG_OF=y/# CONFIG_OF is not set/' .config >> $ make olddefconfig >> # >> # configuration written to .config >> # >> $ grep SENSORS_GPIO_FAN .config >> $ >> >> I suspect what you did is to disable CONFIG_OF, and then you built >> the driver without realizing that is was deselected. > > The driver would not built. I mean, I did not cheat here to built it > with incorrect config. > > I rather suspect that config is broken due to: > WARNING: unmet direct dependencies detected for OF_GPIO > WARNING: unmet direct dependencies detected for GPIO_SYSCON > WARNING: unmet direct dependencies detected for MFD_STMFX > > This was next-20230308 > Interesting. That has been fixed in next-20230310, where SENSORS_GPIO_FAN is again deselected if CONFIG_OF is disabled. >> >>> Do you want to me to drop of_match_ptr? >>> >> >> Yes, sure, that makes more sense. The reason though is that the >> driver depends on CONFIG_OF=y, not because of the build failure. > > I'll send v2 of both patches because anyway dropping of_match_ptr is > preferred. > Ok. Thanks, Guenter
On 12/03/2023 22:03, Guenter Roeck wrote: >> >> The driver would not built. I mean, I did not cheat here to built it >> with incorrect config. >> >> I rather suspect that config is broken due to: >> WARNING: unmet direct dependencies detected for OF_GPIO >> WARNING: unmet direct dependencies detected for GPIO_SYSCON >> WARNING: unmet direct dependencies detected for MFD_STMFX >> >> This was next-20230308 >> > Interesting. That has been fixed in next-20230310, where > SENSORS_GPIO_FAN is again deselected if CONFIG_OF is disabled. Nice, I picked by coincidence lucky base :) Best regards, Krzysztof
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index e75db6f64e8c..be7f06fb7f78 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -481,7 +481,7 @@ static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data) return 0; } -static const struct of_device_id of_gpio_fan_match[] = { +static const struct of_device_id of_gpio_fan_match[] __maybe_unused = { { .compatible = "gpio-fan", }, {}, };