From patchwork Thu Jan 19 19:11:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13108688 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB690C004D4 for ; Thu, 19 Jan 2023 19:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231417AbjASTQq (ORCPT ); Thu, 19 Jan 2023 14:16:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbjASTQ1 (ORCPT ); Thu, 19 Jan 2023 14:16:27 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 040E1966D9; Thu, 19 Jan 2023 11:15:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674155719; x=1705691719; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=1HuuDaAUhECpauFK3xburRU6vWUT+DOtnKE7jETeHAQ=; b=ZV6t7T8MlkwDjgteF7KLqFnNXOAgWnwoWKr0Axhu1OerFC3VSkljc2Q8 pfYs0DrZdrlTLN+mCu6i4bVNkiVm5QFZ9jqiL6Wd2JaQLyEYowgs1Sp1j IZKfKmjiOVDidExiCB18WfN4aRcp1BtAFEKIz9JwfyZANzxmDzCS+4HFc jeaUS2BPxsEfoADWUPmZxKY/AUKZ08uUBx+osnzqBcamVrHcuq5j8qC95 i4/AF0YQreQRl/uY9FipU+Yqqu1M5QpOKV3pSAXJnTQ7qbd7o2seiXrBb 4XBmNt1YQ2nF/tEWm7fCQUaPSTPmlcc/t6vWdSTVUL1RwURIsMDhK9eId Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="324078044" X-IronPort-AV: E=Sophos;i="5.97,229,1669104000"; d="scan'208";a="324078044" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2023 11:10:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="802752086" X-IronPort-AV: E=Sophos;i="5.97,229,1669104000"; d="scan'208";a="802752086" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 19 Jan 2023 11:10:28 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 49936368; Thu, 19 Jan 2023 21:11:03 +0200 (EET) From: Andy Shevchenko To: Tony Nguyen , Andy Shevchenko , "Rafael J. Wysocki" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Rafael J. Wysocki" , Len Brown , kernel test robot Subject: [PATCH net-next v2 1/2] ACPI: utils: Add acpi_evaluate_dsm_typed() and acpi_check_dsm() stubs Date: Thu, 19 Jan 2023 21:11:00 +0200 Message-Id: <20230119191101.80131-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Signed-off-by: Andy Shevchenko --- 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) { From patchwork Thu Jan 19 19:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13109144 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22F09C38159 for ; Fri, 20 Jan 2023 05:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231248AbjATE7u (ORCPT ); Thu, 19 Jan 2023 23:59:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbjATE7g (ORCPT ); Thu, 19 Jan 2023 23:59:36 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B53BED05EE; Thu, 19 Jan 2023 20:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674190079; x=1705726079; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E98QGbc8dlCtreJMfmIlTfn2lZ42kDRmuNfuyIyYYMg=; b=jjyFhL55I2x8bWRNfQ3IImS98aao5Khj9QMvYOuVf3SLe57yyCJRhoYI +rRilMz0XGGkdCjMKVEwI4O/FNZhyAcoh2D9JIx/ZSGOkyotHrb1TJXmH gEUZAfP5kudBd66ye6pOTdSrt/hdOtJHbZnVhjf+sA7cHFLN4celEEGWx rHoSOR0du3kcz27xKqI1E8SWqGmmgv6QsFe5W5j6EGEXIOWt02nO8IuAK 8Y0WHq7X07Zlb1w4L63VwBZvPjoK8CzzBOuXUMKbx8saBEvF8R4kEo+J4 9bSRxGUDFuabAHOSc9Th1omcoGeMPJ4VvAA9ADdB8W9RXHRo698Bu2NeZ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="308970218" X-IronPort-AV: E=Sophos;i="5.97,229,1669104000"; d="scan'208";a="308970218" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2023 11:10:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="728816425" X-IronPort-AV: E=Sophos;i="5.97,229,1669104000"; d="scan'208";a="728816425" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 19 Jan 2023 11:10:28 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 529D292; Thu, 19 Jan 2023 21:11:03 +0200 (EET) From: Andy Shevchenko To: Tony Nguyen , Andy Shevchenko , "Rafael J. Wysocki" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Rafael J. Wysocki" , Len Brown Subject: [PATCH net-next v2 2/2] net: hns: Switch to use acpi_evaluate_dsm_typed() Date: Thu, 19 Jan 2023 21:11:01 +0200 Message-Id: <20230119191101.80131-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119191101.80131-1-andriy.shevchenko@linux.intel.com> References: <20230119191101.80131-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Reviewed-by: Tony Nguyen --- 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;