2023-01-18 10:36:03

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 1/1] net: hns: Switch to use acpi_evaluate_dsm_typed()

The acpi_evaluate_dsm_typed() provides a way to check the type of the
object evaluated by _DSM call. Use it instead of open coded variant.

Signed-off-by: Andy Shevchenko <[email protected]>
---
.../net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index 740850b64aff..d8fb9ed96258 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -554,11 +554,11 @@ static phy_interface_t hns_mac_get_phy_if_acpi(struct hns_mac_cb *mac_cb)
argv4.package.count = 1;
argv4.package.elements = &obj_args;

- obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
- &hns_dsaf_acpi_dsm_guid, 0,
- HNS_OP_GET_PORT_TYPE_FUNC, &argv4);
-
- if (!obj || obj->type != ACPI_TYPE_INTEGER)
+ obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(mac_cb->dev),
+ &hns_dsaf_acpi_dsm_guid, 0,
+ HNS_OP_GET_PORT_TYPE_FUNC, &argv4,
+ ACPI_TYPE_INTEGER);
+ if (!obj)
return phy_if;

phy_if = obj->integer.value ?
@@ -603,9 +603,9 @@ static int hns_mac_get_sfp_prsnt_acpi(struct hns_mac_cb *mac_cb, int *sfp_prsnt)

obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
&hns_dsaf_acpi_dsm_guid, 0,
- HNS_OP_GET_SFP_STAT_FUNC, &argv4);
-
- if (!obj || obj->type != ACPI_TYPE_INTEGER)
+ HNS_OP_GET_SFP_STAT_FUNC, &argv4,
+ ACPI_TYPE_INTEGER);
+ if (!obj)
return -ENODEV;

*sfp_prsnt = obj->integer.value;
--
2.39.0


2023-01-18 13:16:01

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] net: hns: Switch to use acpi_evaluate_dsm_typed()

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on net/master]
[also build test ERROR on net-next/master horms-ipvs/master linus/master v6.2-rc4 next-20230118]
[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/Andy-Shevchenko/net-hns-Switch-to-use-acpi_evaluate_dsm_typed/20230118-182559
patch link: https://lore.kernel.org/r/20230118092922.39426-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] net: hns: Switch to use acpi_evaluate_dsm_typed()
config: m68k-allmodconfig
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/299998ad1587d588587d8bf24e1a1a706256140e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/net-hns-Switch-to-use-acpi_evaluate_dsm_typed/20230118-182559
git checkout 299998ad1587d588587d8bf24e1a1a706256140e
# 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/net/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c: In function 'hns_mac_get_phy_if_acpi':
>> drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c:557:15: error: implicit declaration of function 'acpi_evaluate_dsm_typed'; did you mean 'acpi_evaluate_dsm'? [-Werror=implicit-function-declaration]
557 | obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(mac_cb->dev),
| ^~~~~~~~~~~~~~~~~~~~~~~
| acpi_evaluate_dsm
>> drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c:557:13: warning: assignment to 'union acpi_object *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
557 | obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(mac_cb->dev),
| ^
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c: In function 'hns_mac_get_sfp_prsnt_acpi':
>> drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c:604:15: error: too many arguments to function 'acpi_evaluate_dsm'
604 | obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
| ^~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/hisilicon/hns/hnae.h:26,
from drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h:8,
from drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h:13,
from drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c:6:
include/linux/acpi.h:953:34: note: declared here
953 | static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +557 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c

543
544 static phy_interface_t hns_mac_get_phy_if_acpi(struct hns_mac_cb *mac_cb)
545 {
546 phy_interface_t phy_if = PHY_INTERFACE_MODE_NA;
547 union acpi_object *obj;
548 union acpi_object obj_args, argv4;
549
550 obj_args.integer.type = ACPI_TYPE_INTEGER;
551 obj_args.integer.value = mac_cb->mac_id;
552
553 argv4.type = ACPI_TYPE_PACKAGE;
554 argv4.package.count = 1;
555 argv4.package.elements = &obj_args;
556
> 557 obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(mac_cb->dev),
558 &hns_dsaf_acpi_dsm_guid, 0,
559 HNS_OP_GET_PORT_TYPE_FUNC, &argv4,
560 ACPI_TYPE_INTEGER);
561 if (!obj)
562 return phy_if;
563
564 phy_if = obj->integer.value ?
565 PHY_INTERFACE_MODE_XGMII : PHY_INTERFACE_MODE_SGMII;
566
567 dev_dbg(mac_cb->dev, "mac_id=%d, phy_if=%d\n", mac_cb->mac_id, phy_if);
568
569 ACPI_FREE(obj);
570
571 return phy_if;
572 }
573
574 static int hns_mac_get_sfp_prsnt(struct hns_mac_cb *mac_cb, int *sfp_prsnt)
575 {
576 u32 val = 0;
577 int ret;
578
579 if (!mac_cb->cpld_ctrl)
580 return -ENODEV;
581
582 ret = dsaf_read_syscon(mac_cb->cpld_ctrl,
583 mac_cb->cpld_ctrl_reg + MAC_SFP_PORT_OFFSET,
584 &val);
585 if (ret)
586 return ret;
587
588 *sfp_prsnt = !val;
589 return 0;
590 }
591
592 static int hns_mac_get_sfp_prsnt_acpi(struct hns_mac_cb *mac_cb, int *sfp_prsnt)
593 {
594 union acpi_object *obj;
595 union acpi_object obj_args, argv4;
596
597 obj_args.integer.type = ACPI_TYPE_INTEGER;
598 obj_args.integer.value = mac_cb->mac_id;
599
600 argv4.type = ACPI_TYPE_PACKAGE;
601 argv4.package.count = 1;
602 argv4.package.elements = &obj_args;
603
> 604 obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
605 &hns_dsaf_acpi_dsm_guid, 0,
606 HNS_OP_GET_SFP_STAT_FUNC, &argv4,
607 ACPI_TYPE_INTEGER);
608 if (!obj)
609 return -ENODEV;
610
611 *sfp_prsnt = obj->integer.value;
612
613 ACPI_FREE(obj);
614
615 return 0;
616 }
617

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


Attachments:
(No filename) (5.73 kB)
config (284.36 kB)
Download all attachments

2023-01-18 18:47:25

by Tony Nguyen

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] net: hns: Switch to use acpi_evaluate_dsm_typed()

On 1/18/2023 1:29 AM, Andy Shevchenko wrote:
> The acpi_evaluate_dsm_typed() provides a way to check the type of the
> object evaluated by _DSM call. Use it instead of open coded variant.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
> ---
> .../net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)

LGTM

Reviewed-by: Tony Nguyen <[email protected]

2023-01-18 19:49:38

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] net: hns: Switch to use acpi_evaluate_dsm_typed()

On Wed, Jan 18, 2023 at 10:15:11AM -0800, Tony Nguyen wrote:
> On 1/18/2023 1:29 AM, Andy Shevchenko wrote:
> > The acpi_evaluate_dsm_typed() provides a way to check the type of the
> > object evaluated by _DSM call. Use it instead of open coded variant.
>
> LGTM
>
> Reviewed-by: Tony Nguyen <[email protected]

Thanks, but it needs a bit more work, I missed something.
So, I'll add tag into v2.

--
With Best Regards,
Andy Shevchenko