Message ID | 20231122155916.38037-1-brgl@bgdev.pl |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1424346vqb; Wed, 22 Nov 2023 07:59:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeXMRibkJniFTMXZPEso41J5v8UmM8lVIYujaX+Fse40Z6Xu674U4871l+spP43oUmGXn5 X-Received: by 2002:a05:6a21:612:b0:187:652d:95b5 with SMTP id ll18-20020a056a21061200b00187652d95b5mr1941756pzb.62.1700668788350; Wed, 22 Nov 2023 07:59:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700668788; cv=none; d=google.com; s=arc-20160816; b=yTeHAfLP8aTF4oAAzcNtZO1WWg8Hz3nK7SWiBBPbWaO8ey7Ps9SAiWWDtk1K9WDBlB Q1i4Q2j68GRYsCTShWFjwVwExixtLOofNpE9PqFwCF53TSTZEjs03a+LUA2sbjQEtvUl 4pZzZZfF9Zo+0Ss1Z/FoEXUOdMJ1ewed9uDBJG1x6E5xfy1qvqb5ZjLiNBbk1wNHsWN/ /mLCLHo8AA5KShI+pODRXQo94cqGNpsR7zYzWUM3JMIfdJvi07fIugxdzzgXCWWhl67h jdOWEI4iomUwudx1VmprnKlx3aMoB3mIr1QYHJWOkVmiTXdXVvme8MLIZFiXio8hTJdP Q4Xw== 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=8wkJWpPzXVPRgDS/WddlejSs7PCXn5mUATF2Jmfj7mc=; fh=lLawJaJWSrvXzR93RgPauz+HRGcsP8Iy00ImfnojvBs=; b=VgY131L2OTkxqCeWTxw4DpyzPk8FxxTnP7T9w0bUa11LIi5l3qSuEfpxFDw8hSv80v 1lZVi4XFdeVS671msPz1iX17EBvS41BlkF4GatCLV3CFpst4Qo4cRtLaLptpB2btrc0B 66xcPPVYvvwW2EcGFjoO69DtTKXOaKamc1+d015z8eclQQy6kZ9QAGcqqe8VB0z9E3Lb jjSu+tdk1nCsffskP6Hzc1kWgI5lOFDLp1mye1lxVXl8ZWsoac4x0n+0dlYUsw3hFf/M KLuOuPEhrq3PE9dBJly/d7M7nK8M/C3suhucv7FPWw6ofIuyHEWaCXbl8P3zQ0lwvsb9 FKkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b="sKg//tqh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a70-20020a639049000000b005aa7d3730dfsi12415630pge.114.2023.11.22.07.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:59:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b="sKg//tqh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0837281D82FC; Wed, 22 Nov 2023 07:59:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344494AbjKVP7n (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Wed, 22 Nov 2023 10:59:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344245AbjKVP7l (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Nov 2023 10:59:41 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A306F92 for <linux-kernel@vger.kernel.org>; Wed, 22 Nov 2023 07:59:35 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4079ed65471so35343005e9.1 for <linux-kernel@vger.kernel.org>; Wed, 22 Nov 2023 07:59:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1700668774; x=1701273574; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8wkJWpPzXVPRgDS/WddlejSs7PCXn5mUATF2Jmfj7mc=; b=sKg//tqh1z9aGk7XKkuZC03JnUdIOOwA4hKRj5RNEIokZ83SxsUQRJ+M9nvkclyR4C bFMVMv2wDMQxRClMaS/02ipTiZpaQZ8jZy+tMCvg4Y8611bbB06QJjBY1hHOF2/YVqUg tjxI11yJnYYA2LWCeRAR+mN/NerpVCM4ittVvLcXms34QE532XL38EDLk75JziGHYK1j dobBgTTeNkEb8k+QRfthGTVlEp8tk7leR8THw00Py6UpSApbBvHMBFKuJOXF3nd5PBwJ zMSwK3TSsOvN2kHPlveuZ12lwhO56hMDmzJt8G0+la5ZiK5wZd7kMzolhRwtCxjurlaX Lrzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700668774; x=1701273574; 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=8wkJWpPzXVPRgDS/WddlejSs7PCXn5mUATF2Jmfj7mc=; b=Iew9M592+R4hHM6WKmWFK3cv+9oF+V7klPq2c7biAHEkWqXAGb3GVuQdQzpl0SE/xR wM0C2PFuLwMCEg5+XihPZbwwA55yCQidS6GIiWjvImv8oAnFRV5PagSz2b71oeXJzVp/ Ye+DKHa6ean2Vv7H3e48GCyLcLNDd1hMU4NTbzXyAc2isasZ5pukqoADXNnovHVks0Hj 2clrxJNa6USZCUFHh5RE+0YCHb9VTUyKfpS1ZiO8jKUKf+7QShafAPAk87PO5tSoZqQq 5099x78I76MK7ZnOwYDpwJ29LT5eYoVFzzmlR6Wl0bLfqnFv8VL/F3AluW1K5dkMakmK NZBg== X-Gm-Message-State: AOJu0YynCZnRRJFwEvKcvV3jx4148xM47+znXlJQLG3sf7n6Jj5unLQK F0PVv+w3bjwkCwTiXK32Q5tOLQ== X-Received: by 2002:a5d:59a2:0:b0:32d:a495:a9b7 with SMTP id p2-20020a5d59a2000000b0032da495a9b7mr1710247wrr.61.1700668774009; Wed, 22 Nov 2023 07:59:34 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:bc76:bea6:6d96:7507]) by smtp.gmail.com with ESMTPSA id t16-20020a05600c199000b0040b1a3c83b6sm2644279wmq.40.2023.11.22.07.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:59:33 -0800 (PST) From: Bartosz Golaszewski <brgl@bgdev.pl> To: Wolfram Sang <wsa@the-dreams.de> Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Subject: [PATCH] eeprom: at24: use of_match_ptr() Date: Wed, 22 Nov 2023 16:59:16 +0100 Message-Id: <20231122155916.38037-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 07:59:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783280475765941221 X-GMAIL-MSGID: 1783280475765941221 |
Series |
eeprom: at24: use of_match_ptr()
|
|
Commit Message
Bartosz Golaszewski
Nov. 22, 2023, 3:59 p.m. UTC
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> This driver does not depend on CONFIG_OF so using of_match_ptr() makes sense to reduce the size a bit. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> --- drivers/misc/eeprom/at24.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi! 2023-11-22 at 16:59, Bartosz Golaszewski wrote: > - .of_match_table = at24_of_match, > + .of_match_table = of_match_ptr(at24_of_match), If you do that, you will need to also add #ifdef CONFIG_OF around the at24_of_match definition, of you'll trigger a warning about an unused const variable (for some configs). I think. Cheers, Peter
On Wed, 22 Nov 2023 at 17:41, Peter Rosin <peda@axentia.se> wrote: > > Hi! > > 2023-11-22 at 16:59, Bartosz Golaszewski wrote: > > - .of_match_table = at24_of_match, > > + .of_match_table = of_match_ptr(at24_of_match), > > If you do that, you will need to also add #ifdef CONFIG_OF around the > at24_of_match definition, of you'll trigger a warning about an unused > const variable (for some configs). I think. > > Cheers, > Peter Nope, no warnings even with W=2. This is true for unused functions but unused data structures are just silently removed. Bart
2023-11-22 at 17:57, Bartosz Golaszewski wrote: > On Wed, 22 Nov 2023 at 17:41, Peter Rosin <peda@axentia.se> wrote: >> >> Hi! >> >> 2023-11-22 at 16:59, Bartosz Golaszewski wrote: >>> - .of_match_table = at24_of_match, >>> + .of_match_table = of_match_ptr(at24_of_match), >> >> If you do that, you will need to also add #ifdef CONFIG_OF around the >> at24_of_match definition, of you'll trigger a warning about an unused >> const variable (for some configs). I think. >> >> Cheers, >> Peter > > Nope, no warnings even with W=2. This is true for unused functions but > unused data structures are just silently removed. Then I wonder what the difference is from the following? https://lore.kernel.org/all/202311161306.opyfcoCY-lkp@intel.com/T/#m3a33dc4c3221ae167563bcff70757af776cf07b1 It sure looks like the exact same pattern to me. I.e. a static const struct of_device_id paired with of_match_ptr(). CHeers, Peter
On Wed, Nov 22, 2023 at 6:14 PM Peter Rosin <peda@axentia.se> wrote: > > > 2023-11-22 at 17:57, Bartosz Golaszewski wrote: > > On Wed, 22 Nov 2023 at 17:41, Peter Rosin <peda@axentia.se> wrote: > >> > >> Hi! > >> > >> 2023-11-22 at 16:59, Bartosz Golaszewski wrote: > >>> - .of_match_table = at24_of_match, > >>> + .of_match_table = of_match_ptr(at24_of_match), > >> > >> If you do that, you will need to also add #ifdef CONFIG_OF around the > >> at24_of_match definition, of you'll trigger a warning about an unused > >> const variable (for some configs). I think. > >> > >> Cheers, > >> Peter > > > > Nope, no warnings even with W=2. This is true for unused functions but > > unused data structures are just silently removed. > > Then I wonder what the difference is from the following? > > https://lore.kernel.org/all/202311161306.opyfcoCY-lkp@intel.com/T/#m3a33dc4c3221ae167563bcff70757af776cf07b1 > > It sure looks like the exact same pattern to me. > I.e. a static const struct of_device_id paired with of_match_ptr(). > > CHeers, > Peter Ah, we need __maybe_unused here. Bart
Hi Bartosz,
kernel test robot noticed the following build warnings:
[auto build test WARNING on brgl/gpio/for-next]
[also build test WARNING on linus/master v6.7-rc2 next-20231122]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/eeprom-at24-use-of_match_ptr/20231123-000103
base: https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
patch link: https://lore.kernel.org/r/20231122155916.38037-1-brgl%40bgdev.pl
patch subject: [PATCH] eeprom: at24: use of_match_ptr()
config: i386-buildonly-randconfig-001-20231123 (https://download.01.org/0day-ci/archive/20231123/202311231054.oSloZJkd-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231123/202311231054.oSloZJkd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311231054.oSloZJkd-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/misc/eeprom/at24.c:246:34: warning: 'at24_of_match' defined but not used [-Wunused-const-variable=]
static const struct of_device_id at24_of_match[] = {
^~~~~~~~~~~~~
vim +/at24_of_match +246 drivers/misc/eeprom/at24.c
2b7a5056a0a7ff drivers/i2c/chips/at24.c Wolfram Sang 2008-07-14 245
7f2a2f0d0d66b2 drivers/misc/eeprom/at24.c Javier Martinez Canillas 2017-10-01 @246 static const struct of_device_id at24_of_match[] = {
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 247 { .compatible = "atmel,24c00", .data = &at24_data_24c00 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 248 { .compatible = "atmel,24c01", .data = &at24_data_24c01 },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 249 { .compatible = "atmel,24cs01", .data = &at24_data_24cs01 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 250 { .compatible = "atmel,24c02", .data = &at24_data_24c02 },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 251 { .compatible = "atmel,24cs02", .data = &at24_data_24cs02 },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 252 { .compatible = "atmel,24mac402", .data = &at24_data_24mac402 },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 253 { .compatible = "atmel,24mac602", .data = &at24_data_24mac602 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 254 { .compatible = "atmel,spd", .data = &at24_data_spd },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 255 { .compatible = "atmel,24c04", .data = &at24_data_24c04 },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 256 { .compatible = "atmel,24cs04", .data = &at24_data_24cs04 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 257 { .compatible = "atmel,24c08", .data = &at24_data_24c08 },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 258 { .compatible = "atmel,24cs08", .data = &at24_data_24cs08 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 259 { .compatible = "atmel,24c16", .data = &at24_data_24c16 },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 260 { .compatible = "atmel,24cs16", .data = &at24_data_24cs16 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 261 { .compatible = "atmel,24c32", .data = &at24_data_24c32 },
4791146e9055dd drivers/misc/eeprom/at24.c Marek Vasut 2023-10-10 262 { .compatible = "atmel,24c32d-wl", .data = &at24_data_24c32d_wlp },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 263 { .compatible = "atmel,24cs32", .data = &at24_data_24cs32 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 264 { .compatible = "atmel,24c64", .data = &at24_data_24c64 },
3774740fb22162 drivers/misc/eeprom/at24.c Alexander Stein 2023-10-13 265 { .compatible = "atmel,24c64d-wl", .data = &at24_data_24c64d_wlp },
0f30aca72c3b68 drivers/misc/eeprom/at24.c Bartosz Golaszewski 2017-12-28 266 { .compatible = "atmel,24cs64", .data = &at24_data_24cs64 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 267 { .compatible = "atmel,24c128", .data = &at24_data_24c128 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 268 { .compatible = "atmel,24c256", .data = &at24_data_24c256 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 269 { .compatible = "atmel,24c512", .data = &at24_data_24c512 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 270 { .compatible = "atmel,24c1024", .data = &at24_data_24c1024 },
d08aea21c89dc2 drivers/misc/eeprom/at24.c Maxim Kochetkov 2021-12-10 271 { .compatible = "atmel,24c1025", .data = &at24_data_24c1025 },
37cf28d3b5bca1 drivers/misc/eeprom/at24.c Adrian Bunk 2018-11-29 272 { .compatible = "atmel,24c2048", .data = &at24_data_24c2048 },
b680f4fa74496a drivers/misc/eeprom/at24.c Sven Van Asbroeck 2017-12-20 273 { /* END OF LIST */ },
7f2a2f0d0d66b2 drivers/misc/eeprom/at24.c Javier Martinez Canillas 2017-10-01 274 };
7f2a2f0d0d66b2 drivers/misc/eeprom/at24.c Javier Martinez Canillas 2017-10-01 275 MODULE_DEVICE_TABLE(of, at24_of_match);
7f2a2f0d0d66b2 drivers/misc/eeprom/at24.c Javier Martinez Canillas 2017-10-01 276
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index f61a80597a22..76a0b9b2fcc4 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -18,6 +18,7 @@ #include <linux/module.h> #include <linux/mutex.h> #include <linux/nvmem-provider.h> +#include <linux/of.h> #include <linux/of_device.h> #include <linux/pm_runtime.h> #include <linux/property.h> @@ -812,7 +813,7 @@ static struct i2c_driver at24_driver = { .driver = { .name = "at24", .pm = &at24_pm_ops, - .of_match_table = at24_of_match, + .of_match_table = of_match_ptr(at24_of_match), .acpi_match_table = ACPI_PTR(at24_acpi_ids), }, .probe = at24_probe,