Message ID | 20230311111457.251475-2-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 v21csp237343wrd; Sat, 11 Mar 2023 03:31:03 -0800 (PST) X-Google-Smtp-Source: AK7set/4HdlyoZlwIfdogWL7p6AdYwm3TwniW5oi/V/kkCKxUptwm7Cwrp9EgbhT+q7jTGjOKu40 X-Received: by 2002:a17:902:d2d0:b0:19e:65db:7ac3 with SMTP id n16-20020a170902d2d000b0019e65db7ac3mr36085424plc.68.1678534262782; Sat, 11 Mar 2023 03:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678534262; cv=none; d=google.com; s=arc-20160816; b=eokSw3ji9asYOjnjDMnoX7mRr2nrivL63B1HOhy95WCITVHF5UREe180R50RLWpa5x 16GJHIXxWyh2XEZ5t2ETRjFHY/sLDIZtKdine3pAx42u2XHH8DTcAEuOC88DjER1KE/Q m/JyAbL0cVFKJcKwat+/yMyziEKc+zAku5tCzu6zXUD5qf81r5WiRiVr4GmDaySFpxWV +eQg0T19nHd+YmaSKK86FHtcjBrXSBAe+1IX6dtyr9GNInSd05s5iBWq20hBnN0p5D+d OX91Mi0gcM5+C7fpW0EdHxWnZ3VemCsfP6stbJSDUjWeyJSWGR221BnWWXBiHfKBtvCg z0Iw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TWDnMi7QDZcdU4X1J04rb9K92AwZUFTrHqFetObZuyA=; b=Iecsd7ASSS5y7ayD0Mo3XQl08IuY6/K7BYSrlssGAFXxkiDgV3POx7daGk0vGHlXWv RvDdm48cq9cS415FDmzSSr+blusiEuxNbmmDF4P1wtjhCjpH4msCy/g6tVr1UhZah4kO RU3LGdhXrL5Gujc09IzoRjckRlcTCO2J66Vv5IonPsdAPzm4L/7U25t26AQjLeYmjVX2 KqHyB2U9KOB4AAQxwEX0hV+o1x2EtrjMOLR5xAZG0F9kFZz+8UrLA/RKuGlOcTDLM8AB 0Wd+KGPhduqrKIYCGrClWkSVl/OTQbAazY8HKZohsd1RpbhTUrt59Av1zOlMrrpjOlI8 Ns2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FPB6LP9q; 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 p5-20020a170902780500b0019f0e7990e8si2066691pll.197.2023.03.11.03.30.50; Sat, 11 Mar 2023 03:31:02 -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=FPB6LP9q; 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 S230063AbjCKLR0 (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Sat, 11 Mar 2023 06:17:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbjCKLQh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 11 Mar 2023 06:16:37 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A4E1B421E for <linux-kernel@vger.kernel.org>; Sat, 11 Mar 2023 03:15:28 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id x3so30662047edb.10 for <linux-kernel@vger.kernel.org>; Sat, 11 Mar 2023 03:15:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678533302; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TWDnMi7QDZcdU4X1J04rb9K92AwZUFTrHqFetObZuyA=; b=FPB6LP9qGChtUK7gsfHHUoQz9aOtglbfyIbyXKjx+q88Uc7gEE//joK7NgZoHsVQId Q3SW4vnMZ7Mi7REyHsmktqkrH4LfkEJOSOih3tcOOiRlQWr7oi3m3aPv+dSNJa+6OKg5 PS1sfqnBPBvFHObJy+cLm2EkysAX+jQQozk7oM1uahf4fg0le3hH4AshRYN16o3RTX2Z ops6O9KHRmxXB9sLZZXBeZye9/NVgqoQEhJdYWc3gbO/U7xpju7CSlCG5u5fvzPXCgFI MPgSb/RwDWBY8OHc2kNbtoEEA9/Fj+SWIIojRJVBKNqRGtO5isIsFnV7KCTV8c6uHvDj 9JAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678533302; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TWDnMi7QDZcdU4X1J04rb9K92AwZUFTrHqFetObZuyA=; b=FTvGIjHGBLYWUK5XCCpXpAauYshcuonXspOeVfjIWq6H3b1gC9Xt52NPgeLiU8UIy5 i0+A2gCxbDn/JnqQqOZTDEE7i1G0f9w5imEMCQLiGsAV0Qg8KAAr7DjILp5+SJ6g35Cf zFi0hlDHJB4WR8SbQGhoXPwjcHXYLO84BL6oriF8lbN+FzVMv/w++moZzeD91LYZaykP jD67v3wdipdYM02aJIrUPAehhuK+GfZ2RqhrpK9r7q7mE+lzz+tTHse8/N8LNQe4Wlmu k8666sCsmW2hH3ocHTOBXCJVqedl3ws9m+KzbG21xDYrLLXlDSAFpWnaWDsnTxG9fzMV EGNA== X-Gm-Message-State: AO0yUKVsO78Po8EEuruPWMkwAZUsxbdwlrNChPlqLMlSRsDNRRo/rLwI LbIJAtOS8G4QmzTbsOfZnRIHHg== X-Received: by 2002:a17:907:86a5:b0:8b1:7fe9:ac69 with SMTP id qa37-20020a17090786a500b008b17fe9ac69mr37804712ejc.75.1678533302588; Sat, 11 Mar 2023 03:15:02 -0800 (PST) Received: from krzk-bin.. ([2a02:810d:15c0:828:fa97:2d7c:bdd7:e1b]) by smtp.gmail.com with ESMTPSA id lc22-20020a170906dff600b00922b009fc79sm223427ejc.164.2023.03.11.03.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Mar 2023 03:15:02 -0800 (PST) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: Marek Vasut <marek.vasut@gmail.com>, Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Michael Hennerich <Michael.Hennerich@analog.com>, Robert Eshleman <bobbyeshleman@gmail.com>, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Subject: [PATCH 2/4] iio: dac: ad5755: mark OF related data as maybe unused Date: Sat, 11 Mar 2023 12:14:55 +0100 Message-Id: <20230311111457.251475-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230311111457.251475-1-krzysztof.kozlowski@linaro.org> References: <20230311111457.251475-1-krzysztof.kozlowski@linaro.org> 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=ham 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?1760070742661221446?= X-GMAIL-MSGID: =?utf-8?q?1760070742661221446?= |
Series |
[1/4] iio: adc: rcar-gyroadc: mark OF related data as maybe unused
|
|
Commit Message
Krzysztof Kozlowski
March 11, 2023, 11:14 a.m. UTC
The driver can be compile tested with !CONFIG_OF making certain data
unused (of_device_id is not used for device matching):
drivers/iio/dac/ad5755.c:865:34: error: ‘ad5755_of_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/iio/dac/ad5755.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Sat, 11 Mar 2023 12:14:55 +0100 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > The driver can be compile tested with !CONFIG_OF making certain data > unused (of_device_id is not used for device matching): It should be used for device matching I think, so I'd rather see it assigned for that purpose than hiding the issue. > > drivers/iio/dac/ad5755.c:865:34: error: ‘ad5755_of_match’ defined but not used [-Werror=unused-const-variable=] > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > --- > drivers/iio/dac/ad5755.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c > index beadfa938d2d..a6dc8a0bfc29 100644 > --- a/drivers/iio/dac/ad5755.c > +++ b/drivers/iio/dac/ad5755.c > @@ -862,7 +862,7 @@ static const struct spi_device_id ad5755_id[] = { > }; > MODULE_DEVICE_TABLE(spi, ad5755_id); > > -static const struct of_device_id ad5755_of_match[] = { > +static const struct of_device_id ad5755_of_match[] __maybe_unused = { > { .compatible = "adi,ad5755" }, > { .compatible = "adi,ad5755-1" }, > { .compatible = "adi,ad5757" },
On 11/03/2023 13:22, Jonathan Cameron wrote: > On Sat, 11 Mar 2023 12:14:55 +0100 > Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > >> The driver can be compile tested with !CONFIG_OF making certain data >> unused (of_device_id is not used for device matching): > > It should be used for device matching I think, so I'd rather see > it assigned for that purpose than hiding the issue. That would require testing and changes. The device matching is via SPI table which has device data. Probably adding OF matching would require bigger changes to for handling the match data. This was intentional design in this driver, so we are not hiding here anything. > > >> >> drivers/iio/dac/ad5755.c:865:34: error: ‘ad5755_of_match’ defined but not used [-Werror=unused-const-variable=] > Best regards, Krzysztof
On Sat, 11 Mar 2023 13:25:33 +0100 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > On 11/03/2023 13:22, Jonathan Cameron wrote: > > On Sat, 11 Mar 2023 12:14:55 +0100 > > Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > > >> The driver can be compile tested with !CONFIG_OF making certain data > >> unused (of_device_id is not used for device matching): > > > > It should be used for device matching I think, so I'd rather see > > it assigned for that purpose than hiding the issue. > > That would require testing and changes. The device matching is via SPI > table which has device data. Probably adding OF matching would require > bigger changes to for handling the match data. > > This was intentional design in this driver, so we are not hiding here > anything. I doubt it was intentional. Mostly people do this because the magic fallbacks to find the spi_device_id entry work. If we'd noticed at review time it would not have gone in like this. Note that the spi_match_id() use of_modalias_node() which has stripped the vendor id off the compatible then matches against the spi_device_id table. So it 'should' just work. Now ideally we'd switch to spi_get_device_match_data() but that needs more significant changes. Though simple enough ones that review would be enough. Just need to use pointers to the ad75755_chip_info_tbl entries rather than the enum in both the spi id table and the of one - this avoids the issue with the enum value of 0 counting as a failed match. > > > > > > >> > >> drivers/iio/dac/ad5755.c:865:34: error: ‘ad5755_of_match’ defined but not used [-Werror=unused-const-variable=] > > > > > Best regards, > Krzysztof >
On 11/03/2023 19:31, Jonathan Cameron wrote: > On Sat, 11 Mar 2023 13:25:33 +0100 > Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > >> On 11/03/2023 13:22, Jonathan Cameron wrote: >>> On Sat, 11 Mar 2023 12:14:55 +0100 >>> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: >>> >>>> The driver can be compile tested with !CONFIG_OF making certain data >>>> unused (of_device_id is not used for device matching): >>> >>> It should be used for device matching I think, so I'd rather see >>> it assigned for that purpose than hiding the issue. >> >> That would require testing and changes. The device matching is via SPI >> table which has device data. Probably adding OF matching would require >> bigger changes to for handling the match data. >> >> This was intentional design in this driver, so we are not hiding here >> anything. > > I doubt it was intentional. Mostly people do this because the magic > fallbacks to find the spi_device_id entry work. > > If we'd noticed at review time it would not have gone in like this. > Note that the spi_match_id() use of_modalias_node() which has stripped the > vendor id off the compatible then matches against the spi_device_id > table. > > So it 'should' just work. Now ideally we'd switch to > spi_get_device_match_data() but that needs more significant changes. > Though simple enough ones that review would be enough. > > Just need to use pointers to the ad75755_chip_info_tbl entries > rather than the enum in both the spi id table and the of one - this > avoids the issue with the enum value of 0 counting as a failed match. It's not that simple change... maybe you are right that adding match data to OF table would not break anything, but to me it is something substantial and requiring testing, which obviously I cannot do. Therefore I am going to skip this one (thus the error stays). Best regards, Krzysztof
diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c index beadfa938d2d..a6dc8a0bfc29 100644 --- a/drivers/iio/dac/ad5755.c +++ b/drivers/iio/dac/ad5755.c @@ -862,7 +862,7 @@ static const struct spi_device_id ad5755_id[] = { }; MODULE_DEVICE_TABLE(spi, ad5755_id); -static const struct of_device_id ad5755_of_match[] = { +static const struct of_device_id ad5755_of_match[] __maybe_unused = { { .compatible = "adi,ad5755" }, { .compatible = "adi,ad5755-1" }, { .compatible = "adi,ad5757" },