Message ID | 20230418233656.869055-3-chris.packham@alliedtelesis.co.nz |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3207138vqo; Tue, 18 Apr 2023 17:01:53 -0700 (PDT) X-Google-Smtp-Source: AKy350bp+3H+ax9PCJTTSA6NzdgCnXTstkyhytm1Tu6MoCy0ccYcJeHvXGfZjJ6cAics2ddAl2+h X-Received: by 2002:a17:902:d481:b0:1a6:d295:ad5a with SMTP id c1-20020a170902d48100b001a6d295ad5amr566104plg.1.1681862513429; Tue, 18 Apr 2023 17:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681862513; cv=none; d=google.com; s=arc-20160816; b=BuEX7gRZ+QaXrAdZFy6VfKloDNcci2aYnSRddEye7KupbiwlGkRh46h9v4j3f/N6/q HqKfuuub3/arrovG4JJLi/E6vPFt6RJ6xlCvCCxuKGMb6A3xDvxF6M/d/9nD9PIB50ra 43rgM7w6rBozFS7utgPRHwfBYtgrtDmxZO4V6uCxJQBdiEHF/XXOvK18VlnEP1DGMEh8 1GesNCx9T+X6KvmBZKT8MdcQFtvwUTGBMUC6OdGkDuVtGOml+f8lZG+qCRPqnuu5ATHJ hwQZiugE5J2tmJ3p4MjF08ABh/RTCDX/B/yWRMTIatgHLg+4zspZZ6PUSlluYIc0IKE+ Xdaw== 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=Fbv4H9jmdq6VlD5UfEb37WubIhQNFvs8UbIcHX8jjUI=; b=IhhyIKBoM3hxAWylhXI46PJE+bGLrKemphWmZb1eHug7Lv0zAnXLS6JR9fLIXMkteM HlNNHbfYV2MxVwB+QK/P1OGrr1CHrWM2TqUWgk+doDkplgMPt9HR5pc7DNPBV62bVoZn g9TntEKmqb9OfiDBW1q5krz44axI10jr2BWJvDuHtUrqSXZMX3lA5hROmut15ZW4K1g2 TWHI5ZEnPNN+e5wDoICLhpPSb5PVgqay7uS6gPhXZCbFohWi60XMU1Q2C9AheGzXPxwC rkUBbTcBOrLwaMjU/yJDD+c3E05Y+JOFJvdM4F34Gy41vsT5qg0YoGbyv3+eoJ8KEX/o pjMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=O3EJpAz0; 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=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jf1-20020a170903268100b001a52ce7fb39si14601936plb.46.2023.04.18.17.01.40; Tue, 18 Apr 2023 17:01:53 -0700 (PDT) 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=@alliedtelesis.co.nz header.s=mail181024 header.b=O3EJpAz0; 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=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231846AbjDRXkP (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Tue, 18 Apr 2023 19:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231538AbjDRXjz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Apr 2023 19:39:55 -0400 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [IPv6:2001:df5:b000:5::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3FF512CBF for <linux-kernel@vger.kernel.org>; Tue, 18 Apr 2023 16:37:11 -0700 (PDT) Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id CB7572C06BA; Wed, 19 Apr 2023 11:37:08 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1681861028; bh=Fbv4H9jmdq6VlD5UfEb37WubIhQNFvs8UbIcHX8jjUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O3EJpAz0KqODcW1Dx6bXUDkGjIV/FUSYQq8wcotOrz5HmmoleRPcOTMH+MSBWj+jo n0Y3Ql6Ye9OV0TLi2fxpOfeON+kCGrj5BKg9uxq5a3gCE7CGc0xqK6TPCwdNmwFeeu 2y3eD26lza/Rol0B6jy+LV7b6QDRsIDe6HqVJvS0GCeJVdHDMUUlzLQZyjv9fwhasx F1l2rYhzPHoK4iiaDGDZdFQDRKL18AjUa9ni3VnC0TivEXTOcrzPMLXCKlgtswaVqp vOpHGAVonYW+ao/gD5KF1Bqkv4IzL+jGbPeBOky9rb2pMr6MEm7bdSseAx5tXT0jTE LOai0fkTFPpjQ== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id <B643f29a40002>; Wed, 19 Apr 2023 11:37:08 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 054D713EE52; Wed, 19 Apr 2023 11:37:08 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 0A556283BBF; Wed, 19 Apr 2023 11:37:08 +1200 (NZST) From: Chris Packham <chris.packham@alliedtelesis.co.nz> To: jdelvare@suse.com, linux@roeck-us.net, manio@skyboo.net Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Packham <chris.packham@alliedtelesis.co.nz> Subject: [PATCH v2 2/2] hwmon: (adt7475) Convert to use device_property APIs Date: Wed, 19 Apr 2023 11:36:56 +1200 Message-Id: <20230418233656.869055-3-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418233656.869055-1-chris.packham@alliedtelesis.co.nz> References: <20230418233656.869055-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SEG-SpamProfiler-Analysis: v=2.3 cv=VfuJw2h9 c=1 sm=1 tr=0 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=dKHAf1wccvYA:10 a=B2oEPs-dVrQZeniiuWAA:9 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,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?1763560667040565809?= X-GMAIL-MSGID: =?utf-8?q?1763560667040565809?= |
Series |
hwmon: (adt7475) Handle DT unaware platforms
|
|
Commit Message
Chris Packham
April 18, 2023, 11:36 p.m. UTC
Instead of of_property_read_*() use the equivalent
device_property_read_*() API. This will allow these properties to be
used on DT unaware platforms. For DT aware platforms this will be a
noop.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
This is an additional update for master from the preceeding bugfix
commit. I've not added a fixes tag for this one because I don't think
there will be a behaviour change for existing usages.
I know we have one upcoming DT unaware platform that we may want to use
some of these properties via ACPI tables so I won't object if this ends
up on the stable track but I don't think it meets the criteria for
stable.
drivers/hwmon/adt7475.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
Hi Chris, kernel test robot noticed the following build warnings: [auto build test WARNING on groeck-staging/hwmon-next] [also build test WARNING on linus/master v6.3-rc7 next-20230418] [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/Chris-Packham/hwmon-adt7475-Use-device_property-APIs-when-configuring-polarity/20230419-074117 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next patch link: https://lore.kernel.org/r/20230418233656.869055-3-chris.packham%40alliedtelesis.co.nz patch subject: [PATCH v2 2/2] hwmon: (adt7475) Convert to use device_property APIs config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230419/202304192005.lJVSjooB-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/59836340c66130951595e2adebf284eca3063ccd git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Chris-Packham/hwmon-adt7475-Use-device_property-APIs-when-configuring-polarity/20230419-074117 git checkout 59836340c66130951595e2adebf284eca3063ccd # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202304192005.lJVSjooB-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/hwmon/adt7475.c: In function 'load_config3': >> drivers/hwmon/adt7475.c:1471:43: warning: passing argument 1 of 'device_property_read_string' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 1471 | ret = device_property_read_string(&client->dev, propname, &function); | ^~~~~~~~~~~~ In file included from include/linux/of.h:22, from include/linux/of_device.h:9, from drivers/hwmon/adt7475.c:13: include/linux/property.h:54:48: note: expected 'struct device *' but argument is of type 'const struct device *' 54 | int device_property_read_string(struct device *dev, const char *propname, | ~~~~~~~~~~~~~~~^~~ drivers/hwmon/adt7475.c: In function 'load_config4': drivers/hwmon/adt7475.c:1497:43: warning: passing argument 1 of 'device_property_read_string' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 1497 | ret = device_property_read_string(&client->dev, propname, &function); | ^~~~~~~~~~~~ include/linux/property.h:54:48: note: expected 'struct device *' but argument is of type 'const struct device *' 54 | int device_property_read_string(struct device *dev, const char *propname, | ~~~~~~~~~~~~~~~^~~ drivers/hwmon/adt7475.c: In function 'set_property_bit': >> drivers/hwmon/adt7475.c:1559:44: warning: passing argument 1 of 'device_property_read_u32' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 1559 | int ret = device_property_read_u32(&client->dev, property, | ^~~~~~~~~~~~ include/linux/property.h:164:59: note: expected 'struct device *' but argument is of type 'const struct device *' 164 | static inline int device_property_read_u32(struct device *dev, | ~~~~~~~~~~~~~~~^~~ vim +1471 drivers/hwmon/adt7475.c 1464 1465 static int load_config3(const struct i2c_client *client, const char *propname) 1466 { 1467 const char *function; 1468 u8 config3; 1469 int ret; 1470 > 1471 ret = device_property_read_string(&client->dev, propname, &function); 1472 if (!ret) { 1473 ret = adt7475_read(REG_CONFIG3); 1474 if (ret < 0) 1475 return ret; 1476 1477 config3 = ret & ~CONFIG3_SMBALERT; 1478 if (!strcmp("pwm2", function)) 1479 ; 1480 else if (!strcmp("smbalert#", function)) 1481 config3 |= CONFIG3_SMBALERT; 1482 else 1483 return -EINVAL; 1484 1485 return i2c_smbus_write_byte_data(client, REG_CONFIG3, config3); 1486 } 1487 1488 return 0; 1489 } 1490 1491 static int load_config4(const struct i2c_client *client, const char *propname) 1492 { 1493 const char *function; 1494 u8 config4; 1495 int ret; 1496 1497 ret = device_property_read_string(&client->dev, propname, &function); 1498 if (!ret) { 1499 ret = adt7475_read(REG_CONFIG4); 1500 if (ret < 0) 1501 return ret; 1502 1503 config4 = ret & ~CONFIG4_PINFUNC; 1504 1505 if (!strcmp("tach4", function)) 1506 ; 1507 else if (!strcmp("therm#", function)) 1508 config4 |= CONFIG4_THERM; 1509 else if (!strcmp("smbalert#", function)) 1510 config4 |= CONFIG4_SMBALERT; 1511 else if (!strcmp("gpio", function)) 1512 config4 |= CONFIG4_PINFUNC; 1513 else 1514 return -EINVAL; 1515 1516 return i2c_smbus_write_byte_data(client, REG_CONFIG4, config4); 1517 } 1518 1519 return 0; 1520 } 1521 1522 static int load_config(const struct i2c_client *client, enum chips chip) 1523 { 1524 int err; 1525 const char *prop1, *prop2; 1526 1527 switch (chip) { 1528 case adt7473: 1529 case adt7475: 1530 prop1 = "adi,pin5-function"; 1531 prop2 = "adi,pin9-function"; 1532 break; 1533 case adt7476: 1534 case adt7490: 1535 prop1 = "adi,pin10-function"; 1536 prop2 = "adi,pin14-function"; 1537 break; 1538 } 1539 1540 err = load_config3(client, prop1); 1541 if (err) { 1542 dev_err(&client->dev, "failed to configure %s\n", prop1); 1543 return err; 1544 } 1545 1546 err = load_config4(client, prop2); 1547 if (err) { 1548 dev_err(&client->dev, "failed to configure %s\n", prop2); 1549 return err; 1550 } 1551 1552 return 0; 1553 } 1554 1555 static int set_property_bit(const struct i2c_client *client, char *property, 1556 u8 *config, u8 bit_index) 1557 { 1558 u32 prop_value = 0; > 1559 int ret = device_property_read_u32(&client->dev, property, 1560 &prop_value); 1561 1562 if (!ret) { 1563 if (prop_value) 1564 *config |= (1 << bit_index); 1565 else 1566 *config &= ~(1 << bit_index); 1567 } 1568 1569 return ret; 1570 } 1571
On Wed, Apr 19, 2023 at 11:36:56AM +1200, Chris Packham wrote: > Instead of of_property_read_*() use the equivalent > device_property_read_*() API. This will allow these properties to be > used on DT unaware platforms. For DT aware platforms this will be a > noop. > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > > Notes: > This is an additional update for master from the preceeding bugfix > commit. I've not added a fixes tag for this one because I don't think > there will be a behaviour change for existing usages. > > I know we have one upcoming DT unaware platform that we may want to use > some of these properties via ACPI tables so I won't object if this ends > up on the stable track but I don't think it meets the criteria for > stable. > > drivers/hwmon/adt7475.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c > index 6a6ebcc896b1..3b9289bc5997 100644 > --- a/drivers/hwmon/adt7475.c > +++ b/drivers/hwmon/adt7475.c > @@ -1468,7 +1468,7 @@ static int load_config3(const struct i2c_client *client, const char *propname) > u8 config3; > int ret; > > - ret = of_property_read_string(client->dev.of_node, propname, &function); > + ret = device_property_read_string(&client->dev, propname, &function); Unfortunately that is a problem because the parameter passed to load_config3 is a pointer to a const data structure and device_property_read_string doesn't like that (afaics for no good reason). You'll also have to change the client parameter to load_config() and friends to not be const. Guenter
On 20/04/23 04:06, Guenter Roeck wrote: > On Wed, Apr 19, 2023 at 11:36:56AM +1200, Chris Packham wrote: >> Instead of of_property_read_*() use the equivalent >> device_property_read_*() API. This will allow these properties to be >> used on DT unaware platforms. For DT aware platforms this will be a >> noop. >> >> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> >> --- >> >> Notes: >> This is an additional update for master from the preceeding bugfix >> commit. I've not added a fixes tag for this one because I don't think >> there will be a behaviour change for existing usages. >> >> I know we have one upcoming DT unaware platform that we may want to use >> some of these properties via ACPI tables so I won't object if this ends >> up on the stable track but I don't think it meets the criteria for >> stable. >> >> drivers/hwmon/adt7475.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c >> index 6a6ebcc896b1..3b9289bc5997 100644 >> --- a/drivers/hwmon/adt7475.c >> +++ b/drivers/hwmon/adt7475.c >> @@ -1468,7 +1468,7 @@ static int load_config3(const struct i2c_client *client, const char *propname) >> u8 config3; >> int ret; >> >> - ret = of_property_read_string(client->dev.of_node, propname, &function); >> + ret = device_property_read_string(&client->dev, propname, &function); > Unfortunately that is a problem because the parameter passed to > load_config3 is a pointer to a const data structure and > device_property_read_string doesn't like that (afaics for > no good reason). You'll also have to change the client parameter > to load_config() and friends to not be const. Not sure how I didn't notice that. Probably rushing to get the fix part out. I do have a v3 that drops the const where needed to silence the warnings but I'll sit on that for now in the hope that your patch gets accepted. > Guenter
On 4/19/23 13:49, Chris Packham wrote: > > On 20/04/23 04:06, Guenter Roeck wrote: >> On Wed, Apr 19, 2023 at 11:36:56AM +1200, Chris Packham wrote: >>> Instead of of_property_read_*() use the equivalent >>> device_property_read_*() API. This will allow these properties to be >>> used on DT unaware platforms. For DT aware platforms this will be a >>> noop. >>> >>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> >>> --- >>> >>> Notes: >>> This is an additional update for master from the preceeding bugfix >>> commit. I've not added a fixes tag for this one because I don't think >>> there will be a behaviour change for existing usages. >>> >>> I know we have one upcoming DT unaware platform that we may want to use >>> some of these properties via ACPI tables so I won't object if this ends >>> up on the stable track but I don't think it meets the criteria for >>> stable. >>> >>> drivers/hwmon/adt7475.c | 8 ++++---- >>> 1 file changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c >>> index 6a6ebcc896b1..3b9289bc5997 100644 >>> --- a/drivers/hwmon/adt7475.c >>> +++ b/drivers/hwmon/adt7475.c >>> @@ -1468,7 +1468,7 @@ static int load_config3(const struct i2c_client *client, const char *propname) >>> u8 config3; >>> int ret; >>> >>> - ret = of_property_read_string(client->dev.of_node, propname, &function); >>> + ret = device_property_read_string(&client->dev, propname, &function); >> Unfortunately that is a problem because the parameter passed to >> load_config3 is a pointer to a const data structure and >> device_property_read_string doesn't like that (afaics for >> no good reason). You'll also have to change the client parameter >> to load_config() and friends to not be const. > > Not sure how I didn't notice that. Probably rushing to get the fix part out. > > I do have a v3 that drops the const where needed to silence the warnings > but I'll sit on that for now in the hope that your patch gets accepted. > Sounds good to me. There is no hurry with this one, after all. Thanks, Guenter
Hi Chris, kernel test robot noticed the following build errors: [auto build test ERROR on groeck-staging/hwmon-next] [also build test ERROR on linus/master v6.3-rc7] [cannot apply to next-20230420] [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/Chris-Packham/hwmon-adt7475-Use-device_property-APIs-when-configuring-polarity/20230419-074117 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next patch link: https://lore.kernel.org/r/20230418233656.869055-3-chris.packham%40alliedtelesis.co.nz patch subject: [PATCH v2 2/2] hwmon: (adt7475) Convert to use device_property APIs config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20230421/202304211232.U03a7306-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/59836340c66130951595e2adebf284eca3063ccd git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Chris-Packham/hwmon-adt7475-Use-device_property-APIs-when-configuring-polarity/20230419-074117 git checkout 59836340c66130951595e2adebf284eca3063ccd # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/hwmon/ drivers/net/ethernet/intel/ice/ kernel/rcu/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202304211232.U03a7306-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/hwmon/adt7475.c:1471:36: error: passing 'const struct device *' to parameter of type 'struct device *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] ret = device_property_read_string(&client->dev, propname, &function); ^~~~~~~~~~~~ include/linux/property.h:54:48: note: passing argument to parameter 'dev' here int device_property_read_string(struct device *dev, const char *propname, ^ drivers/hwmon/adt7475.c:1497:36: error: passing 'const struct device *' to parameter of type 'struct device *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] ret = device_property_read_string(&client->dev, propname, &function); ^~~~~~~~~~~~ include/linux/property.h:54:48: note: passing argument to parameter 'dev' here int device_property_read_string(struct device *dev, const char *propname, ^ drivers/hwmon/adt7475.c:1559:37: error: passing 'const struct device *' to parameter of type 'struct device *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] int ret = device_property_read_u32(&client->dev, property, ^~~~~~~~~~~~ include/linux/property.h:164:59: note: passing argument to parameter 'dev' here static inline int device_property_read_u32(struct device *dev, ^ 3 errors generated. vim +1471 drivers/hwmon/adt7475.c 1464 1465 static int load_config3(const struct i2c_client *client, const char *propname) 1466 { 1467 const char *function; 1468 u8 config3; 1469 int ret; 1470 > 1471 ret = device_property_read_string(&client->dev, propname, &function); 1472 if (!ret) { 1473 ret = adt7475_read(REG_CONFIG3); 1474 if (ret < 0) 1475 return ret; 1476 1477 config3 = ret & ~CONFIG3_SMBALERT; 1478 if (!strcmp("pwm2", function)) 1479 ; 1480 else if (!strcmp("smbalert#", function)) 1481 config3 |= CONFIG3_SMBALERT; 1482 else 1483 return -EINVAL; 1484 1485 return i2c_smbus_write_byte_data(client, REG_CONFIG3, config3); 1486 } 1487 1488 return 0; 1489 } 1490
Hi Chris, kernel test robot noticed the following build warnings: [auto build test WARNING on groeck-staging/hwmon-next] [also build test WARNING on linus/master v6.3-rc7] [cannot apply to next-20230420] [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/Chris-Packham/hwmon-adt7475-Use-device_property-APIs-when-configuring-polarity/20230419-074117 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next patch link: https://lore.kernel.org/r/20230418233656.869055-3-chris.packham%40alliedtelesis.co.nz patch subject: [PATCH v2 2/2] hwmon: (adt7475) Convert to use device_property APIs config: i386-randconfig-s002-20230417 (https://download.01.org/0day-ci/archive/20230421/202304211315.wHZGWO8S-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/59836340c66130951595e2adebf284eca3063ccd git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Chris-Packham/hwmon-adt7475-Use-device_property-APIs-when-configuring-polarity/20230419-074117 git checkout 59836340c66130951595e2adebf284eca3063ccd # save the config file mkdir build_dir && cp config build_dir/.config make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 olddefconfig make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/hwmon/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202304211315.wHZGWO8S-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> drivers/hwmon/adt7475.c:1471:44: sparse: sparse: incorrect type in argument 1 (different modifiers) @@ expected struct device *dev @@ got struct device const * @@ drivers/hwmon/adt7475.c:1471:44: sparse: expected struct device *dev drivers/hwmon/adt7475.c:1471:44: sparse: got struct device const * drivers/hwmon/adt7475.c:1497:44: sparse: sparse: incorrect type in argument 1 (different modifiers) @@ expected struct device *dev @@ got struct device const * @@ drivers/hwmon/adt7475.c:1497:44: sparse: expected struct device *dev drivers/hwmon/adt7475.c:1497:44: sparse: got struct device const * drivers/hwmon/adt7475.c:1559:45: sparse: sparse: incorrect type in argument 1 (different modifiers) @@ expected struct device *dev @@ got struct device const * @@ drivers/hwmon/adt7475.c:1559:45: sparse: expected struct device *dev drivers/hwmon/adt7475.c:1559:45: sparse: got struct device const * vim +1471 drivers/hwmon/adt7475.c 1464 1465 static int load_config3(const struct i2c_client *client, const char *propname) 1466 { 1467 const char *function; 1468 u8 config3; 1469 int ret; 1470 > 1471 ret = device_property_read_string(&client->dev, propname, &function); 1472 if (!ret) { 1473 ret = adt7475_read(REG_CONFIG3); 1474 if (ret < 0) 1475 return ret; 1476 1477 config3 = ret & ~CONFIG3_SMBALERT; 1478 if (!strcmp("pwm2", function)) 1479 ; 1480 else if (!strcmp("smbalert#", function)) 1481 config3 |= CONFIG3_SMBALERT; 1482 else 1483 return -EINVAL; 1484 1485 return i2c_smbus_write_byte_data(client, REG_CONFIG3, config3); 1486 } 1487 1488 return 0; 1489 } 1490
On Wed, Apr 19, 2023 at 11:36:56AM +1200, Chris Packham wrote: > Instead of of_property_read_*() use the equivalent > device_property_read_*() API. This will allow these properties to be > used on DT unaware platforms. For DT aware platforms this will be a > noop. > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Applied to hwmon-next. Thanks, Guenter > --- > > Notes: > This is an additional update for master from the preceeding bugfix > commit. I've not added a fixes tag for this one because I don't think > there will be a behaviour change for existing usages. > > I know we have one upcoming DT unaware platform that we may want to use > some of these properties via ACPI tables so I won't object if this ends > up on the stable track but I don't think it meets the criteria for > stable. > > drivers/hwmon/adt7475.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c > index 6a6ebcc896b1..3b9289bc5997 100644 > --- a/drivers/hwmon/adt7475.c > +++ b/drivers/hwmon/adt7475.c > @@ -1468,7 +1468,7 @@ static int load_config3(const struct i2c_client *client, const char *propname) > u8 config3; > int ret; > > - ret = of_property_read_string(client->dev.of_node, propname, &function); > + ret = device_property_read_string(&client->dev, propname, &function); > if (!ret) { > ret = adt7475_read(REG_CONFIG3); > if (ret < 0) > @@ -1494,7 +1494,7 @@ static int load_config4(const struct i2c_client *client, const char *propname) > u8 config4; > int ret; > > - ret = of_property_read_string(client->dev.of_node, propname, &function); > + ret = device_property_read_string(&client->dev, propname, &function); > if (!ret) { > ret = adt7475_read(REG_CONFIG4); > if (ret < 0) > @@ -1556,8 +1556,8 @@ static int set_property_bit(const struct i2c_client *client, char *property, > u8 *config, u8 bit_index) > { > u32 prop_value = 0; > - int ret = of_property_read_u32(client->dev.of_node, property, > - &prop_value); > + int ret = device_property_read_u32(&client->dev, property, > + &prop_value); > > if (!ret) { > if (prop_value)
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index 6a6ebcc896b1..3b9289bc5997 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -1468,7 +1468,7 @@ static int load_config3(const struct i2c_client *client, const char *propname) u8 config3; int ret; - ret = of_property_read_string(client->dev.of_node, propname, &function); + ret = device_property_read_string(&client->dev, propname, &function); if (!ret) { ret = adt7475_read(REG_CONFIG3); if (ret < 0) @@ -1494,7 +1494,7 @@ static int load_config4(const struct i2c_client *client, const char *propname) u8 config4; int ret; - ret = of_property_read_string(client->dev.of_node, propname, &function); + ret = device_property_read_string(&client->dev, propname, &function); if (!ret) { ret = adt7475_read(REG_CONFIG4); if (ret < 0) @@ -1556,8 +1556,8 @@ static int set_property_bit(const struct i2c_client *client, char *property, u8 *config, u8 bit_index) { u32 prop_value = 0; - int ret = of_property_read_u32(client->dev.of_node, property, - &prop_value); + int ret = device_property_read_u32(&client->dev, property, + &prop_value); if (!ret) { if (prop_value)