linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Jonathan Cameron <jic23@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
	linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	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	[thread overview]
Message-ID: <20180520132857.8103-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20180520132857.8103-1-hdegoede@redhat.com>

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 <hdegoede@redhat.com>
---
 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 *,
-- 
2.17.0

  reply	other threads:[~2018-05-20 13:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-20 13:28 [PATCH 0/9] ACPI/i2c Enumerate several instances out of one fwnode Hans de Goede
2018-05-20 13:28 ` Hans de Goede [this message]
2018-05-20 13:28 ` [PATCH 2/9] i2c: Allow specifying irq-index to be used in i2c_device_probe() Hans de Goede
2018-05-21  9:07   ` Andy Shevchenko
2018-05-21  9:08     ` Andy Shevchenko
2018-05-20 13:28 ` [PATCH 3/9] i2c: acpi: Introduce i2c_acpi_get_i2c_resource() helper Hans de Goede
2018-05-20 13:28 ` [PATCH 4/9] i2c: acpi: Allow get info by index in i2c_acpi_get_info() Hans de Goede
2018-05-20 13:28 ` [PATCH 5/9] i2c: acpi: Enumerate several instances out of one device Hans de Goede
2018-05-20 13:28 ` [PATCH 6/9] i2c: acpi: Add BSG1160 to i2c_acpi_multiple_devices_ids Hans de Goede
2018-05-20 13:28 ` [PATCH 7/9] iio: accel: bmc150: Add support for BSG1160 ACPI HID Hans de Goede
2018-05-20 13:28 ` [PATCH 8/9] iio: gyro: bmg160: " Hans de Goede
2018-05-20 13:28 ` [PATCH 9/9] iio: magnetometer: bmc150: " Hans de Goede
2018-05-20 16:23 ` [PATCH 0/9] ACPI/i2c Enumerate several instances out of one fwnode Jonathan Cameron
2018-05-21 13:19   ` Lars-Peter Clausen
2018-05-21  9:19 ` Andy Shevchenko
2018-05-21 12:34   ` Hans de Goede
2018-05-21 13:13     ` Andy Shevchenko
2018-05-21 13:31       ` Lars-Peter Clausen
2018-05-21 13:40         ` Hans de Goede
2018-05-21 13:44           ` Hans de Goede
2018-05-21 15:07             ` Lars-Peter Clausen
2018-05-21 19:12               ` Hans de Goede
2018-05-22  7:59                 ` Heikki Krogerus
2018-05-22 10:53                 ` Jonathan Cameron
2018-05-22 11:40                 ` Lars-Peter Clausen
2018-05-22 11:55                   ` Hans de Goede
2018-05-22 12:02                     ` Lars-Peter Clausen
2018-05-21 13:31       ` Hans de Goede
2018-05-24  8:55 ` Rafael J. Wysocki
2018-05-24  8:56   ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180520132857.8103-2-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).