netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs
@ 2023-01-19 19:11 Andy Shevchenko
  2023-01-19 19:11 ` [PATCH net-next v2 2/2] net: hns: Switch to use acpi_evaluate_dsm_typed() Andy Shevchenko
  2023-01-20 13:30 ` [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-01-19 19:11 UTC (permalink / raw)
  To: Tony Nguyen, Andy Shevchenko, Rafael J. Wysocki, netdev,
	linux-kernel, linux-acpi
  Cc: Yisen Zhuang, Salil Mehta, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rafael J. Wysocki, Len Brown,
	kernel test robot

When the ACPI part of a driver is optional the methods used in it
are expected to be available even if CONFIG_ACPI=n. This is not
the case for _DSM related methods. Add stubs for
acpi_evaluate_dsm_typed() and acpi_check_dsm() methods.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch to prevent compilation failures (LKP)
 include/linux/acpi.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 5e6a876e17ba..4b12dad5a8a4 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -950,6 +950,12 @@ static inline bool acpi_driver_match_device(struct device *dev,
 	return false;
 }
 
+static inline bool acpi_check_dsm(acpi_handle handle, const guid_t *guid,
+				  u64 rev, u64 funcs)
+{
+	return false;
+}
+
 static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
 						   const guid_t *guid,
 						   u64 rev, u64 func,
@@ -958,6 +964,15 @@ static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
 	return NULL;
 }
 
+static inline union acpi_object *acpi_evaluate_dsm_typed(acpi_handle handle,
+							 const guid_t *guid,
+							 u64 rev, u64 func,
+							 union acpi_object *argv4,
+							 acpi_object_type type)
+{
+	return NULL;
+}
+
 static inline int acpi_device_uevent_modalias(struct device *dev,
 				struct kobj_uevent_env *env)
 {
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH net-next v2 2/2] net: hns: Switch to use acpi_evaluate_dsm_typed()
  2023-01-19 19:11 [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs Andy Shevchenko
@ 2023-01-19 19:11 ` Andy Shevchenko
  2023-01-20 13:30 ` [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-01-19 19:11 UTC (permalink / raw)
  To: Tony Nguyen, Andy Shevchenko, Rafael J. Wysocki, netdev,
	linux-kernel, linux-acpi
  Cc: Yisen Zhuang, Salil Mehta, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rafael J. Wysocki, Len Brown

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>
Reviewed-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
v2: added tag (Tony), fixed compilation errors (LKP)
 .../ethernet/hisilicon/hns/hns_dsaf_misc.c    | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 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..5df19c604d09 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 ?
@@ -601,11 +601,11 @@ static int hns_mac_get_sfp_prsnt_acpi(struct hns_mac_cb *mac_cb, int *sfp_prsnt)
 	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_SFP_STAT_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_SFP_STAT_FUNC, &argv4,
+				      ACPI_TYPE_INTEGER);
+	if (!obj)
 		return -ENODEV;
 
 	*sfp_prsnt = obj->integer.value;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs
  2023-01-19 19:11 [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs Andy Shevchenko
  2023-01-19 19:11 ` [PATCH net-next v2 2/2] net: hns: Switch to use acpi_evaluate_dsm_typed() Andy Shevchenko
@ 2023-01-20 13:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-20 13:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: anthony.l.nguyen, rafael.j.wysocki, netdev, linux-kernel,
	linux-acpi, yisen.zhuang, salil.mehta, davem, edumazet, kuba,
	pabeni, rafael, lenb, lkp

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 19 Jan 2023 21:11:00 +0200 you wrote:
> When the ACPI part of a driver is optional the methods used in it
> are expected to be available even if CONFIG_ACPI=n. This is not
> the case for _DSM related methods. Add stubs for
> acpi_evaluate_dsm_typed() and acpi_check_dsm() methods.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs
    https://git.kernel.org/netdev/net-next/c/1b94ad7ccc21
  - [net-next,v2,2/2] net: hns: Switch to use acpi_evaluate_dsm_typed()
    https://git.kernel.org/netdev/net-next/c/498fe8101112

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-20 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-19 19:11 [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs Andy Shevchenko
2023-01-19 19:11 ` [PATCH net-next v2 2/2] net: hns: Switch to use acpi_evaluate_dsm_typed() Andy Shevchenko
2023-01-20 13:30 ` [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).