From patchwork Sun May 20 13:28:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10413379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0A39E60365 for ; Sun, 20 May 2018 13:29:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECF51286FE for ; Sun, 20 May 2018 13:29:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E156C28723; Sun, 20 May 2018 13:29:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73608286FE for ; Sun, 20 May 2018 13:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751292AbeETN3G (ORCPT ); Sun, 20 May 2018 09:29:06 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41662 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751372AbeETN3F (ORCPT ); Sun, 20 May 2018 09:29:05 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3010BB414; Sun, 20 May 2018 13:29:04 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 293AE215CDA7; Sun, 20 May 2018 13:29:03 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Len Brown , Andy Shevchenko , Mika Westerberg , Wolfram Sang , Jonathan Cameron Cc: Hans de Goede , linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , linux-iio@vger.kernel.org Subject: [PATCH 1/9] ACPI: export __acpi_match_device and __acpi_device[_uevent]_modalias Date: Sun, 20 May 2018 15:28:49 +0200 Message-Id: <20180520132857.8103-2-hdegoede@redhat.com> In-Reply-To: <20180520132857.8103-1-hdegoede@redhat.com> References: <20180520132857.8103-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sun, 20 May 2018 13:29:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sun, 20 May 2018 13:29:04 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'hdegoede@redhat.com' RCPT:'' Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Normally __acpi_match_device and __acpi_device[_uevent]_modalias are only called through functions calling acpi_companion_match() so that if their are multiple devices sharing the ACPI firmware node only one matches / gets the acpi:ACPIHID modalias. Some DSDTs defines multiple i2c devices in a single apci_device and in the i2c-core-acpi code we want to instantiate separate devices for these, with all devices reporting / matching the acpi_devices's modalias. This commit exports __acpi_match_device and __acpi_device[_uevent]_modalias for use in the i2c-core-acpi code only, with a comment added that they should not be used in normal code. Signed-off-by: Hans de Goede --- drivers/acpi/bus.c | 11 ++++++----- drivers/acpi/device_sysfs.c | 4 +++- include/linux/acpi.h | 11 +++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 84b4a62018eb..29a0e8fa2a13 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -767,11 +767,11 @@ static bool __acpi_match_device_cls(const struct acpi_device_id *id, return true; } -static bool __acpi_match_device(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, - const struct of_device_id **of_id) +bool __acpi_match_device(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, + const struct of_device_id **of_id) { const struct acpi_device_id *id; struct acpi_hardware_id *hwid; @@ -808,6 +808,7 @@ static bool __acpi_match_device(struct acpi_device *device, *acpi_id = id; return true; } +EXPORT_SYMBOL_GPL(__acpi_match_device); /** * acpi_match_device - Match a struct device against a given list of ACPI IDs diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c index 545e91420cde..e6d784ef00da 100644 --- a/drivers/acpi/device_sysfs.c +++ b/drivers/acpi/device_sysfs.c @@ -276,6 +276,7 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev, return 0; } +EXPORT_SYMBOL_GPL(__acpi_device_uevent_modalias); /** * acpi_device_uevent_modalias - uevent modalias for ACPI-enumerated devices. @@ -291,7 +292,7 @@ int acpi_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env) } EXPORT_SYMBOL_GPL(acpi_device_uevent_modalias); -static int __acpi_device_modalias(struct acpi_device *adev, char *buf, int size) +int __acpi_device_modalias(struct acpi_device *adev, char *buf, int size) { int len, count; @@ -321,6 +322,7 @@ static int __acpi_device_modalias(struct acpi_device *adev, char *buf, int size) return len; } +EXPORT_SYMBOL_GPL(__acpi_device_modalias); /** * acpi_device_modalias - modalias sysfs attribute for ACPI-enumerated devices. diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 15bfb15c2fa5..cf97902792a5 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -586,12 +586,23 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct device *dev); +/* Skips the acpi_companion_match() check, normal code must not use this */ +bool __acpi_match_device(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, + const struct of_device_id **of_id); const void *acpi_device_get_match_data(const struct device *dev); extern bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv); int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); +/* Skips the acpi_companion_match() check, normal code must not use this */ +int __acpi_device_uevent_modalias(struct acpi_device *adev, + struct kobj_uevent_env *env); int acpi_device_modalias(struct device *, char *, int); +/* Skips the acpi_companion_match() check, normal code must not use this */ +int __acpi_device_modalias(struct acpi_device *adev, char *buf, int size); void acpi_walk_dep_device_list(acpi_handle handle); struct platform_device *acpi_create_platform_device(struct acpi_device *,