From patchwork Mon Jun 26 11:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 112854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7395336vqr; Mon, 26 Jun 2023 04:05:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5I7m4ZVXKa+F347cbLTwUeaKG3iVhI11jI4P8Lt1COo1Y0Y18VnLxyQSXgD5fodYeFSlhx X-Received: by 2002:a05:6402:494:b0:51b:dfb7:8200 with SMTP id k20-20020a056402049400b0051bdfb78200mr11107041edv.0.1687777533558; Mon, 26 Jun 2023 04:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687777533; cv=none; d=google.com; s=arc-20160816; b=Gi2cw4yaTSuXGRRsi/ErKMaqmrPjGbVgFkErtjsJrQeJuLKRzgjGPGagI2ewy96pLP BoLdxecZKTQvQcbZY+l6QuWbOGKdSi7GIEt6zWUZ0uMJWUcaFIJpKV02oaYbDXONhkLP v3ocsjOyOsO4BEvlEktLyLtM1AjuJR46lyroNCf76ALN6+VOnqHoxMvpC2Hg/HgvyYPx ysdSbyVKfkzl93QhaUZ0jZm2IxN4IymESYPhGN7MBcUUk5UZ1dAeGZgSslLqhVYYDC+w j3DbcPADCIteB6HesvTJJK6vt+RC3tU8FQCPoCUKB2dskze0IUKRZqHfK0Jv1UBbUfgI apgg== 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=zlrwwhYEvkjxWvwPlTkLoA/QEUXhfaFllqa9lvtPrjw=; fh=YLPw3QnAgtYwSsGR7bXzDTb3Qi4Z0gTtWmJMk1JxRoE=; b=DLY3O9qlG6oCn89nRPNHvBqb/okseNebM0f/m3Q2ZF1/w6YkhqlSZh6QFxMSgGEWPO zzSpaB6N4dPswOz3KZAI5eXHR1ViMXve4FAY6L/G8nhAYmsSqUbNVB3973d2C7Vd2fR0 D7VZnKTReegIxOcXSZw9emG/2GNbRc5EvZ8nZiA8fe34waU58WU7DppTjRbJycahKqwx 5+mK6XkLwEVA543GH+m/33zbadboWgnWGqcswE9WwRHOik5qajNeivknC8V3dbiNTcC1 Uq2oZ34wdScU8+BGRnhRQd4PwOQUu6On87Fc0ByCv1nOtAk5awQbA9Mn+HUqkrXD7NWN sR1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S2iGQ3P3; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u24-20020aa7d898000000b0051d91692643si1838773edq.536.2023.06.26.04.05.08; Mon, 26 Jun 2023 04:05:33 -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=@intel.com header.s=Intel header.b=S2iGQ3P3; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbjFZLBG (ORCPT + 99 others); Mon, 26 Jun 2023 07:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230240AbjFZLAx (ORCPT ); Mon, 26 Jun 2023 07:00:53 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79B2710EA; Mon, 26 Jun 2023 04:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687777231; x=1719313231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bhqeMcnIeLHiERhCVntd9eCy5M/ovDNlECDlMUUEH0Y=; b=S2iGQ3P3BXTyJWs8HIfWm1qP/Ayu9NZtY2sh3+b5v8J+nSud43Nrsyxn MOtnosfOKKtJihjK5dmG4sz0se3UpNmVWeXpDOkLE3gQXRROFpDFnDJtU 0SDUP08kgUYRjVKJOr/4AO0L195feEADnc/bjyDd7hyR3r8kQVHa649dW 2LoeA67zqs3yYQl4INZUmu6QEdfItHiXb2180sGuVnJN4Q8sDH9dZa/8M D03Q5xznXF/3zs1FVUqtKVPcm7fXeV4WBSrAR85sVOUCxc6egu4ZFwTA/ VmcF8vGmR/SKSH/V6B535yxLcVbL4zUaAWZNIYF2VSJBU8Z6Zfv1xz1vV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="351010844" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="351010844" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 04:00:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="781391001" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="781391001" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 26 Jun 2023 04:00:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id F0E3378; Mon, 26 Jun 2023 14:00:27 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, acpica-devel@lists.linuxfoundation.org Cc: "Rafael J. Wysocki" , Len Brown , Andi Shyti , Robert Moore , Michael Walle Subject: [PATCH v3 1/4] ACPI: bus: Constify acpi_companion_match() returned value Date: Mon, 26 Jun 2023 14:00:23 +0300 Message-Id: <20230626110026.65825-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230626110026.65825-1-andriy.shevchenko@linux.intel.com> References: <20230626110026.65825-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769763015184102365?= X-GMAIL-MSGID: =?utf-8?q?1769763015184102365?= acpi_companion_match() doesn't alter the contents of the passed parameter, so we don't expect that returned value can be altered either. So constify it. Signed-off-by: Andy Shevchenko Reviewed-by: Andi Shyti --- drivers/acpi/bus.c | 6 +++--- drivers/acpi/device_sysfs.c | 2 +- drivers/acpi/internal.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index e3e0bd0c5a50..20cdfb37da79 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -682,7 +682,7 @@ bool acpi_device_is_first_physical_node(struct acpi_device *adev, * resources available from it but they will be matched normally using functions * provided by their bus types (and analogously for their modalias). */ -struct acpi_device *acpi_companion_match(const struct device *dev) +const struct acpi_device *acpi_companion_match(const struct device *dev) { struct acpi_device *adev; @@ -706,7 +706,7 @@ struct acpi_device *acpi_companion_match(const struct device *dev) * identifiers and a _DSD object with the "compatible" property, use that * property to match against the given list of identifiers. */ -static bool acpi_of_match_device(struct acpi_device *adev, +static bool acpi_of_match_device(const struct acpi_device *adev, const struct of_device_id *of_match_table, const struct of_device_id **of_id) { @@ -808,7 +808,7 @@ static bool __acpi_match_device_cls(const struct acpi_device_id *id, return true; } -static bool __acpi_match_device(struct acpi_device *device, +static bool __acpi_match_device(const struct acpi_device *device, const struct acpi_device_id *acpi_ids, const struct of_device_id *of_ids, const struct acpi_device_id **acpi_id, diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c index 0fbfbaa8d8e3..b9bbf0746199 100644 --- a/drivers/acpi/device_sysfs.c +++ b/drivers/acpi/device_sysfs.c @@ -283,7 +283,7 @@ int acpi_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env } EXPORT_SYMBOL_GPL(acpi_device_uevent_modalias); -static int __acpi_device_modalias(struct acpi_device *adev, char *buf, int size) +static int __acpi_device_modalias(const struct acpi_device *adev, char *buf, int size) { int len, count; diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 50dcb35c9965..f4148dc50b9c 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -121,7 +121,7 @@ int acpi_bus_register_early_device(int type); /* -------------------------------------------------------------------------- Device Matching and Notification -------------------------------------------------------------------------- */ -struct acpi_device *acpi_companion_match(const struct device *dev); +const struct acpi_device *acpi_companion_match(const struct device *dev); int __acpi_device_uevent_modalias(const struct acpi_device *adev, struct kobj_uevent_env *env); From patchwork Mon Jun 26 11:00:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 112864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7404718vqr; Mon, 26 Jun 2023 04:22:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4DjI4FU9pe2X3Lne4YmDnAtiXuBrCRPiR8cmkVBLQ1XlgEWeMkSNTNsF/vCQK6K5H6cqH7 X-Received: by 2002:a17:902:d489:b0:1b7:e49f:d with SMTP id c9-20020a170902d48900b001b7e49f000dmr6786902plg.28.1687778520932; Mon, 26 Jun 2023 04:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687778520; cv=none; d=google.com; s=arc-20160816; b=P1PJ3/zNoFOXQ+XKEv6T7fEIOySltaInqCqiVPpwNIQqHn/RLm0+2ru7QwFVpz25mZ E9sgr6jGxFV1uhIohOmW+bISLsX/w1ANxwINpPUBEv4B4MulnZLoB0bFOeoKlYeWhWib rSTJ9Xe5ztwOn94Rb4OPkP3iaTacwqOXuDi0Pd1N903TjOFHLA4ehxZqx9AiWXA+zrb2 Ds6rdMpj8RdlrBxRvIdOjTDGvi/JfB7+RY1G9KDsvyt9Qn/iFv77TC5/q824QezBPHHH c3W7n6XJ6XvvZ9HHLLCcgxrDJbibUHQz+0PbujA8oZJ0N2pA4MFBDtHAN9jzlQqua5QE IzRQ== 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=nNkoZ4evSnDmcjWcTDU7LcxZRi5iH7M+CYC+6Jli+cM=; fh=YLPw3QnAgtYwSsGR7bXzDTb3Qi4Z0gTtWmJMk1JxRoE=; b=XuaVx8qajnbby8yQ2aWt+TvQxruZKWuj5NdZV3lIOGWfwD5Z3FvQzEywYMgmVcxRdi yQNjV9KQ8tJuyBZSmfekqrbSBic0PjF59rRO+UauHp/VfzIWRRj/e+JtAnmPaqKVO1tH uFQeuiQ/Oc4QEykj9ez4p47R3v+g3NsZq5cB5+uR3/0C3HVFRJsHPnjXMyh+yuLFMIDC cWkxxLKqJXl+vnlTX3RvTeSu91CvraMPHbak7EHwiqp+FXUv8h/awBOR6D3A/jYCtg1P ARGffBWVESiXqOev5tUSBjmvYFCMIsaQ2/caFowoXy6N5hNVgYjQrHdhO6owyZz/2t7p OtpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F3BZxFX6; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a17090332c600b001b802129b44si1994337plr.556.2023.06.26.04.21.48; Mon, 26 Jun 2023 04:22:00 -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=@intel.com header.s=Intel header.b=F3BZxFX6; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbjFZLAk (ORCPT + 99 others); Mon, 26 Jun 2023 07:00:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjFZLAc (ORCPT ); Mon, 26 Jun 2023 07:00:32 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BFC510DB; Mon, 26 Jun 2023 04:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687777221; x=1719313221; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cfkHmvhL16siboX9Cx9flRIYjtdn8/awF8GL0BpfHpU=; b=F3BZxFX6bPium+iZbkUPTbppIqKQW0/tgWrG28seB+980y/XOvOPbhtQ XgPNyVBi5djSbzEqWMp2r+JrbbxsXAaaCjPyNfKktp8D5qMhM4iVOP1h8 FbEKvvgVUGBnYJub+9XrgUS7Xkbpjy/wHkVwdiS0QhZFYbBQkyLk+pxgz B0jae98e1/CjMxb3d9VZkUn2UGD1tsV5OFJcXfxzG4HF/h1mmnaZpnszz KSrNrPBxb+Lo4zt14haJYCzckHcyFHp9CT5HGcp3BuL9zc0n6dGsJkZWl iZplQUeTBkt0vlZxzcFhDf5HSCyBAJrc4vnchvpADwG4bZ/l1YmjsquIN g==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="427232827" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="427232827" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 04:00:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="890245264" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="890245264" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 26 Jun 2023 04:00:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0C220370; Mon, 26 Jun 2023 14:00:28 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, acpica-devel@lists.linuxfoundation.org Cc: "Rafael J. Wysocki" , Len Brown , Andi Shyti , Robert Moore , Michael Walle Subject: [PATCH v3 2/4] ACPI: bus: Introduce acpi_match_acpi_device() helper Date: Mon, 26 Jun 2023 14:00:24 +0300 Message-Id: <20230626110026.65825-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230626110026.65825-1-andriy.shevchenko@linux.intel.com> References: <20230626110026.65825-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769764050451507873?= X-GMAIL-MSGID: =?utf-8?q?1769764050451507873?= In some cases we can't have a physical node associated with the ACPI device. Yet we want to match it against ID table and get respective driver data. Introduce the helper for that. Signed-off-by: Andy Shevchenko --- drivers/acpi/bus.c | 15 +++++++++++---- include/linux/acpi.h | 9 +++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 20cdfb37da79..ee88bfb60ac2 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -850,6 +850,16 @@ static bool __acpi_match_device(const struct acpi_device *device, return true; } +const struct acpi_device_id *acpi_match_acpi_device(const struct acpi_device_id *ids, + const struct acpi_device *adev) +{ + const struct acpi_device_id *id = NULL; + + __acpi_match_device(adev, ids, NULL, &id, NULL); + return id; +} +EXPORT_SYMBOL_GPL(acpi_match_acpi_device); + /** * acpi_match_device - Match a struct device against a given list of ACPI IDs * @ids: Array of struct acpi_device_id object to match against. @@ -864,10 +874,7 @@ static bool __acpi_match_device(const struct acpi_device *device, const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct device *dev) { - const struct acpi_device_id *id = NULL; - - __acpi_match_device(acpi_companion_match(dev), ids, NULL, &id, NULL); - return id; + return acpi_match_acpi_device(ids, acpi_companion_match(dev)); } EXPORT_SYMBOL_GPL(acpi_match_device); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 640f1c07c894..641dc4843987 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -707,6 +707,9 @@ extern int acpi_nvs_register(__u64 start, __u64 size); extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), void *data); +const struct acpi_device_id *acpi_match_acpi_device(const struct acpi_device_id *ids, + const struct acpi_device *adev); + const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct device *dev); @@ -922,6 +925,12 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), struct acpi_device_id; +static inline const struct acpi_device_id *acpi_match_acpi_device( + const struct acpi_device_id *ids, const struct acpi_device *adev) +{ + return NULL; +} + static inline const struct acpi_device_id *acpi_match_device( const struct acpi_device_id *ids, const struct device *dev) { From patchwork Mon Jun 26 11:00:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 112863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7404656vqr; Mon, 26 Jun 2023 04:21:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6TT9m659lb5K9WC+1y9m2kDWQDxFNOnmEGi5VgbBdo76lxataiK3x2OEkRtCu2Zx+SERCT X-Received: by 2002:a17:902:bcc3:b0:1b0:307c:e6fe with SMTP id o3-20020a170902bcc300b001b0307ce6femr2703315pls.10.1687778513869; Mon, 26 Jun 2023 04:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687778513; cv=none; d=google.com; s=arc-20160816; b=r+/H050UJq5uZiifeqLJIFI9ANaazs0AI7DTP+blT3/JEuQXidH/0+1f5egXGrCAIh u+PdjmCmoxhYU8o0EnOWY9DESjRX26MRTF5VjgJyBfl8zK5XzaCKtJWoG11Uhq371wqG sKfwwOrZjNFuRayYCrZxg/n4hdvF5uzeVFjnAcdx9KGtJ/0kdFIgGVy0iFqOV6xPUcSu jjhksOxO8JhAfv/T7HZOl+xDXOvvdLugvyrnWJ0N7mQBVPmLoFfUucZ9Msv7WMyZ1lct OsovtkPfq+jY3dvm6+EDGYjK51qZYOIhKWDtc6ogk5IPNL1uxUWeR594O4jw0Fs9YzCb 8brQ== 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=mVNd5RSttIakJYXut5jovi/udF8XEDuWaj9JY0PmWaU=; fh=YLPw3QnAgtYwSsGR7bXzDTb3Qi4Z0gTtWmJMk1JxRoE=; b=IqZmxPvkDR4L8Y2UN/RYQBT1z22MUPmH/Cgz0+BgAY86bhjL2b5fnE3J+qvzJPEHnj 05+FzGJ2eQz0wPNNU0owKtgI37qRHwlqYJ3D8G6IG8xVfmyRmbcKhX3ouHYLJ83LwHfP F3dPiwRsOahG/tnaAVOWjpEkxZmV5iystv1RCaAV+X39c+mY5slXxD5+gUbnThog5Fhs XpNNqvL1P2g0c1DNHfCtRx0PCiI3JhjHlt0B1k6wb9UMZFdtsxnOxdt7ee5vUa7fpFgr TF3HqYy2URwrzhjAyEJUBQPeYgE1p0ZpqvNv/8wSmBczPEBqPs5FNI/KCyTz7ZyWvZaa UArA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gRlKcgY6; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a170902b40900b001b7def0fb5esi4110124plr.652.2023.06.26.04.21.41; Mon, 26 Jun 2023 04:21: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=@intel.com header.s=Intel header.b=gRlKcgY6; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230016AbjFZLAe (ORCPT + 99 others); Mon, 26 Jun 2023 07:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjFZLAb (ORCPT ); Mon, 26 Jun 2023 07:00:31 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91CFC8F; Mon, 26 Jun 2023 04:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687777221; x=1719313221; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hFZZA3JYAHFku7FNJhgT27T5vrlPbdtdbu9UvmFVRsk=; b=gRlKcgY6AWYcUVsNq69wWk2ezRV+/J5MOBdvg4k8FfbSDnC/p8u09ANf MhqRaqzDut1wUrmVpkKe1+JmUGDGE21M1HtTjw0EYoSP3MvR3xal7o5o6 H1Wb0Ct++iV6lA1pAqKQi5Xr2/3BujIy4Y8CgdYJB4wGVl4+oMMnYLSuj VVV650VQ0pbwLyLVGbrbWir8NboOhyRNz2dD8whkfEK6BR8HmI5j4EiYP M1cLn5pLOH3EZYq1Bk0w3kLm53BsV9hnSeeT2e7el7t+ZjHJ3CDByQSju egtGwFkAYDiBzmqYSbtPfyhabZNwhW2RA8aC+TM0xz6xag/BGCPYr0rsk Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="351010833" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="351010833" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 04:00:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="781390995" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="781390995" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 26 Jun 2023 04:00:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 11BFB16E; Mon, 26 Jun 2023 14:00:28 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, acpica-devel@lists.linuxfoundation.org Cc: "Rafael J. Wysocki" , Len Brown , Andi Shyti , Robert Moore , Michael Walle Subject: [PATCH v3 3/4] ACPI: platform: Ignore SMB0001 only when it has resources Date: Mon, 26 Jun 2023 14:00:25 +0300 Message-Id: <20230626110026.65825-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230626110026.65825-1-andriy.shevchenko@linux.intel.com> References: <20230626110026.65825-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769764042545684174?= X-GMAIL-MSGID: =?utf-8?q?1769764042545684174?= After switching i2c-scmi driver to be a platform one, it stopped being enumerated on number of Kontron platforms, because it's listed in the forbidden_id_list. To resolve the situation, add a flag to driver data to allow devices with no resources in _CRS to be enumerated via platform bus. Fixes: 03d4287add6e ("i2c: scmi: Convert to be a platform driver") Closes: https://lore.kernel.org/r/60c1756765b9a3f1eab0dcbd84f59f00fe1caf48.camel@kontron.com Link: https://lore.kernel.org/r/20230621151652.79579-1-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko Reviewed-by: Andi Shyti --- drivers/acpi/acpi_platform.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index fe00a5783f53..ee6ea1ee8396 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -19,13 +20,16 @@ #include "internal.h" +/* Exclude devices that have no _CRS resources provided */ +#define ACPI_ALLOW_WO_RESOURCES BIT(0) + static const struct acpi_device_id forbidden_id_list[] = { {"ACPI0009", 0}, /* IOxAPIC */ {"ACPI000A", 0}, /* IOAPIC */ {"PNP0000", 0}, /* PIC */ {"PNP0100", 0}, /* Timer */ {"PNP0200", 0}, /* AT DMA Controller */ - {"SMB0001", 0}, /* ACPI SMBUS virtual device */ + {"SMB0001", ACPI_ALLOW_WO_RESOURCES}, /* ACPI SMBUS virtual device */ { } }; @@ -83,6 +87,15 @@ static void acpi_platform_fill_resource(struct acpi_device *adev, dest->parent = pci_find_resource(to_pci_dev(parent), dest); } +static unsigned int acpi_platform_resource_count(struct acpi_resource *ares, void *data) +{ + int *count = data; + + (*count)++; + + return AE_OK; +} + /** * acpi_create_platform_device - Create platform device for ACPI device node * @adev: ACPI device node to create a platform device for. @@ -100,17 +113,27 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, struct acpi_device *parent = acpi_dev_parent(adev); struct platform_device *pdev = NULL; struct platform_device_info pdevinfo; + const struct acpi_device_id *match; struct resource_entry *rentry; struct list_head resource_list; struct resource *resources = NULL; - int count; + int count = 0; /* If the ACPI node already has a physical device attached, skip it. */ if (adev->physical_node_count) return NULL; - if (!acpi_match_device_ids(adev, forbidden_id_list)) - return ERR_PTR(-EINVAL); + match = acpi_match_acpi_device(forbidden_id_list, adev); + if (match) { + if (match->driver_data & ACPI_ALLOW_WO_RESOURCES) { + acpi_walk_resources(adev->handle, METHOD_NAME__CRS, + acpi_platform_resource_count, &count); + if (count > 0) + return ERR_PTR(-EINVAL); + } else { + return ERR_PTR(-EINVAL); + } + } INIT_LIST_HEAD(&resource_list); count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); From patchwork Mon Jun 26 11:00:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 112873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7406161vqr; Mon, 26 Jun 2023 04:24:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DHgAG+i+RWQ/iEvpd6535u1yUEkkQHqMaVG01LRuaL288bsimw/EGop8d3J/R30HgkcIv X-Received: by 2002:a05:6a00:1813:b0:67a:39c4:5bb5 with SMTP id y19-20020a056a00181300b0067a39c45bb5mr825089pfa.6.1687778687747; Mon, 26 Jun 2023 04:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687778687; cv=none; d=google.com; s=arc-20160816; b=FfXTWQyxiXXtrZqmI2i18waj1oM+CNMgGXvxNBfcDF6iqwPh3WiEuPvsxAIi7JAU5B jn2zFBFNQcVwrykNuY2ytWQWMRhK4UDARZQnLCMj3M5MVV5PpMy4aMfsGEM1bTtG4yPt lQUyTZ/SmUsuJbj7F9RElNWb5eNr7PPnkDSNe4O1/Fm3n5Elfjsx4Su4nX2LNGR6BPq3 cHl/4cBaoYxnRIfvxyvRRaLTsyL/WoZVDVWLU7i7U6kXDpyhYFwHHYRQ3AwEo5XWphJW HqR3yVlsO6jLFstAzs6CcCdYoFMnqUd/eBohCu1ALHBbJY3DIbBegkTpHu2DAwt1Gsnc vLcQ== 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=I7RySnsK1Y9xb2hYSeBKogQ0Ma8mCNGJUKGVZkBG344=; fh=muUHOruoGZ0aHBj3pyWyNylPmopE9jWnRNDTM0zk9yI=; b=RllBAKWQuDhn21LK6UOn4rFuPqGImjvvFtIYyTbpRPA2upeB5klXy5lKO6sDbjFQcO jF1NFYHNFsfcQ706pkvcelPy5Oyg5PpIet1mdAqWjwH6BeXzDVyqEEzt8nv2e7zrQmQ+ Dj2mP2pf9+wtSnFlAP/nVU3KDPjP2WRJH1RBk47IWR6/P2G5T1rnVzCZY23gbQJCNY/R 8d4dMqfamqghAWu+Tm/hYgG/5HTRY09EXWOrJ3HvOxy+jBAmNuBVAinz/51WWFy9Iw/C iapwmih3sfk3sGBdZu4C3kyp+0s5S5Q/Wl0QKZ8ggBvVfobyUawyJBGjQJx7izzun4tb Oi7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=T3Gjqx5U; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dc9-20020a056a0035c900b0065b4e2b52c6si4777137pfb.341.2023.06.26.04.24.35; Mon, 26 Jun 2023 04:24:47 -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=@intel.com header.s=Intel header.b=T3Gjqx5U; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230318AbjFZLBN (ORCPT + 99 others); Mon, 26 Jun 2023 07:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230179AbjFZLA4 (ORCPT ); Mon, 26 Jun 2023 07:00:56 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB4E10E3; Mon, 26 Jun 2023 04:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687777232; x=1719313232; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3rGTuC6EzT1y4/NFfh1f8kAmEt17Iyu5dJ9EEp6czsA=; b=T3Gjqx5U2KQYfr9Bcfanano/QKH5x/jDQTL3DFpieRikut0VyobBDNC9 cbHcLwZF2X3TPsMyZpXIvZ5nySOgpGiqmNiFTpYAbbc/sc///TPCXNEGX fgmd4VPuVBEEQRC5WVDoKeJXiazrWWRT7o23L8mesMGIhQF9wiS45Ad85 wls3wKBolsh10xhYyP2Wzs/eVN3AvB1UZ9D6vBACNInAm+A89fjyZNlZi EDMfwVgawEwhZcsapmQ7eCf+ABN4qZu6Idz7TzvfYLuJRzaY1T7W3ru67 4uIMXluqPC2WHS4ePBKY8B8M4Xw9ciznKsKvS8TdUw8kkhkIHRnTAhBe/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="427232832" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="427232832" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 04:00:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="890245272" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="890245272" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 26 Jun 2023 04:00:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1B73F374; Mon, 26 Jun 2023 14:00:28 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, acpica-devel@lists.linuxfoundation.org Cc: "Rafael J. Wysocki" , Len Brown , Andi Shyti , Robert Moore , Michael Walle , Wolfram Sang Subject: [PATCH v3 4/4] ACPI: platform: Move SMB0001 HID to the header and reuse Date: Mon, 26 Jun 2023 14:00:26 +0300 Message-Id: <20230626110026.65825-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230626110026.65825-1-andriy.shevchenko@linux.intel.com> References: <20230626110026.65825-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769764225469519531?= X-GMAIL-MSGID: =?utf-8?q?1769764225469519531?= There are at least two places in the kernel that are using the SMB0001 HID. Make it to be available via acpi_drivers.h header file. While at it, replace hard coded one with a definition. Reviewed-by: Andi Shyti Acked-by: Wolfram Sang # for I2C Link: https://lore.kernel.org/r/20230621151652.79579-2-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko --- drivers/acpi/acpi_platform.c | 2 +- drivers/i2c/busses/i2c-scmi.c | 3 --- include/acpi/acpi_drivers.h | 2 ++ 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index ee6ea1ee8396..b5e32257fa3e 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -29,7 +29,7 @@ static const struct acpi_device_id forbidden_id_list[] = { {"PNP0000", 0}, /* PIC */ {"PNP0100", 0}, /* Timer */ {"PNP0200", 0}, /* AT DMA Controller */ - {"SMB0001", ACPI_ALLOW_WO_RESOURCES}, /* ACPI SMBUS virtual device */ + {ACPI_SMBUS_MS_HID, ACPI_ALLOW_WO_RESOURCES}, /* ACPI SMBUS virtual device */ { } }; diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c index 104570292241..421735acfa14 100644 --- a/drivers/i2c/busses/i2c-scmi.c +++ b/drivers/i2c/busses/i2c-scmi.c @@ -13,9 +13,6 @@ #include #include -/* SMBUS HID definition as supported by Microsoft Windows */ -#define ACPI_SMBUS_MS_HID "SMB0001" - struct smbus_methods_t { char *mt_info; char *mt_sbr; diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index 8372b0e7fd15..b14d165632e7 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -27,6 +27,8 @@ #define ACPI_BAY_HID "LNXIOBAY" #define ACPI_DOCK_HID "LNXDOCK" #define ACPI_ECDT_HID "LNXEC" +/* SMBUS HID definition as supported by Microsoft Windows */ +#define ACPI_SMBUS_MS_HID "SMB0001" /* Quirk for broken IBM BIOSes */ #define ACPI_SMBUS_IBM_HID "SMBUSIBM"