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: 1799792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=S2iGQ3P3; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4QqPz31xCJz20b7 for ; Mon, 26 Jun 2023 21:01:03 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230223AbjFZLBB (ORCPT ); Mon, 26 Jun 2023 07:01:01 -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-i2c@vger.kernel.org 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: 1799790 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=F3BZxFX6; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4QqPyY3kCZz20b7 for ; Mon, 26 Jun 2023 21:00:37 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjFZLAe (ORCPT ); Mon, 26 Jun 2023 07:00:34 -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-i2c@vger.kernel.org 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: 1799789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=gRlKcgY6; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4QqPyX4Wgtz20ZP for ; Mon, 26 Jun 2023 21:00:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229704AbjFZLAc (ORCPT ); Mon, 26 Jun 2023 07:00:32 -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-i2c@vger.kernel.org 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: 1799793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=T3Gjqx5U; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4QqPz52q9rz20ZP for ; Mon, 26 Jun 2023 21:01:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbjFZLBD (ORCPT ); Mon, 26 Jun 2023 07:01:03 -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-i2c@vger.kernel.org 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"