diff mbox series

[v1,1/1] net: hns: Switch to use acpi_evaluate_dsm_typed()

Message ID 20230118092922.39426-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v1,1/1] net: hns: Switch to use acpi_evaluate_dsm_typed() | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 0 this patch: 9
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang fail Errors and warnings before: 0 this patch: 10
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 0 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Andy Shevchenko Jan. 18, 2023, 9:29 a.m. UTC
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 <andriy.shevchenko@linux.intel.com>
---
 .../net/ethernet/hisilicon/hns/hns_dsaf_misc.c   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

kernel test robot Jan. 18, 2023, 12:19 p.m. UTC | #1
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 <lkp@intel.com>

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
Tony Nguyen Jan. 18, 2023, 6:15 p.m. UTC | #2
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 <andriy.shevchenko@linux.intel.com>
> ---
>   .../net/ethernet/hisilicon/hns/hns_dsaf_misc.c   | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)

LGTM

Reviewed-by: Tony Nguyen <anthony.l.nguyen@intel.com
Andy Shevchenko Jan. 18, 2023, 7:33 p.m. UTC | #3
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 <anthony.l.nguyen@intel.com

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

Patch

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;