linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Init device ids from ACPI of_compatible
@ 2016-07-13 11:53 Crestez Dan Leonard
  2016-07-13 11:53 ` [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible Crestez Dan Leonard
                   ` (3 more replies)
  0 siblings, 4 replies; 48+ messages in thread
From: Crestez Dan Leonard @ 2016-07-13 11:53 UTC (permalink / raw)
  To: linux-acpi, Rafael J. Wysocki, Jarkko Nikula, Mika Westerberg
  Cc: Crestez Dan Leonard, Len Brown, linux-i2c, Wolfram Sang,
	linux-spi, Mark Brown, linux-kernel, Octavian Purdila

When using devicetree stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this in order to differentiate between
hardware variants try to replicate it when using ACPI with DT ids.

This also makes it so that the i2c_device_id parameter passed to probe is
non-NULL when matching with ACPI and DT ids.

These patches are on top of linux-pm/linux-next. I delayed v2 until ACPI
overlays got in in order to avoid conflicts. I tested using ACPI overlays but
there is no actual dependency. This series just extends the PRP0001 feature to
be more useful for I2C/SPI.

The patches only touches the ACPI-specific parts of the i2c and spi core.

Here is an example .dsl for an SPI accelerometer connected to minnowboard max:

Device (ACCL)
{
    Name (_ADR, Zero)
    Name (_HID, "PRP0001")
    Name (_CID, "PRP0001")
    Name (_UID, One)

    Method (_CRS, 0, Serialized)
    {
	Name (RBUF, ResourceTemplate ()
	{
	    SPISerialBus(1, PolarityLow, FourWireMode, 16,
		    ControllerInitiated, 1000000, ClockPolarityLow,
		    ClockPhaseFirst, "\\_SB.SPI1",)
	    GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
		     "\\_SB.GPO2", 0x00, ResourceConsumer, , )
	    { // Pin list
		    1
	    }
	})
	Return (RBUF)
    }
    Name (_DSD, Package ()
    {
	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
	Package ()
	{
	    Package () {"compatible", "st,lis3dh"},
	}
    })
}

Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
Changes:
 * Rebase on after acpi overlays got it.
 * Change acpi_of_modalias outlen param to size_t
 * Use {} after else

Crestez Dan Leonard (3):
  acpi: Export acpi_of_modalias equiv of of_modalias_node
  acpi i2c: Initialize info.type from of_compatible
  acpi spi: Initialize modalias from of_compatible

 drivers/acpi/bus.c      | 36 ++++++++++++++++++++++++++++++++++++
 drivers/i2c/i2c-core.c  |  8 +++++++-
 drivers/spi/spi.c       | 11 ++++++++++-
 include/acpi/acpi_bus.h |  1 +
 4 files changed, 54 insertions(+), 2 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v2 1/3] acpi: Export acpi_of_modalias equiv of of_modalias_node
       [not found] ` <cover.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-07-13 11:53   ` Crestez Dan Leonard
       [not found]     ` <fde8d7c9312a887553feab9877a33f01e5ceda47.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-07-13 11:53   ` [PATCH v2 2/3] acpi i2c: Initialize info.type from of_compatible Crestez Dan Leonard
  2016-07-13 12:09   ` [PATCH v2 0/3] Init device ids from ACPI of_compatible Rafael J. Wysocki
  2 siblings, 1 reply; 48+ messages in thread
From: Crestez Dan Leonard @ 2016-07-13 11:53 UTC (permalink / raw)
  To: linux-acpi-u79uwXL29TY76Z2rM5mHXA, Rafael J. Wysocki,
	Jarkko Nikula, Mika Westerberg
  Cc: Crestez Dan Leonard, Len Brown, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	Wolfram Sang, linux-spi-u79uwXL29TY76Z2rM5mHXA, Mark Brown,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Octavian Purdila

When using devicetree stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this try to replicate it when using
ACPI with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/acpi/bus.c      | 36 ++++++++++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h |  1 +
 2 files changed, 37 insertions(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index cb9558e..77a1a80 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -654,6 +654,42 @@ static bool acpi_of_match_device(struct acpi_device *adev,
 	return false;
 }
 
+/**
+ * acpi_of_modalias - Like of_modalias_node for ACPI with DT ids
+ * @adev:	ACPI device object to match.
+ * @outstr:	Pointer to buffer for result
+ * @outlen:	Length of outstr value
+ *
+ * If we have a DT id set outstr to the first compatible string with the vendor
+ * prefix stripped, just like of_modalias_node does for devicetree.
+ *
+ * Returns 0 on success or negative errno on failure.
+ */
+int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen)
+{
+	const union acpi_object *of_compatible;
+	const union acpi_object *obj;
+	const char *str, *chr;
+
+	of_compatible = adev->data.of_compatible;
+	if (!of_compatible)
+		return -ENODEV;
+
+	if (of_compatible->type == ACPI_TYPE_PACKAGE)
+		obj = of_compatible->package.elements;
+	else /* Must be ACPI_TYPE_STRING. */
+		obj = of_compatible;
+
+	str = obj->string.pointer;
+	chr = strchr(str, ',');
+	if (chr)
+		str = chr + 1;
+	strlcpy(outstr, str, outlen);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(acpi_of_modalias);
+
 static bool __acpi_match_device_cls(const struct acpi_device_id *id,
 				    struct acpi_hardware_id *hwid)
 {
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 788c6c35..1d8ff0d 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -515,6 +515,7 @@ void acpi_bus_trim(struct acpi_device *start);
 acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
 int acpi_match_device_ids(struct acpi_device *device,
 			  const struct acpi_device_id *ids);
+int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen);
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 2/3] acpi i2c: Initialize info.type from of_compatible
       [not found] ` <cover.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-07-13 11:53   ` [PATCH v2 1/3] acpi: Export acpi_of_modalias equiv of of_modalias_node Crestez Dan Leonard
@ 2016-07-13 11:53   ` Crestez Dan Leonard
  2016-07-13 12:20     ` Rafael J. Wysocki
  2016-07-13 12:09   ` [PATCH v2 0/3] Init device ids from ACPI of_compatible Rafael J. Wysocki
  2 siblings, 1 reply; 48+ messages in thread
From: Crestez Dan Leonard @ 2016-07-13 11:53 UTC (permalink / raw)
  To: linux-acpi-u79uwXL29TY76Z2rM5mHXA, Rafael J. Wysocki,
	Jarkko Nikula, Mika Westerberg
  Cc: Crestez Dan Leonard, Len Brown, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	Wolfram Sang, linux-spi-u79uwXL29TY76Z2rM5mHXA, Mark Brown,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Octavian Purdila

When using devicetree i2c_board_info.type is set to the compatible
string with the vendor prefix removed. For I2C devices described via
ACPI the i2c_board_info.type string is set to the ACPI device name. When
using ACPI and DT ids this string ends up something like "PRP0001:00".

If the of_compatible property is present try to use that instead. This
makes it easier to instantiate i2c drivers through ACPI with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/i2c-core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 74e5aea..62a1339 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -179,7 +179,13 @@ static int acpi_i2c_get_info(struct acpi_device *adev,
 
 	acpi_dev_free_resource_list(&resource_list);
 
-	strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
+	if (adev->data.of_compatible) {
+		ret = acpi_of_modalias(adev, info->type, sizeof(info->type));
+		if (ret)
+			return -EINVAL;
+	} else {
+		strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
+	}
 
 	return 0;
 }
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible
  2016-07-13 11:53 [PATCH v2 0/3] Init device ids from ACPI of_compatible Crestez Dan Leonard
@ 2016-07-13 11:53 ` Crestez Dan Leonard
  2016-07-13 12:22   ` Rafael J. Wysocki
  2016-07-19 10:22   ` Mark Brown
       [not found] ` <cover.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 48+ messages in thread
From: Crestez Dan Leonard @ 2016-07-13 11:53 UTC (permalink / raw)
  To: linux-acpi, Rafael J. Wysocki, Jarkko Nikula, Mika Westerberg
  Cc: Crestez Dan Leonard, Len Brown, linux-i2c, Wolfram Sang,
	linux-spi, Mark Brown, linux-kernel, Octavian Purdila

When using devicetree spi_device.modalias is set to the compatible
string with the vendor prefix removed. For SPI devices described via
ACPI the i2c_board_info.type string is initialized by acpi_device_hid.
When using ACPI and DT ids this string ends up something like "PRP0001".

Change acpi_register_spi_device to use the of_compatible property if
present. This makes it easier to instantiate spi drivers through ACPI
with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
---
 drivers/spi/spi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 7589c8a..49fdf6e 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1679,13 +1679,22 @@ static acpi_status acpi_register_spi_device(struct spi_master *master,
 		return AE_OK;
 	}
 
+	if (adev->data.of_compatible) {
+		ret = acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias));
+		if (ret) {
+			spi_dev_put(spi);
+			return AE_NOT_FOUND;
+		}
+	} else {
+		strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
+	}
+
 	if (spi->irq < 0)
 		spi->irq = acpi_dev_gpio_irq_get(adev, 0);
 
 	acpi_device_set_enumerated(adev);
 
 	adev->power.flags.ignore_parent = true;
-	strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
 	if (spi_add_device(spi)) {
 		adev->power.flags.ignore_parent = false;
 		dev_err(&master->dev, "failed to add SPI device %s from ACPI\n",
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 0/3] Init device ids from ACPI of_compatible
       [not found] ` <cover.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-07-13 11:53   ` [PATCH v2 1/3] acpi: Export acpi_of_modalias equiv of of_modalias_node Crestez Dan Leonard
  2016-07-13 11:53   ` [PATCH v2 2/3] acpi i2c: Initialize info.type from of_compatible Crestez Dan Leonard
@ 2016-07-13 12:09   ` Rafael J. Wysocki
  2 siblings, 0 replies; 48+ messages in thread
From: Rafael J. Wysocki @ 2016-07-13 12:09 UTC (permalink / raw)
  To: Crestez Dan Leonard
  Cc: ACPI Devel Maling List, Rafael J. Wysocki, Jarkko Nikula,
	Mika Westerberg, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	Mark Brown, Linux Kernel Mailing List, Octavian Purdila

On Wed, Jul 13, 2016 at 1:53 PM, Crestez Dan Leonard
<leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> When using devicetree stuff like i2c_client.name or spi_device.modalias
> is initialized to the first DT compatible id with the vendor prefix
> stripped. Since some drivers rely on this in order to differentiate between
> hardware variants try to replicate it when using ACPI with DT ids.
>
> This also makes it so that the i2c_device_id parameter passed to probe is
> non-NULL when matching with ACPI and DT ids.
>
> These patches are on top of linux-pm/linux-next. I delayed v2 until ACPI
> overlays got in in order to avoid conflicts. I tested using ACPI overlays but
> there is no actual dependency. This series just extends the PRP0001 feature to
> be more useful for I2C/SPI.
>
> The patches only touches the ACPI-specific parts of the i2c and spi core.
>
> Here is an example .dsl for an SPI accelerometer connected to minnowboard max:
>
> Device (ACCL)
> {
>     Name (_ADR, Zero)
>     Name (_HID, "PRP0001")
>     Name (_CID, "PRP0001")

This is bad ASL.

Generally, it is a bug to use the same device ID in both _HID and
_CID.  It will work, but it is incorrect.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 1/3] acpi: Export acpi_of_modalias equiv of of_modalias_node
       [not found]     ` <fde8d7c9312a887553feab9877a33f01e5ceda47.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-07-13 12:19       ` Rafael J. Wysocki
  2016-07-19  7:14       ` Mika Westerberg
  1 sibling, 0 replies; 48+ messages in thread
From: Rafael J. Wysocki @ 2016-07-13 12:19 UTC (permalink / raw)
  To: Crestez Dan Leonard
  Cc: ACPI Devel Maling List, Rafael J. Wysocki, Jarkko Nikula,
	Mika Westerberg, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	Mark Brown, Linux Kernel Mailing List, Octavian Purdila

On Wed, Jul 13, 2016 at 1:53 PM, Crestez Dan Leonard
<leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> When using devicetree stuff like i2c_client.name or spi_device.modalias
> is initialized to the first DT compatible id with the vendor prefix
> stripped. Since some drivers rely on this try to replicate it when using
> ACPI with DT ids.
>
> Signed-off-by: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/acpi/bus.c      | 36 ++++++++++++++++++++++++++++++++++++
>  include/acpi/acpi_bus.h |  1 +
>  2 files changed, 37 insertions(+)
>
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index cb9558e..77a1a80 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -654,6 +654,42 @@ static bool acpi_of_match_device(struct acpi_device *adev,
>         return false;
>  }
>
> +/**
> + * acpi_of_modalias - Like of_modalias_node for ACPI with DT ids
> + * @adev:      ACPI device object to match.
> + * @outstr:    Pointer to buffer for result
> + * @outlen:    Length of outstr value
> + *
> + * If we have a DT id set outstr to the first compatible string with the vendor
> + * prefix stripped, just like of_modalias_node does for devicetree.

I'd say

"This is a counterpart of of_modalias_node() for struct acpi_device
objects.  If there is a compatible string for @adev, copy it to the
@outstr location with the vendor prefix stripped."

> + *
> + * Returns 0 on success or negative errno on failure.
> + */
> +int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen)
> +{
> +       const union acpi_object *of_compatible;
> +       const union acpi_object *obj;
> +       const char *str, *chr;
> +
> +       of_compatible = adev->data.of_compatible;
> +       if (!of_compatible)
> +               return -ENODEV;
> +
> +       if (of_compatible->type == ACPI_TYPE_PACKAGE)
> +               obj = of_compatible->package.elements;
> +       else /* Must be ACPI_TYPE_STRING. */
> +               obj = of_compatible;
> +
> +       str = obj->string.pointer;
> +       chr = strchr(str, ',');
> +       if (chr)
> +               str = chr + 1;
> +       strlcpy(outstr, str, outlen);

I would prefer

strlcpy(outstr, chr ? chr + 1 : str, outlen);

ie. without the extra assignment.

> +
> +       return 0;
> +}
> +EXPORT_SYMBOL_GPL(acpi_of_modalias);
> +
>  static bool __acpi_match_device_cls(const struct acpi_device_id *id,
>                                     struct acpi_hardware_id *hwid)
>  {
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index 788c6c35..1d8ff0d 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -515,6 +515,7 @@ void acpi_bus_trim(struct acpi_device *start);
>  acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
>  int acpi_match_device_ids(struct acpi_device *device,
>                           const struct acpi_device_id *ids);
> +int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen);
>  int acpi_create_dir(struct acpi_device *);
>  void acpi_remove_dir(struct acpi_device *);
>
> --

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 2/3] acpi i2c: Initialize info.type from of_compatible
  2016-07-13 11:53   ` [PATCH v2 2/3] acpi i2c: Initialize info.type from of_compatible Crestez Dan Leonard
@ 2016-07-13 12:20     ` Rafael J. Wysocki
       [not found]       ` <CAJZ5v0jz-E0RTBWVzO0Vc_jChUSeSseFeewi1UtsjLudoVP7Pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Rafael J. Wysocki @ 2016-07-13 12:20 UTC (permalink / raw)
  To: Crestez Dan Leonard
  Cc: ACPI Devel Maling List, Rafael J. Wysocki, Jarkko Nikula,
	Mika Westerberg, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	Mark Brown, Linux Kernel Mailing List, Octavian Purdila

On Wed, Jul 13, 2016 at 1:53 PM, Crestez Dan Leonard
<leonard.crestez@intel.com> wrote:
> When using devicetree i2c_board_info.type is set to the compatible
> string with the vendor prefix removed. For I2C devices described via
> ACPI the i2c_board_info.type string is set to the ACPI device name. When
> using ACPI and DT ids this string ends up something like "PRP0001:00".
>
> If the of_compatible property is present try to use that instead. This
> makes it easier to instantiate i2c drivers through ACPI with DT ids.
>
> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>

Looks good to me, but Mika needs to have a look at it too.

> ---
>  drivers/i2c/i2c-core.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 74e5aea..62a1339 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -179,7 +179,13 @@ static int acpi_i2c_get_info(struct acpi_device *adev,
>
>         acpi_dev_free_resource_list(&resource_list);
>
> -       strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
> +       if (adev->data.of_compatible) {
> +               ret = acpi_of_modalias(adev, info->type, sizeof(info->type));
> +               if (ret)
> +                       return -EINVAL;
> +       } else {
> +               strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
> +       }
>
>         return 0;
>  }
> --


Thanks,
Rafael

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible
  2016-07-13 11:53 ` [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible Crestez Dan Leonard
@ 2016-07-13 12:22   ` Rafael J. Wysocki
  2016-07-19  7:08     ` Mika Westerberg
  2016-07-19 10:22   ` Mark Brown
  1 sibling, 1 reply; 48+ messages in thread
From: Rafael J. Wysocki @ 2016-07-13 12:22 UTC (permalink / raw)
  To: Crestez Dan Leonard
  Cc: ACPI Devel Maling List, Rafael J. Wysocki, Jarkko Nikula,
	Mika Westerberg, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	Mark Brown, Linux Kernel Mailing List, Octavian Purdila

On Wed, Jul 13, 2016 at 1:53 PM, Crestez Dan Leonard
<leonard.crestez@intel.com> wrote:
> When using devicetree spi_device.modalias is set to the compatible
> string with the vendor prefix removed. For SPI devices described via
> ACPI the i2c_board_info.type string is initialized by acpi_device_hid.
> When using ACPI and DT ids this string ends up something like "PRP0001".
>
> Change acpi_register_spi_device to use the of_compatible property if
> present. This makes it easier to instantiate spi drivers through ACPI
> with DT ids.
>
> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>

Same as for the i2c patch: it looks good to me, but I'd prefer to get
a word from Mika on it too.

> ---
>  drivers/spi/spi.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 7589c8a..49fdf6e 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1679,13 +1679,22 @@ static acpi_status acpi_register_spi_device(struct spi_master *master,
>                 return AE_OK;
>         }
>
> +       if (adev->data.of_compatible) {
> +               ret = acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias));
> +               if (ret) {
> +                       spi_dev_put(spi);
> +                       return AE_NOT_FOUND;
> +               }
> +       } else {
> +               strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
> +       }
> +
>         if (spi->irq < 0)
>                 spi->irq = acpi_dev_gpio_irq_get(adev, 0);
>
>         acpi_device_set_enumerated(adev);
>
>         adev->power.flags.ignore_parent = true;
> -       strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
>         if (spi_add_device(spi)) {
>                 adev->power.flags.ignore_parent = false;
>                 dev_err(&master->dev, "failed to add SPI device %s from ACPI\n",
> --

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 0/3] Init device ids from ACPI of_compatible
  2016-07-13 11:53 [PATCH v2 0/3] Init device ids from ACPI of_compatible Crestez Dan Leonard
  2016-07-13 11:53 ` [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible Crestez Dan Leonard
       [not found] ` <cover.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-07-13 14:15 ` Dan O'Donovan
  2017-01-23 16:08 ` [PATCH v3 " Dan O'Donovan
  3 siblings, 0 replies; 48+ messages in thread
From: Dan O'Donovan @ 2016-07-13 14:15 UTC (permalink / raw)
  To: Crestez Dan Leonard, linux-acpi, Rafael J. Wysocki,
	Jarkko Nikula, Mika Westerberg
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, Mark Brown,
	linux-kernel, Octavian Purdila

On 07/13/2016 12:53 PM, Crestez Dan Leonard wrote:
> When using devicetree stuff like i2c_client.name or spi_device.modalias
> is initialized to the first DT compatible id with the vendor prefix
> stripped. Since some drivers rely on this in order to differentiate between
> hardware variants try to replicate it when using ACPI with DT ids.
>
> This also makes it so that the i2c_device_id parameter passed to probe is
> non-NULL when matching with ACPI and DT ids.
This solves a problem for me, thanks Leonard!  For the series (in case
it helps):

Tested-by: Dan O'Donovan <dan@emutex.com>

>
> These patches are on top of linux-pm/linux-next. I delayed v2 until ACPI
> overlays got in in order to avoid conflicts. I tested using ACPI overlays but
> there is no actual dependency. This series just extends the PRP0001 feature to
> be more useful for I2C/SPI.
>
> The patches only touches the ACPI-specific parts of the i2c and spi core.
>
> Here is an example .dsl for an SPI accelerometer connected to minnowboard max:
>
> Device (ACCL)
> {
>     Name (_ADR, Zero)
>     Name (_HID, "PRP0001")
>     Name (_CID, "PRP0001")
>     Name (_UID, One)
>
>     Method (_CRS, 0, Serialized)
>     {
> 	Name (RBUF, ResourceTemplate ()
> 	{
> 	    SPISerialBus(1, PolarityLow, FourWireMode, 16,
> 		    ControllerInitiated, 1000000, ClockPolarityLow,
> 		    ClockPhaseFirst, "\\_SB.SPI1",)
> 	    GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
> 		     "\\_SB.GPO2", 0x00, ResourceConsumer, , )
> 	    { // Pin list
> 		    1
> 	    }
> 	})
> 	Return (RBUF)
>     }
>     Name (_DSD, Package ()
>     {
> 	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> 	Package ()
> 	{
> 	    Package () {"compatible", "st,lis3dh"},
> 	}
>     })
> }
>
> Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
> Changes:
>  * Rebase on after acpi overlays got it.
>  * Change acpi_of_modalias outlen param to size_t
>  * Use {} after else
>
> Crestez Dan Leonard (3):
>   acpi: Export acpi_of_modalias equiv of of_modalias_node
>   acpi i2c: Initialize info.type from of_compatible
>   acpi spi: Initialize modalias from of_compatible
>
>  drivers/acpi/bus.c      | 36 ++++++++++++++++++++++++++++++++++++
>  drivers/i2c/i2c-core.c  |  8 +++++++-
>  drivers/spi/spi.c       | 11 ++++++++++-
>  include/acpi/acpi_bus.h |  1 +
>  4 files changed, 54 insertions(+), 2 deletions(-)
>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 2/3] acpi i2c: Initialize info.type from of_compatible
       [not found]       ` <CAJZ5v0jz-E0RTBWVzO0Vc_jChUSeSseFeewi1UtsjLudoVP7Pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-07-19  7:07         ` Mika Westerberg
  0 siblings, 0 replies; 48+ messages in thread
From: Mika Westerberg @ 2016-07-19  7:07 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Crestez Dan Leonard, ACPI Devel Maling List, Rafael J. Wysocki,
	Jarkko Nikula, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	Mark Brown, Linux Kernel Mailing List, Octavian Purdila

On Wed, Jul 13, 2016 at 02:20:57PM +0200, Rafael J. Wysocki wrote:
> On Wed, Jul 13, 2016 at 1:53 PM, Crestez Dan Leonard
> <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> > When using devicetree i2c_board_info.type is set to the compatible
> > string with the vendor prefix removed. For I2C devices described via
> > ACPI the i2c_board_info.type string is set to the ACPI device name. When
> > using ACPI and DT ids this string ends up something like "PRP0001:00".
> >
> > If the of_compatible property is present try to use that instead. This
> > makes it easier to instantiate i2c drivers through ACPI with DT ids.
> >
> > Signed-off-by: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> Looks good to me, but Mika needs to have a look at it too.

Looks good to me,

Reviewed-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible
  2016-07-13 12:22   ` Rafael J. Wysocki
@ 2016-07-19  7:08     ` Mika Westerberg
  0 siblings, 0 replies; 48+ messages in thread
From: Mika Westerberg @ 2016-07-19  7:08 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Crestez Dan Leonard, ACPI Devel Maling List, Rafael J. Wysocki,
	Jarkko Nikula, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	Mark Brown, Linux Kernel Mailing List, Octavian Purdila

On Wed, Jul 13, 2016 at 02:22:02PM +0200, Rafael J. Wysocki wrote:
> On Wed, Jul 13, 2016 at 1:53 PM, Crestez Dan Leonard
> <leonard.crestez@intel.com> wrote:
> > When using devicetree spi_device.modalias is set to the compatible
> > string with the vendor prefix removed. For SPI devices described via
> > ACPI the i2c_board_info.type string is initialized by acpi_device_hid.
> > When using ACPI and DT ids this string ends up something like "PRP0001".
> >
> > Change acpi_register_spi_device to use the of_compatible property if
> > present. This makes it easier to instantiate spi drivers through ACPI
> > with DT ids.
> >
> > Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
> 
> Same as for the i2c patch: it looks good to me, but I'd prefer to get
> a word from Mika on it too.

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 1/3] acpi: Export acpi_of_modalias equiv of of_modalias_node
       [not found]     ` <fde8d7c9312a887553feab9877a33f01e5ceda47.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-07-13 12:19       ` Rafael J. Wysocki
@ 2016-07-19  7:14       ` Mika Westerberg
  1 sibling, 0 replies; 48+ messages in thread
From: Mika Westerberg @ 2016-07-19  7:14 UTC (permalink / raw)
  To: Crestez Dan Leonard
  Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA, Rafael J. Wysocki,
	Jarkko Nikula, Len Brown, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	Wolfram Sang, linux-spi-u79uwXL29TY76Z2rM5mHXA, Mark Brown,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Octavian Purdila

On Wed, Jul 13, 2016 at 02:53:40PM +0300, Crestez Dan Leonard wrote:
> When using devicetree stuff like i2c_client.name or spi_device.modalias
> is initialized to the first DT compatible id with the vendor prefix
> stripped. Since some drivers rely on this try to replicate it when using
> ACPI with DT ids.
> 
> Signed-off-by: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Looks good to me. Once you have addressed comments from Rafael you can
add my,

Reviewed-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible
  2016-07-13 11:53 ` [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible Crestez Dan Leonard
  2016-07-13 12:22   ` Rafael J. Wysocki
@ 2016-07-19 10:22   ` Mark Brown
  2016-07-20 11:21     ` Crestez Dan Leonard
  1 sibling, 1 reply; 48+ messages in thread
From: Mark Brown @ 2016-07-19 10:22 UTC (permalink / raw)
  To: Crestez Dan Leonard
  Cc: linux-acpi, Rafael J. Wysocki, Jarkko Nikula, Mika Westerberg,
	Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Octavian Purdila

[-- Attachment #1: Type: text/plain, Size: 1471 bytes --]

On Wed, Jul 13, 2016 at 02:53:42PM +0300, Crestez Dan Leonard wrote:
> When using devicetree spi_device.modalias is set to the compatible
> string with the vendor prefix removed. For SPI devices described via
> ACPI the i2c_board_info.type string is initialized by acpi_device_hid.
> When using ACPI and DT ids this string ends up something like "PRP0001".

Please submit patches using subject lines reflecting the style for the
subsystem.  This makes it easier for people to identify relevant
patches.  Look at what existing commits in the area you're changing are
doing and make sure your subject lines visually resemble what they're
doing.

> Change acpi_register_spi_device to use the of_compatible property if
> present. This makes it easier to instantiate spi drivers through ACPI
> with DT ids.

This is basically fine but...

> +	if (adev->data.of_compatible) {
> +		ret = acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias));
> +		if (ret) {
> +			spi_dev_put(spi);
> +			return AE_NOT_FOUND;
> +		}

The only reason this could fail currently is that there wasn't a
compatible in the first place so why don't we just handle it like the no
compatible case?  It's probably not realistic but it seems like there's
a small chance this could regress some platform if we do add more error
detection in acpi_of_modalias().

I'm still not sure why if we want to translate ACPI into DT why we don't
actually translate and avoid all this special casing and churn.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible
  2016-07-19 10:22   ` Mark Brown
@ 2016-07-20 11:21     ` Crestez Dan Leonard
  2016-07-20 11:37       ` Mark Brown
  0 siblings, 1 reply; 48+ messages in thread
From: Crestez Dan Leonard @ 2016-07-20 11:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-acpi, Rafael J. Wysocki, Jarkko Nikula, Mika Westerberg,
	Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Octavian Purdila

On 07/19/2016 01:22 PM, Mark Brown wrote:
> On Wed, Jul 13, 2016 at 02:53:42PM +0300, Crestez Dan Leonard wrote:
>> When using devicetree spi_device.modalias is set to the compatible
>> string with the vendor prefix removed. For SPI devices described via
>> ACPI the i2c_board_info.type string is initialized by acpi_device_hid.
>> When using ACPI and DT ids this string ends up something like "PRP0001".
> 
> Please submit patches using subject lines reflecting the style for the
> subsystem.  This makes it easier for people to identify relevant
> patches.  Look at what existing commits in the area you're changing are
> doing and make sure your subject lines visually resemble what they're
> doing.

So the prefix should be something like "spi: acpi: "?

>> Change acpi_register_spi_device to use the of_compatible property if
>> present. This makes it easier to instantiate spi drivers through ACPI
>> with DT ids.
> 
> This is basically fine but...
> 
>> +	if (adev->data.of_compatible) {
>> +		ret = acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias));
>> +		if (ret) {
>> +			spi_dev_put(spi);
>> +			return AE_NOT_FOUND;
>> +		}
> 
> The only reason this could fail currently is that there wasn't a
> compatible in the first place so why don't we just handle it like the no
> compatible case?  It's probably not realistic but it seems like there's
> a small chance this could regress some platform if we do add more error
> detection in acpi_of_modalias().

If acpi_of_modalias fails for some new reason wouldn't it be better to
fail explicitly rather than ignore it?

-- 
Regards,
Leonard

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible
  2016-07-20 11:21     ` Crestez Dan Leonard
@ 2016-07-20 11:37       ` Mark Brown
  0 siblings, 0 replies; 48+ messages in thread
From: Mark Brown @ 2016-07-20 11:37 UTC (permalink / raw)
  To: Crestez Dan Leonard
  Cc: linux-acpi, Rafael J. Wysocki, Jarkko Nikula, Mika Westerberg,
	Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Octavian Purdila

[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]

On Wed, Jul 20, 2016 at 02:21:55PM +0300, Crestez Dan Leonard wrote:
> On 07/19/2016 01:22 PM, Mark Brown wrote:

> > Please submit patches using subject lines reflecting the style for the
> > subsystem.  This makes it easier for people to identify relevant
> > patches.  Look at what existing commits in the area you're changing are
> > doing and make sure your subject lines visually resemble what they're
> > doing.

> So the prefix should be something like "spi: acpi: "?

Yes.

> >> +	if (adev->data.of_compatible) {
> >> +		ret = acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias));
> >> +		if (ret) {
> >> +			spi_dev_put(spi);
> >> +			return AE_NOT_FOUND;
> >> +		}

> > The only reason this could fail currently is that there wasn't a
> > compatible in the first place so why don't we just handle it like the no
> > compatible case?  It's probably not realistic but it seems like there's
> > a small chance this could regress some platform if we do add more error
> > detection in acpi_of_modalias().

> If acpi_of_modalias fails for some new reason wouldn't it be better to
> fail explicitly rather than ignore it?

The current code will happily proceed to create a device without doing
this parsing so clearly we can do that.  It's not clear to me that it's
better to refuse to create the device at all than to soldier on and
create a device with only the native ACPI information, perhaps it just
needs a comment explaining why we do that.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v3 0/3] Init device ids from ACPI of_compatible
  2016-07-13 11:53 [PATCH v2 0/3] Init device ids from ACPI of_compatible Crestez Dan Leonard
                   ` (2 preceding siblings ...)
  2016-07-13 14:15 ` Dan O'Donovan
@ 2017-01-23 16:08 ` Dan O'Donovan
  2017-01-23 16:08   ` [PATCH v3 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
                     ` (4 more replies)
  3 siblings, 5 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-23 16:08 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

(Re-submitting this patch set originally created by Leonard Crestez,
possibly abandoned by Leonard due to a change in employment)

When using devicetree, stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this in order to differentiate between
hardware variants try to replicate it when using ACPI with DT ids.

This also makes it so that the i2c_device_id parameter passed to probe is
non-NULL when matching with ACPI and DT ids.

Tested using ACPI overlays but there is no actual dependency. This series
just extends the PRP0001 feature to be more useful for I2C/SPI.

The patches only touches the ACPI-specific parts of the i2c and spi core.

Here is an example .dsl for an SPI accelerometer connected to minnowboard max:

Device (ACCL)
{
    Name (_ADR, Zero)
    Name (_HID, "PRP0001")
    Name (_UID, One)

    Method (_CRS, 0, Serialized)
    {
	Name (RBUF, ResourceTemplate ()
	{
	    SPISerialBus(1, PolarityLow, FourWireMode, 16,
		    ControllerInitiated, 1000000, ClockPolarityLow,
		    ClockPhaseFirst, "\\_SB.SPI1",)
	    GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
		     "\\_SB.GPO2", 0x00, ResourceConsumer, , )
	    { // Pin list
		    1
	    }
	})
	Return (RBUF)
    }
    Name (_DSD, Package ()
    {
	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
	Package ()
	{
	    Package () {"compatible", "st,lis3dh"},
	}
    })
}

Link to v2: https://lkml.org/lkml/2016/7/13/392
Changes:
 * Use appropriate subject prefix for each subsystem (Mark Brown)
 * Use ACPI info as before if getting OF info fails (Mark Brown)
 * Minor cosmetic/readability improvements (Rafael J. Wysocki)

Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
Changes:
 * Rebase on after acpi overlays got it.
 * Change acpi_of_modalias outlen param to size_t
 * Use {} after else

Crestez Dan Leonard (3):
  ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  i2c: acpi: Initialize info.type from of_compatible
  spi: acpi: Initialize modalias from of_compatible

 drivers/acpi/bus.c      | 35 +++++++++++++++++++++++++++++++++++
 drivers/i2c/i2c-core.c  |  8 +++++++-
 drivers/spi/spi.c       | 10 +++++++++-
 include/acpi/acpi_bus.h |  1 +
 4 files changed, 52 insertions(+), 2 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v3 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
       [not found]   ` <1485187737-22414-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
@ 2017-01-23 16:08     ` Dan O'Donovan
  2017-01-23 16:08     ` [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible Dan O'Donovan
  1 sibling, 0 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-23 16:08 UTC (permalink / raw)
  To: linux-acpi-u79uwXL29TY76Z2rM5mHXA, Rafael J . Wysocki,
	Jarkko Nikula, Mika Westerberg, Mark Brown
  Cc: Len Brown, linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Dan O'Donovan,
	Crestez Dan Leonard

From: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

When using devicetree stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this try to replicate it when using
ACPI with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dan O'Donovan <dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
Reviewed-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/acpi/bus.c      | 35 +++++++++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h |  1 +
 2 files changed, 36 insertions(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 95855cb..8b9657f 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -677,6 +677,41 @@ static bool acpi_of_match_device(struct acpi_device *adev,
 	return false;
 }
 
+/**
+ * acpi_of_modalias - Like of_modalias_node for ACPI with DT ids
+ * @adev:	ACPI device object to match.
+ * @outstr:	Pointer to buffer for result
+ * @outlen:	Length of outstr value
+ *
+ * This is a counterpart of of_modalias_node() for struct acpi_device
+ * objects. If there is a compatible string for @adev, copy it to the
+ * @outstr location with the vendor prefix stripped.
+ *
+ * Returns 0 on success or negative errno on failure.
+ */
+int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen)
+{
+	const union acpi_object *of_compatible;
+	const union acpi_object *obj;
+	const char *str, *chr;
+
+	of_compatible = adev->data.of_compatible;
+	if (!of_compatible)
+		return -ENODEV;
+
+	if (of_compatible->type == ACPI_TYPE_PACKAGE)
+		obj = of_compatible->package.elements;
+	else /* Must be ACPI_TYPE_STRING. */
+		obj = of_compatible;
+
+	str = obj->string.pointer;
+	chr = strchr(str, ',');
+	strlcpy(outstr, chr ? chr + 1 : str, outlen);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(acpi_of_modalias);
+
 static bool __acpi_match_device_cls(const struct acpi_device_id *id,
 				    struct acpi_hardware_id *hwid)
 {
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 4242c31..351b4a4 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -522,6 +522,7 @@ void acpi_bus_trim(struct acpi_device *start);
 acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
 int acpi_match_device_ids(struct acpi_device *device,
 			  const struct acpi_device_id *ids);
+int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen);
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 2/3] i2c: acpi: Initialize info.type from of_compatible
  2017-01-23 16:08 ` [PATCH v3 " Dan O'Donovan
@ 2017-01-23 16:08   ` Dan O'Donovan
  2017-01-23 17:10     ` Andy Shevchenko
       [not found]   ` <1485187737-22414-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-23 16:08 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan, Crestez Dan Leonard

From: Crestez Dan Leonard <leonard.crestez@intel.com>

When using devicetree i2c_board_info.type is set to the compatible
string with the vendor prefix removed. For I2C devices described via
ACPI the i2c_board_info.type string is set to the ACPI device name. When
using ACPI and DT ids this string ends up something like "PRP0001:00".

If the of_compatible property is present try to use that instead. This
makes it easier to instantiate i2c drivers through ACPI with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Dan O'Donovan <dan@emutex.com>
---
 drivers/i2c/i2c-core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 583e950..a83dbc7 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -221,7 +221,13 @@ static int i2c_acpi_get_info(struct acpi_device *adev,
 
 	acpi_dev_free_resource_list(&resource_list);
 
-	strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
+	/*
+	 * Populate modalias from compatible property if available,
+	 * otherwise use native ACPI information
+	 */
+	if ((!adev->data.of_compatible) ||
+	    acpi_of_modalias(adev, info->type, sizeof(info->type)))
+		strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
 
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible
       [not found]   ` <1485187737-22414-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
  2017-01-23 16:08     ` [PATCH v3 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
@ 2017-01-23 16:08     ` Dan O'Donovan
  2017-01-23 17:11       ` Andy Shevchenko
  2017-01-30  9:41       ` Rafael J. Wysocki
  1 sibling, 2 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-23 16:08 UTC (permalink / raw)
  To: linux-acpi-u79uwXL29TY76Z2rM5mHXA, Rafael J . Wysocki,
	Jarkko Nikula, Mika Westerberg, Mark Brown
  Cc: Len Brown, linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Dan O'Donovan,
	Crestez Dan Leonard

From: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

When using devicetree spi_device.modalias is set to the compatible
string with the vendor prefix removed. For SPI devices described via
ACPI the spi_device.modalias string is initialized by acpi_device_hid.
When using ACPI and DT ids this string ends up something like "PRP0001".

Change acpi_register_spi_device to use the of_compatible property if
present. This makes it easier to instantiate spi drivers through ACPI
with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dan O'Donovan <dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 656dd3e..4b562e8 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1722,13 +1722,21 @@ static acpi_status acpi_register_spi_device(struct spi_master *master,
 		return AE_OK;
 	}
 
+	/*
+	 * Populate modalias from compatible property if available,
+	 * otherwise use native ACPI information
+	 */
+	if ((!adev->data.of_compatible) ||
+	    acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias)))
+		strlcpy(spi->modalias, acpi_device_hid(adev),
+			sizeof(spi->modalias));
+
 	if (spi->irq < 0)
 		spi->irq = acpi_dev_gpio_irq_get(adev, 0);
 
 	acpi_device_set_enumerated(adev);
 
 	adev->power.flags.ignore_parent = true;
-	strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
 	if (spi_add_device(spi)) {
 		adev->power.flags.ignore_parent = false;
 		dev_err(&master->dev, "failed to add SPI device %s from ACPI\n",
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 2/3] i2c: acpi: Initialize info.type from of_compatible
  2017-01-23 16:08   ` [PATCH v3 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
@ 2017-01-23 17:10     ` Andy Shevchenko
  0 siblings, 0 replies; 48+ messages in thread
From: Andy Shevchenko @ 2017-01-23 17:10 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	linux-kernel, Crestez Dan Leonard

On Mon, Jan 23, 2017 at 6:08 PM, Dan O'Donovan <dan@emutex.com> wrote:
> From: Crestez Dan Leonard <leonard.crestez@intel.com>
>
> When using devicetree i2c_board_info.type is set to the compatible
> string with the vendor prefix removed. For I2C devices described via
> ACPI the i2c_board_info.type string is set to the ACPI device name. When
> using ACPI and DT ids this string ends up something like "PRP0001:00".
>
> If the of_compatible property is present try to use that instead. This
> makes it easier to instantiate i2c drivers through ACPI with DT ids.

> -       strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
> +       /*
> +        * Populate modalias from compatible property if available,
> +        * otherwise use native ACPI information
> +        */
> +       if ((!adev->data.of_compatible) ||
> +           acpi_of_modalias(adev, info->type, sizeof(info->type)))

Redundant parens in lvalue. After removing them is it possible to use
one line for it?

> +               strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-01-23 16:08     ` [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible Dan O'Donovan
@ 2017-01-23 17:11       ` Andy Shevchenko
  2017-01-27 10:35         ` Dan O'Donovan
  2017-01-30  9:41       ` Rafael J. Wysocki
  1 sibling, 1 reply; 48+ messages in thread
From: Andy Shevchenko @ 2017-01-23 17:11 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	linux-kernel, Crestez Dan Leonard

On Mon, Jan 23, 2017 at 6:08 PM, Dan O'Donovan <dan@emutex.com> wrote:
> From: Crestez Dan Leonard <leonard.crestez@intel.com>
>
> When using devicetree spi_device.modalias is set to the compatible
> string with the vendor prefix removed. For SPI devices described via
> ACPI the spi_device.modalias string is initialized by acpi_device_hid.
> When using ACPI and DT ids this string ends up something like "PRP0001".
>
> Change acpi_register_spi_device to use the of_compatible property if
> present. This makes it easier to instantiate spi drivers through ACPI
> with DT ids.

> +       /*
> +        * Populate modalias from compatible property if available,
> +        * otherwise use native ACPI information
> +        */
> +       if ((!adev->data.of_compatible) ||
> +           acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias)))

Same comment as in patch 2.

> +               strlcpy(spi->modalias, acpi_device_hid(adev),
> +                       sizeof(spi->modalias));

Could this be one line?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 0/3] Init device ids from ACPI of_compatible
  2017-01-23 16:08 ` [PATCH v3 " Dan O'Donovan
  2017-01-23 16:08   ` [PATCH v3 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
       [not found]   ` <1485187737-22414-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
@ 2017-01-23 17:13   ` Andy Shevchenko
  2017-01-24 15:11   ` Jarkko Nikula
  2017-01-27 13:30   ` [PATCH v4 " Dan O'Donovan
  4 siblings, 0 replies; 48+ messages in thread
From: Andy Shevchenko @ 2017-01-23 17:13 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	linux-kernel

On Mon, Jan 23, 2017 at 6:08 PM, Dan O'Donovan <dan@emutex.com> wrote:
> (Re-submitting this patch set originally created by Leonard Crestez,
> possibly abandoned by Leonard due to a change in employment)
>
> When using devicetree, stuff like i2c_client.name or spi_device.modalias
> is initialized to the first DT compatible id with the vendor prefix
> stripped. Since some drivers rely on this in order to differentiate between
> hardware variants try to replicate it when using ACPI with DT ids.
>
> This also makes it so that the i2c_device_id parameter passed to probe is
> non-NULL when matching with ACPI and DT ids.
>
> Tested using ACPI overlays but there is no actual dependency. This series
> just extends the PRP0001 feature to be more useful for I2C/SPI.
>
> The patches only touches the ACPI-specific parts of the i2c and spi core.

The series looks good. Few nitpicks in the comments of corresponding
patches though.
FWIW:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

>
> Here is an example .dsl for an SPI accelerometer connected to minnowboard max:
>
> Device (ACCL)
> {
>     Name (_ADR, Zero)
>     Name (_HID, "PRP0001")
>     Name (_UID, One)
>
>     Method (_CRS, 0, Serialized)
>     {
>         Name (RBUF, ResourceTemplate ()
>         {
>             SPISerialBus(1, PolarityLow, FourWireMode, 16,
>                     ControllerInitiated, 1000000, ClockPolarityLow,
>                     ClockPhaseFirst, "\\_SB.SPI1",)
>             GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
>                      "\\_SB.GPO2", 0x00, ResourceConsumer, , )
>             { // Pin list
>                     1
>             }
>         })
>         Return (RBUF)
>     }
>     Name (_DSD, Package ()
>     {
>         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
>         Package ()
>         {
>             Package () {"compatible", "st,lis3dh"},
>         }
>     })
> }
>
> Link to v2: https://lkml.org/lkml/2016/7/13/392
> Changes:
>  * Use appropriate subject prefix for each subsystem (Mark Brown)
>  * Use ACPI info as before if getting OF info fails (Mark Brown)
>  * Minor cosmetic/readability improvements (Rafael J. Wysocki)
>
> Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
> Changes:
>  * Rebase on after acpi overlays got it.
>  * Change acpi_of_modalias outlen param to size_t
>  * Use {} after else
>
> Crestez Dan Leonard (3):
>   ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
>   i2c: acpi: Initialize info.type from of_compatible
>   spi: acpi: Initialize modalias from of_compatible
>
>  drivers/acpi/bus.c      | 35 +++++++++++++++++++++++++++++++++++
>  drivers/i2c/i2c-core.c  |  8 +++++++-
>  drivers/spi/spi.c       | 10 +++++++++-
>  include/acpi/acpi_bus.h |  1 +
>  4 files changed, 52 insertions(+), 2 deletions(-)
>
> --
> 2.7.4
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 0/3] Init device ids from ACPI of_compatible
  2017-01-23 16:08 ` [PATCH v3 " Dan O'Donovan
                     ` (2 preceding siblings ...)
  2017-01-23 17:13   ` [PATCH v3 0/3] Init device ids from ACPI of_compatible Andy Shevchenko
@ 2017-01-24 15:11   ` Jarkko Nikula
       [not found]     ` <6ff3138c-ac16-d310-28b7-cee0b0e5f11c-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2017-01-27 13:30   ` [PATCH v4 " Dan O'Donovan
  4 siblings, 1 reply; 48+ messages in thread
From: Jarkko Nikula @ 2017-01-24 15:11 UTC (permalink / raw)
  To: Dan O'Donovan, linux-acpi, Rafael J . Wysocki,
	Mika Westerberg, Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel

On 01/23/2017 06:08 PM, Dan O'Donovan wrote:
> (Re-submitting this patch set originally created by Leonard Crestez,
> possibly abandoned by Leonard due to a change in employment)
>
> When using devicetree, stuff like i2c_client.name or spi_device.modalias
> is initialized to the first DT compatible id with the vendor prefix
> stripped. Since some drivers rely on this in order to differentiate between
> hardware variants try to replicate it when using ACPI with DT ids.
>
> This also makes it so that the i2c_device_id parameter passed to probe is
> non-NULL when matching with ACPI and DT ids.
>
> Tested using ACPI overlays but there is no actual dependency. This series
> just extends the PRP0001 feature to be more useful for I2C/SPI.
>
> The patches only touches the ACPI-specific parts of the i2c and spi core.
>
> Here is an example .dsl for an SPI accelerometer connected to minnowboard max:
>
> Device (ACCL)
> {
>     Name (_ADR, Zero)
>     Name (_HID, "PRP0001")
>     Name (_UID, One)
>
>     Method (_CRS, 0, Serialized)
>     {
> 	Name (RBUF, ResourceTemplate ()
> 	{
> 	    SPISerialBus(1, PolarityLow, FourWireMode, 16,
> 		    ControllerInitiated, 1000000, ClockPolarityLow,
> 		    ClockPhaseFirst, "\\_SB.SPI1",)
> 	    GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
> 		     "\\_SB.GPO2", 0x00, ResourceConsumer, , )
> 	    { // Pin list
> 		    1
> 	    }
> 	})
> 	Return (RBUF)
>     }
>     Name (_DSD, Package ()
>     {
> 	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> 	Package ()
> 	{
> 	    Package () {"compatible", "st,lis3dh"},
> 	}
>     })
> }
>
> Link to v2: https://lkml.org/lkml/2016/7/13/392
> Changes:
>  * Use appropriate subject prefix for each subsystem (Mark Brown)
>  * Use ACPI info as before if getting OF info fails (Mark Brown)
>  * Minor cosmetic/readability improvements (Rafael J. Wysocki)
>
> Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
> Changes:
>  * Rebase on after acpi overlays got it.
>  * Change acpi_of_modalias outlen param to size_t
>  * Use {} after else
>
> Crestez Dan Leonard (3):
>   ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
>   i2c: acpi: Initialize info.type from of_compatible
>   spi: acpi: Initialize modalias from of_compatible
>
>  drivers/acpi/bus.c      | 35 +++++++++++++++++++++++++++++++++++
>  drivers/i2c/i2c-core.c  |  8 +++++++-
>  drivers/spi/spi.c       | 10 +++++++++-
>  include/acpi/acpi_bus.h |  1 +
>  4 files changed, 52 insertions(+), 2 deletions(-)
>
After addressing comments from Andy

Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 0/3] Init device ids from ACPI of_compatible
       [not found]     ` <6ff3138c-ac16-d310-28b7-cee0b0e5f11c-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-01-24 15:19       ` Andy Shevchenko
  0 siblings, 0 replies; 48+ messages in thread
From: Andy Shevchenko @ 2017-01-24 15:19 UTC (permalink / raw)
  To: Jarkko Nikula
  Cc: Dan O'Donovan, linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	Rafael J . Wysocki, Mika Westerberg, Mark Brown, Len Brown,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang, linux-spi,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Tue, Jan 24, 2017 at 5:11 PM, Jarkko Nikula <jarkko.nikula-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> After addressing comments from Andy
>
> Reviewed-by: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Tested-by: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---------------------------------------------------------------------
> Intel Finland Oy
> Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 -
> 4 Domiciled in Helsinki
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.

Ai-ai-ai ^^^

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-01-23 17:11       ` Andy Shevchenko
@ 2017-01-27 10:35         ` Dan O'Donovan
  2017-01-27 13:43           ` Andy Shevchenko
  0 siblings, 1 reply; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-27 10:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	linux-kernel, Crestez Dan Leonard

On 01/23/2017 05:11 PM, Andy Shevchenko wrote:
> On Mon, Jan 23, 2017 at 6:08 PM, Dan O'Donovan <dan@emutex.com> wrote:
>> From: Crestez Dan Leonard <leonard.crestez@intel.com>
>>
>> When using devicetree spi_device.modalias is set to the compatible
>> string with the vendor prefix removed. For SPI devices described via
>> ACPI the spi_device.modalias string is initialized by acpi_device_hid.
>> When using ACPI and DT ids this string ends up something like "PRP0001".
>>
>> Change acpi_register_spi_device to use the of_compatible property if
>> present. This makes it easier to instantiate spi drivers through ACPI
>> with DT ids.
>> +       /*
>> +        * Populate modalias from compatible property if available,
>> +        * otherwise use native ACPI information
>> +        */
>> +       if ((!adev->data.of_compatible) ||
>> +           acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias)))
> Same comment as in patch 2.
Thanks for the feedback, Andy.  The check on of_compatible is redundant,
because its repeated in acpi_of_modalias(), so I'll remove it here (and
in patch 2) to reduce this to one line.  v4 on the way.
>> +               strlcpy(spi->modalias, acpi_device_hid(adev),
>> +                       sizeof(spi->modalias));
> Could this be one line?
I couldn't see a way to reduce this to one line without exceeding 80
chars or adding another line somewhere else, so I'll leave this one as
it is if that's ok.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v4 0/3] Init device ids from ACPI of_compatible
  2017-01-23 16:08 ` [PATCH v3 " Dan O'Donovan
                     ` (3 preceding siblings ...)
  2017-01-24 15:11   ` Jarkko Nikula
@ 2017-01-27 13:30   ` Dan O'Donovan
  2017-01-27 13:30     ` [PATCH v4 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
                       ` (3 more replies)
  4 siblings, 4 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-27 13:30 UTC (permalink / raw)
  To: linux-acpi, Andy Shevchenko, Rafael J . Wysocki, Jarkko Nikula,
	Mika Westerberg, Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

When using devicetree, stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this in order to differentiate between
hardware variants, try to replicate it when using ACPI with DT ids.

This also makes it so that the i2c_device_id parameter passed to probe is
non-NULL when matching with ACPI and DT ids.

Tested using ACPI overlays but there is no actual dependency. This series
just extends the PRP0001 feature to be more useful for I2C/SPI.

The patches only touches the ACPI-specific parts of the i2c and spi core.

Here is an example .dsl for an SPI accelerometer connected to minnowboard max:

Device (ACCL)
{
    Name (_ADR, Zero)
    Name (_HID, "PRP0001")
    Name (_UID, One)

    Method (_CRS, 0, Serialized)
    {
	Name (RBUF, ResourceTemplate ()
	{
	    SPISerialBus(1, PolarityLow, FourWireMode, 16,
		    ControllerInitiated, 1000000, ClockPolarityLow,
		    ClockPhaseFirst, "\\_SB.SPI1",)
	    GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
		     "\\_SB.GPO2", 0x00, ResourceConsumer, , )
	    { // Pin list
		    1
	    }
	})
	Return (RBUF)
    }
    Name (_DSD, Package ()
    {
	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
	Package ()
	{
	    Package () {"compatible", "st,lis3dh"},
	}
    })
}

Link to v3: http://www.spinics.net/lists/linux-acpi/msg71531.html
Changes:
 * Minor cosmetic/readability improvements (Andy Shevchenko)

Link to v2: https://lkml.org/lkml/2016/7/13/392
Changes:
 * Use appropriate subject prefix for each subsystem (Mark Brown)
 * Use ACPI info as before if getting OF info fails (Mark Brown)
 * Minor cosmetic/readability improvements (Rafael J. Wysocki)

Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
Changes:
 * Rebase on after acpi overlays got it.
 * Change acpi_of_modalias outlen param to size_t
 * Use {} after else

Crestez Dan Leonard (3):
  ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  i2c: acpi: Initialize info.type from of_compatible
  spi: acpi: Initialize modalias from of_compatible

 drivers/acpi/bus.c      | 35 +++++++++++++++++++++++++++++++++++
 drivers/i2c/i2c-core.c  |  7 ++++++-
 drivers/spi/spi.c       |  9 ++++++++-
 include/acpi/acpi_bus.h |  1 +
 4 files changed, 50 insertions(+), 2 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v4 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  2017-01-27 13:30   ` [PATCH v4 " Dan O'Donovan
@ 2017-01-27 13:30     ` Dan O'Donovan
  2017-02-02 11:41       ` Rafael J. Wysocki
  2017-01-27 13:30     ` [PATCH v4 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-27 13:30 UTC (permalink / raw)
  To: linux-acpi, Andy Shevchenko, Rafael J . Wysocki, Jarkko Nikula,
	Mika Westerberg, Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan, Crestez Dan Leonard

From: Crestez Dan Leonard <leonard.crestez@intel.com>

When using devicetree stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this try to replicate it when using
ACPI with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Dan O'Donovan <dan@emutex.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/acpi/bus.c      | 35 +++++++++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h |  1 +
 2 files changed, 36 insertions(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 95855cb..8b9657f 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -677,6 +677,41 @@ static bool acpi_of_match_device(struct acpi_device *adev,
 	return false;
 }
 
+/**
+ * acpi_of_modalias - Like of_modalias_node for ACPI with DT ids
+ * @adev:	ACPI device object to match.
+ * @outstr:	Pointer to buffer for result
+ * @outlen:	Length of outstr value
+ *
+ * This is a counterpart of of_modalias_node() for struct acpi_device
+ * objects. If there is a compatible string for @adev, copy it to the
+ * @outstr location with the vendor prefix stripped.
+ *
+ * Returns 0 on success or negative errno on failure.
+ */
+int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen)
+{
+	const union acpi_object *of_compatible;
+	const union acpi_object *obj;
+	const char *str, *chr;
+
+	of_compatible = adev->data.of_compatible;
+	if (!of_compatible)
+		return -ENODEV;
+
+	if (of_compatible->type == ACPI_TYPE_PACKAGE)
+		obj = of_compatible->package.elements;
+	else /* Must be ACPI_TYPE_STRING. */
+		obj = of_compatible;
+
+	str = obj->string.pointer;
+	chr = strchr(str, ',');
+	strlcpy(outstr, chr ? chr + 1 : str, outlen);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(acpi_of_modalias);
+
 static bool __acpi_match_device_cls(const struct acpi_device_id *id,
 				    struct acpi_hardware_id *hwid)
 {
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 4242c31..351b4a4 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -522,6 +522,7 @@ void acpi_bus_trim(struct acpi_device *start);
 acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
 int acpi_match_device_ids(struct acpi_device *device,
 			  const struct acpi_device_id *ids);
+int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen);
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v4 2/3] i2c: acpi: Initialize info.type from of_compatible
  2017-01-27 13:30   ` [PATCH v4 " Dan O'Donovan
  2017-01-27 13:30     ` [PATCH v4 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
@ 2017-01-27 13:30     ` Dan O'Donovan
  2017-01-28 21:38       ` Wolfram Sang
  2017-01-27 13:30     ` [PATCH v4 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
  2017-02-04  8:00     ` [PATCH v5 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
  3 siblings, 1 reply; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-27 13:30 UTC (permalink / raw)
  To: linux-acpi, Andy Shevchenko, Rafael J . Wysocki, Jarkko Nikula,
	Mika Westerberg, Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan, Crestez Dan Leonard

From: Crestez Dan Leonard <leonard.crestez@intel.com>

When using devicetree i2c_board_info.type is set to the compatible
string with the vendor prefix removed. For I2C devices described via
ACPI the i2c_board_info.type string is set to the ACPI device name. When
using ACPI and DT ids this string ends up something like "PRP0001:00".

If the of_compatible property is present try to use that instead. This
makes it easier to instantiate i2c drivers through ACPI with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Dan O'Donovan <dan@emutex.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i2c/i2c-core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 583e950..6e99431 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -221,7 +221,12 @@ static int i2c_acpi_get_info(struct acpi_device *adev,
 
 	acpi_dev_free_resource_list(&resource_list);
 
-	strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
+	/*
+	 * Populate modalias from compatible property if available,
+	 * otherwise use native ACPI information
+	 */
+	if (acpi_of_modalias(adev, info->type, sizeof(info->type)))
+		strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
 
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v4 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-01-27 13:30   ` [PATCH v4 " Dan O'Donovan
  2017-01-27 13:30     ` [PATCH v4 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
  2017-01-27 13:30     ` [PATCH v4 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
@ 2017-01-27 13:30     ` Dan O'Donovan
  2017-02-01 18:34       ` Mark Brown
  2017-02-04  8:00     ` [PATCH v5 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
  3 siblings, 1 reply; 48+ messages in thread
From: Dan O'Donovan @ 2017-01-27 13:30 UTC (permalink / raw)
  To: linux-acpi, Andy Shevchenko, Rafael J . Wysocki, Jarkko Nikula,
	Mika Westerberg, Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan, Crestez Dan Leonard

From: Crestez Dan Leonard <leonard.crestez@intel.com>

When using devicetree spi_device.modalias is set to the compatible
string with the vendor prefix removed. For SPI devices described via
ACPI the spi_device.modalias string is initialized by acpi_device_hid.
When using ACPI and DT ids this string ends up something like "PRP0001".

Change acpi_register_spi_device to use the of_compatible property if
present. This makes it easier to instantiate spi drivers through ACPI
with DT ids.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Dan O'Donovan <dan@emutex.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/spi/spi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 656dd3e..9a8c880 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1722,13 +1722,20 @@ static acpi_status acpi_register_spi_device(struct spi_master *master,
 		return AE_OK;
 	}
 
+	/*
+	 * Populate modalias from compatible property if available,
+	 * otherwise use native ACPI information
+	 */
+	if (acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias)))
+		strlcpy(spi->modalias, acpi_device_hid(adev),
+			sizeof(spi->modalias));
+
 	if (spi->irq < 0)
 		spi->irq = acpi_dev_gpio_irq_get(adev, 0);
 
 	acpi_device_set_enumerated(adev);
 
 	adev->power.flags.ignore_parent = true;
-	strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
 	if (spi_add_device(spi)) {
 		adev->power.flags.ignore_parent = false;
 		dev_err(&master->dev, "failed to add SPI device %s from ACPI\n",
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-01-27 10:35         ` Dan O'Donovan
@ 2017-01-27 13:43           ` Andy Shevchenko
  0 siblings, 0 replies; 48+ messages in thread
From: Andy Shevchenko @ 2017-01-27 13:43 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	linux-kernel, Crestez Dan Leonard

On Fri, Jan 27, 2017 at 12:35 PM, Dan O'Donovan <dan@emutex.com> wrote:
> On 01/23/2017 05:11 PM, Andy Shevchenko wrote:
>> On Mon, Jan 23, 2017 at 6:08 PM, Dan O'Donovan <dan@emutex.com> wrote:

>>> +               strlcpy(spi->modalias, acpi_device_hid(adev),
>>> +                       sizeof(spi->modalias));
>> Could this be one line?
> I couldn't see a way to reduce this to one line without exceeding 80
> chars or adding another line somewhere else, so I'll leave this one as
> it is if that's ok.

80 characters per line is not carved in stone. How many do you have
over? 3 like "s);"?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v4 2/3] i2c: acpi: Initialize info.type from of_compatible
  2017-01-27 13:30     ` [PATCH v4 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
@ 2017-01-28 21:38       ` Wolfram Sang
  0 siblings, 0 replies; 48+ messages in thread
From: Wolfram Sang @ 2017-01-28 21:38 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi, Andy Shevchenko, Rafael J . Wysocki, Jarkko Nikula,
	Mika Westerberg, Mark Brown, Len Brown, linux-i2c, linux-spi,
	linux-kernel, Crestez Dan Leonard

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

On Fri, Jan 27, 2017 at 01:30:14PM +0000, Dan O'Donovan wrote:
> From: Crestez Dan Leonard <leonard.crestez@intel.com>
> 
> When using devicetree i2c_board_info.type is set to the compatible
> string with the vendor prefix removed. For I2C devices described via
> ACPI the i2c_board_info.type string is set to the ACPI device name. When
> using ACPI and DT ids this string ends up something like "PRP0001:00".
> 
> If the of_compatible property is present try to use that instead. This
> makes it easier to instantiate i2c drivers through ACPI with DT ids.
> 
> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
> Signed-off-by: Dan O'Donovan <dan@emutex.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

I assume this shall go in as one series via ACPI tree, so:

Acked-by: Wolfram Sang <wsa@the-dreams.de>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-01-23 16:08     ` [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible Dan O'Donovan
  2017-01-23 17:11       ` Andy Shevchenko
@ 2017-01-30  9:41       ` Rafael J. Wysocki
  2017-01-31 20:17         ` Mark Brown
  1 sibling, 1 reply; 48+ messages in thread
From: Rafael J. Wysocki @ 2017-01-30  9:41 UTC (permalink / raw)
  To: Dan O'Donovan, Mark Brown
  Cc: ACPI Devel Maling List, Rafael J . Wysocki, Jarkko Nikula,
	Mika Westerberg, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	Linux Kernel Mailing List, Crestez Dan Leonard

On Mon, Jan 23, 2017 at 5:08 PM, Dan O'Donovan <dan@emutex.com> wrote:
> From: Crestez Dan Leonard <leonard.crestez@intel.com>
>
> When using devicetree spi_device.modalias is set to the compatible
> string with the vendor prefix removed. For SPI devices described via
> ACPI the spi_device.modalias string is initialized by acpi_device_hid.
> When using ACPI and DT ids this string ends up something like "PRP0001".
>
> Change acpi_register_spi_device to use the of_compatible property if
> present. This makes it easier to instantiate spi drivers through ACPI
> with DT ids.
>
> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
> Signed-off-by: Dan O'Donovan <dan@emutex.com>
> ---
>  drivers/spi/spi.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 656dd3e..4b562e8 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1722,13 +1722,21 @@ static acpi_status acpi_register_spi_device(struct spi_master *master,
>                 return AE_OK;
>         }
>
> +       /*
> +        * Populate modalias from compatible property if available,
> +        * otherwise use native ACPI information
> +        */
> +       if ((!adev->data.of_compatible) ||
> +           acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias)))
> +               strlcpy(spi->modalias, acpi_device_hid(adev),
> +                       sizeof(spi->modalias));
> +
>         if (spi->irq < 0)
>                 spi->irq = acpi_dev_gpio_irq_get(adev, 0);
>
>         acpi_device_set_enumerated(adev);
>
>         adev->power.flags.ignore_parent = true;
> -       strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
>         if (spi_add_device(spi)) {
>                 adev->power.flags.ignore_parent = false;
>                 dev_err(&master->dev, "failed to add SPI device %s from ACPI\n",
> --

Mark, any objections here?

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-01-30  9:41       ` Rafael J. Wysocki
@ 2017-01-31 20:17         ` Mark Brown
       [not found]           ` <20170131201736.cmiyq2obzrhgdsck-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  0 siblings, 1 reply; 48+ messages in thread
From: Mark Brown @ 2017-01-31 20:17 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Dan O'Donovan, ACPI Devel Maling List, Rafael J . Wysocki,
	Jarkko Nikula, Mika Westerberg, Len Brown, linux-i2c,
	Wolfram Sang, linux-spi, Linux Kernel Mailing List,
	Crestez Dan Leonard

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

On Mon, Jan 30, 2017 at 10:41:33AM +0100, Rafael J. Wysocki wrote:
> On Mon, Jan 23, 2017 at 5:08 PM, Dan O'Donovan <dan@emutex.com> wrote:

> Mark, any objections here?

I've not looked yet, please allow a reasonable time for review (there
still seemed to be ongoing discussion at the ACPI level).  I continue to
be concerned about the amount of duplication and special casing that the
various firmware paths seem to entail.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible
       [not found]           ` <20170131201736.cmiyq2obzrhgdsck-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2017-01-31 21:18             ` Rafael J. Wysocki
  0 siblings, 0 replies; 48+ messages in thread
From: Rafael J. Wysocki @ 2017-01-31 21:18 UTC (permalink / raw)
  To: Rafael J. Wysocki, Dan O'Donovan, ACPI Devel Maling List,
	Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg, Len Brown,
	linux-i2c, Wolfram Sang, linux-spi, Linux Kernel Mailing List,
	Crestez Dan Leonard

On Tue, Jan 31, 2017 at 9:17 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Mon, Jan 30, 2017 at 10:41:33AM +0100, Rafael J. Wysocki wrote:
>> On Mon, Jan 23, 2017 at 5:08 PM, Dan O'Donovan <dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org> wrote:
>
>> Mark, any objections here?
>
> I've not looked yet, please allow a reasonable time for review

Sure, no problem at all.

> (there still seemed to be ongoing discussion at the ACPI level).

Honestly, I'm not sure what you mean.

The first patch in the series (which is the ACPI level here) does not
seem to be controversial at all and the i2c one has been acked
already.

> I continue to be concerned about the amount of duplication and special casing that the
> various firmware paths seem to entail.

Well, this particular change is relatively straightforward and one can
argue that it fixes a bug.  It does address a problem for sure.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v4 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-01-27 13:30     ` [PATCH v4 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
@ 2017-02-01 18:34       ` Mark Brown
  0 siblings, 0 replies; 48+ messages in thread
From: Mark Brown @ 2017-02-01 18:34 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi, Andy Shevchenko, Rafael J . Wysocki, Jarkko Nikula,
	Mika Westerberg, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	linux-kernel, Crestez Dan Leonard

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

On Fri, Jan 27, 2017 at 01:30:15PM +0000, Dan O'Donovan wrote:

> +	if (acpi_of_modalias(adev, spi->modalias, sizeof(spi->modalias)))
> +		strlcpy(spi->modalias, acpi_device_hid(adev),
> +			sizeof(spi->modalias));

I can't help but think that this would be simpler to use if the
interface were something like acpi_set_modalias() and it did the
fallback to the ACPI HID internally.  It'd both avoid a small amount of
code duplication and make the code read a bit more naturally - I have to
think to realise that this means "if there isn't an OF name use the
HID" since it looks like a boolean function.  Then again just putting a
!= 0 in the test would have the same effect probably.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v4 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  2017-01-27 13:30     ` [PATCH v4 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
@ 2017-02-02 11:41       ` Rafael J. Wysocki
  2017-02-02 13:30         ` Dan O'Donovan
  0 siblings, 1 reply; 48+ messages in thread
From: Rafael J. Wysocki @ 2017-02-02 11:41 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi, Andy Shevchenko, Jarkko Nikula, Mika Westerberg,
	Mark Brown, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	linux-kernel

On Friday, January 27, 2017 01:30:13 PM Dan O'Donovan wrote:
> From: Crestez Dan Leonard <leonard.crestez@intel.com>
> 
> When using devicetree stuff like i2c_client.name or spi_device.modalias
> is initialized to the first DT compatible id with the vendor prefix
> stripped. Since some drivers rely on this try to replicate it when using
> ACPI with DT ids.
> 
> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
> Signed-off-by: Dan O'Donovan <dan@emutex.com>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

First off, the original author of the patch doesn't seem to be reachable under
the Intel address any more, so his S-o-b is meaningless and it shouldn't be
there.  In such cases you can send the patch as From: you and give a credit
to the original author in the changelog.

Second, as Mark said ->

> ---
>  drivers/acpi/bus.c      | 35 +++++++++++++++++++++++++++++++++++
>  include/acpi/acpi_bus.h |  1 +
>  2 files changed, 36 insertions(+)
> 
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index 95855cb..8b9657f 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -677,6 +677,41 @@ static bool acpi_of_match_device(struct acpi_device *adev,
>  	return false;
>  }
>  
> +/**
> + * acpi_of_modalias - Like of_modalias_node for ACPI with DT ids
> + * @adev:	ACPI device object to match.
> + * @outstr:	Pointer to buffer for result
> + * @outlen:	Length of outstr value
> + *
> + * This is a counterpart of of_modalias_node() for struct acpi_device
> + * objects. If there is a compatible string for @adev, copy it to the
> + * @outstr location with the vendor prefix stripped.
> + *
> + * Returns 0 on success or negative errno on failure.
> + */
> +int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen)

-> this could be a bool function and you could provide something like
acpi_set_modalias() doing the entire

if (!acpi_of_modalias(adev, outstr, outlen))
               strlcpy(outstr, dev_name(&adev->dev), outlen);

thing, so that its users don't have to duplicate this conditional.

And then acpi_of_modalias() could be static and the only thing to export
would be acpi_set_modalias().

> +{
> +	const union acpi_object *of_compatible;
> +	const union acpi_object *obj;
> +	const char *str, *chr;
> +
> +	of_compatible = adev->data.of_compatible;
> +	if (!of_compatible)
> +		return -ENODEV;
> +
> +	if (of_compatible->type == ACPI_TYPE_PACKAGE)
> +		obj = of_compatible->package.elements;
> +	else /* Must be ACPI_TYPE_STRING. */
> +		obj = of_compatible;
> +
> +	str = obj->string.pointer;
> +	chr = strchr(str, ',');
> +	strlcpy(outstr, chr ? chr + 1 : str, outlen);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(acpi_of_modalias);
> +
>  static bool __acpi_match_device_cls(const struct acpi_device_id *id,
>  				    struct acpi_hardware_id *hwid)
>  {
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index 4242c31..351b4a4 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -522,6 +522,7 @@ void acpi_bus_trim(struct acpi_device *start);
>  acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
>  int acpi_match_device_ids(struct acpi_device *device,
>  			  const struct acpi_device_id *ids);
> +int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen);
>  int acpi_create_dir(struct acpi_device *);
>  void acpi_remove_dir(struct acpi_device *);

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v4 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  2017-02-02 11:41       ` Rafael J. Wysocki
@ 2017-02-02 13:30         ` Dan O'Donovan
  0 siblings, 0 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-02 13:30 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-acpi, Andy Shevchenko, Jarkko Nikula, Mika Westerberg,
	Mark Brown, Len Brown, linux-i2c, Wolfram Sang, linux-spi,
	linux-kernel

On 02/02/2017 11:41 AM, Rafael J. Wysocki wrote:
> On Friday, January 27, 2017 01:30:13 PM Dan O'Donovan wrote:
>> From: Crestez Dan Leonard <leonard.crestez@intel.com>
>>
>> When using devicetree stuff like i2c_client.name or spi_device.modalias
>> is initialized to the first DT compatible id with the vendor prefix
>> stripped. Since some drivers rely on this try to replicate it when using
>> ACPI with DT ids.
>>
>> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
>> Signed-off-by: Dan O'Donovan <dan@emutex.com>
>> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>> Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
>> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> First off, the original author of the patch doesn't seem to be reachable under
> the Intel address any more, so his S-o-b is meaningless and it shouldn't be
> there.  In such cases you can send the patch as From: you and give a credit
> to the original author in the changelog.
>
> Second, as Mark said ->
>
>> ---
>>  drivers/acpi/bus.c      | 35 +++++++++++++++++++++++++++++++++++
>>  include/acpi/acpi_bus.h |  1 +
>>  2 files changed, 36 insertions(+)
>>
>> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
>> index 95855cb..8b9657f 100644
>> --- a/drivers/acpi/bus.c
>> +++ b/drivers/acpi/bus.c
>> @@ -677,6 +677,41 @@ static bool acpi_of_match_device(struct acpi_device *adev,
>>  	return false;
>>  }
>>  
>> +/**
>> + * acpi_of_modalias - Like of_modalias_node for ACPI with DT ids
>> + * @adev:	ACPI device object to match.
>> + * @outstr:	Pointer to buffer for result
>> + * @outlen:	Length of outstr value
>> + *
>> + * This is a counterpart of of_modalias_node() for struct acpi_device
>> + * objects. If there is a compatible string for @adev, copy it to the
>> + * @outstr location with the vendor prefix stripped.
>> + *
>> + * Returns 0 on success or negative errno on failure.
>> + */
>> +int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen)
> -> this could be a bool function and you could provide something like
> acpi_set_modalias() doing the entire
>
> if (!acpi_of_modalias(adev, outstr, outlen))
>                strlcpy(outstr, dev_name(&adev->dev), outlen);
>
> thing, so that its users don't have to duplicate this conditional.
>
> And then acpi_of_modalias() could be static and the only thing to export
> would be acpi_set_modalias().
Thanks Mark and Rafael for the latest feedback.  Those suggestions make
sense.  I'll send an updated patch-set soon.
>
>> +{
>> +	const union acpi_object *of_compatible;
>> +	const union acpi_object *obj;
>> +	const char *str, *chr;
>> +
>> +	of_compatible = adev->data.of_compatible;
>> +	if (!of_compatible)
>> +		return -ENODEV;
>> +
>> +	if (of_compatible->type == ACPI_TYPE_PACKAGE)
>> +		obj = of_compatible->package.elements;
>> +	else /* Must be ACPI_TYPE_STRING. */
>> +		obj = of_compatible;
>> +
>> +	str = obj->string.pointer;
>> +	chr = strchr(str, ',');
>> +	strlcpy(outstr, chr ? chr + 1 : str, outlen);
>> +
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(acpi_of_modalias);
>> +
>>  static bool __acpi_match_device_cls(const struct acpi_device_id *id,
>>  				    struct acpi_hardware_id *hwid)
>>  {
>> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
>> index 4242c31..351b4a4 100644
>> --- a/include/acpi/acpi_bus.h
>> +++ b/include/acpi/acpi_bus.h
>> @@ -522,6 +522,7 @@ void acpi_bus_trim(struct acpi_device *start);
>>  acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
>>  int acpi_match_device_ids(struct acpi_device *device,
>>  			  const struct acpi_device_id *ids);
>> +int acpi_of_modalias(struct acpi_device *adev, char *outstr, size_t outlen);
>>  int acpi_create_dir(struct acpi_device *);
>>  void acpi_remove_dir(struct acpi_device *);
> Thanks,
> Rafael
>
>


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v5 0/3] Init device ids from ACPI of_compatible
  2017-01-27 13:30   ` [PATCH v4 " Dan O'Donovan
                       ` (2 preceding siblings ...)
  2017-01-27 13:30     ` [PATCH v4 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
@ 2017-02-04  8:00     ` Dan O'Donovan
  2017-02-04  8:00       ` [PATCH v5 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
                         ` (3 more replies)
  3 siblings, 4 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-04  8:00 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

When using devicetree, stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this in order to differentiate between
hardware variants, try to replicate it when using ACPI with DT ids.

This also makes it so that the i2c_device_id parameter passed to probe is
non-NULL when matching with ACPI and DT ids.

Tested using ACPI overlays but there is no actual dependency. This series
just extends the PRP0001 feature to be more useful for I2C/SPI.

The patches only touches the ACPI-specific parts of the i2c and spi core.

Here is an example .dsl for an SPI accelerometer connected to minnowboard max:

Device (ACCL)
{
    Name (_ADR, Zero)
    Name (_HID, "PRP0001")
    Name (_UID, One)

    Method (_CRS, 0, Serialized)
    {
	Name (RBUF, ResourceTemplate ()
	{
	    SPISerialBus(1, PolarityLow, FourWireMode, 16,
		    ControllerInitiated, 1000000, ClockPolarityLow,
		    ClockPhaseFirst, "\\_SB.SPI1",)
	    GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
		     "\\_SB.GPO2", 0x00, ResourceConsumer, , )
	    { // Pin list
		    1
	    }
	})
	Return (RBUF)
    }
    Name (_DSD, Package ()
    {
	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
	Package ()
	{
	    Package () {"compatible", "st,lis3dh"},
	}
    })
}

Credit to Leonard Crestez for the original version of this patch set.

Link to v4: http://www.spinics.net/lists/linux-acpi/msg71657.html
Changes:
 * add acpi_set_modalias wrapper to handle fallback to ACPI ID (Mark Brown)

Link to v3: http://www.spinics.net/lists/linux-acpi/msg71531.html
Changes:
 * Minor cosmetic/readability improvements (Andy Shevchenko)

Link to v2: https://lkml.org/lkml/2016/7/13/392
Changes:
 * Use appropriate subject prefix for each subsystem (Mark Brown)
 * Use ACPI info as before if getting OF info fails (Mark Brown)
 * Minor cosmetic/readability improvements (Rafael J. Wysocki)

Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
Changes:
 * Rebase on after acpi overlays got it.
 * Change acpi_of_modalias outlen param to size_t
 * Use {} after else

Dan O'Donovan (3):
  ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  i2c: acpi: Initialize info.type from of_compatible
  spi: acpi: Initialize modalias from of_compatible

 drivers/acpi/bus.c      | 42 ++++++++++++++++++++++++++++++++++++++++++
 drivers/i2c/i2c-core.c  |  3 ++-
 drivers/spi/spi.c       |  4 +++-
 include/acpi/acpi_bus.h |  2 ++
 4 files changed, 49 insertions(+), 2 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v5 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  2017-02-04  8:00     ` [PATCH v5 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
@ 2017-02-04  8:00       ` Dan O'Donovan
       [not found]       ` <1486195228-10929-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-04  8:00 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

When using devicetree stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this try to replicate it when using
ACPI with DT ids.

Signed-off-by: Dan O'Donovan <dan@emutex.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/acpi/bus.c      | 42 ++++++++++++++++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h |  2 ++
 2 files changed, 44 insertions(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 95855cb..80cb5eb 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -677,6 +677,48 @@ static bool acpi_of_match_device(struct acpi_device *adev,
 	return false;
 }
 
+static bool acpi_of_modalias(struct acpi_device *adev,
+			     char *modalias, size_t len)
+{
+	const union acpi_object *of_compatible;
+	const union acpi_object *obj;
+	const char *str, *chr;
+
+	of_compatible = adev->data.of_compatible;
+	if (!of_compatible)
+		return false;
+
+	if (of_compatible->type == ACPI_TYPE_PACKAGE)
+		obj = of_compatible->package.elements;
+	else /* Must be ACPI_TYPE_STRING. */
+		obj = of_compatible;
+
+	str = obj->string.pointer;
+	chr = strchr(str, ',');
+	strlcpy(modalias, chr ? chr + 1 : str, len);
+
+	return true;
+}
+
+/**
+ * acpi_set_modalias - Set modalias using "compatible" property or supplied ID
+ * @adev:	ACPI device object to match
+ * @default_id:	ID string to use as default if no compatible string found
+ * @modalias:   Pointer to buffer that modalias value will be copied into
+ * @len:	Length of modalias buffer
+ *
+ * This is a counterpart of of_modalias_node() for struct acpi_device objects.
+ * If there is a compatible string for @adev, it will be copied to @modalias
+ * with the vendor prefix stripped; otherwise, @default_id will be used.
+ */
+void acpi_set_modalias(struct acpi_device *adev, const char *default_id,
+		       char *modalias, size_t len)
+{
+	if (!acpi_of_modalias(adev, modalias, len))
+		strlcpy(modalias, default_id, len);
+}
+EXPORT_SYMBOL_GPL(acpi_set_modalias);
+
 static bool __acpi_match_device_cls(const struct acpi_device_id *id,
 				    struct acpi_hardware_id *hwid)
 {
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 4242c31..ef0ae8a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -522,6 +522,8 @@ void acpi_bus_trim(struct acpi_device *start);
 acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
 int acpi_match_device_ids(struct acpi_device *device,
 			  const struct acpi_device_id *ids);
+void acpi_set_modalias(struct acpi_device *adev, const char *default_id,
+		       char *modalias, size_t len);
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v5 2/3] i2c: acpi: Initialize info.type from of_compatible
       [not found]       ` <1486195228-10929-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
@ 2017-02-04  8:00         ` Dan O'Donovan
  0 siblings, 0 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-04  8:00 UTC (permalink / raw)
  To: linux-acpi-u79uwXL29TY76Z2rM5mHXA, Rafael J . Wysocki,
	Jarkko Nikula, Mika Westerberg, Mark Brown
  Cc: Len Brown, linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Dan O'Donovan

When using devicetree i2c_board_info.type is set to the compatible
string with the vendor prefix removed. For I2C devices described via
ACPI the i2c_board_info.type string is set to the ACPI device name. When
using ACPI and DT ids this string ends up something like "PRP0001:00".

If the of_compatible property is present try to use that instead. This
makes it easier to instantiate i2c drivers through ACPI with DT ids.

Signed-off-by: Dan O'Donovan <dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Reviewed-by: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Tested-by: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Acked-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
---
 drivers/i2c/i2c-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 583e950..28d2181 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -221,7 +221,8 @@ static int i2c_acpi_get_info(struct acpi_device *adev,
 
 	acpi_dev_free_resource_list(&resource_list);
 
-	strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
+	acpi_set_modalias(adev, dev_name(&adev->dev),
+			  info->type, sizeof(info->type));
 
 	return 0;
 }
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v5 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-02-04  8:00     ` [PATCH v5 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
  2017-02-04  8:00       ` [PATCH v5 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
       [not found]       ` <1486195228-10929-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
@ 2017-02-04  8:00       ` Dan O'Donovan
  2017-02-04 10:16         ` Mark Brown
  2017-02-05 16:30       ` [PATCH v6 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
  3 siblings, 1 reply; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-04  8:00 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

When using devicetree spi_device.modalias is set to the compatible
string with the vendor prefix removed. For SPI devices described via
ACPI the spi_device.modalias string is initialized by acpi_device_hid.
When using ACPI and DT ids this string ends up something like "PRP0001".

Change acpi_register_spi_device to use the of_compatible property if
present. This makes it easier to instantiate spi drivers through ACPI
with DT ids.

Signed-off-by: Dan O'Donovan <dan@emutex.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/spi/spi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 656dd3e..d9afc32 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1722,13 +1722,15 @@ static acpi_status acpi_register_spi_device(struct spi_master *master,
 		return AE_OK;
 	}
 
+	acpi_set_modalias(adev, acpi_device_hid(adev),
+			  spi->modalias, sizeof(spi->modalias));
+
 	if (spi->irq < 0)
 		spi->irq = acpi_dev_gpio_irq_get(adev, 0);
 
 	acpi_device_set_enumerated(adev);
 
 	adev->power.flags.ignore_parent = true;
-	strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
 	if (spi_add_device(spi)) {
 		adev->power.flags.ignore_parent = false;
 		dev_err(&master->dev, "failed to add SPI device %s from ACPI\n",
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH v5 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-02-04  8:00       ` [PATCH v5 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
@ 2017-02-04 10:16         ` Mark Brown
  0 siblings, 0 replies; 48+ messages in thread
From: Mark Brown @ 2017-02-04 10:16 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

On Sat, Feb 04, 2017 at 08:00:28AM +0000, Dan O'Donovan wrote:

> +	acpi_set_modalias(adev, acpi_device_hid(adev),
> +			  spi->modalias, sizeof(spi->modalias));
> +

The formatting here is really weird (why isn't the third argument on the
line above?) but otherwise

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v6 0/3] Init device ids from ACPI of_compatible
  2017-02-04  8:00     ` [PATCH v5 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
                         ` (2 preceding siblings ...)
  2017-02-04  8:00       ` [PATCH v5 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
@ 2017-02-05 16:30       ` Dan O'Donovan
  2017-02-05 16:30         ` [PATCH v6 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
                           ` (3 more replies)
  3 siblings, 4 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-05 16:30 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

When using devicetree, stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this in order to differentiate between
hardware variants, try to replicate it when using ACPI with DT ids.

This also makes it so that the i2c_device_id parameter passed to probe is
non-NULL when matching with ACPI and DT ids.

Tested using ACPI overlays but there is no actual dependency. This series
just extends the PRP0001 feature to be more useful for I2C/SPI.

The patches only touches the ACPI-specific parts of the i2c and spi core.

Here is an example .dsl for an SPI accelerometer connected to minnowboard max:

Device (ACCL)
{
    Name (_ADR, Zero)
    Name (_HID, "PRP0001")
    Name (_UID, One)

    Method (_CRS, 0, Serialized)
    {
	Name (RBUF, ResourceTemplate ()
	{
	    SPISerialBus(1, PolarityLow, FourWireMode, 16,
		    ControllerInitiated, 1000000, ClockPolarityLow,
		    ClockPhaseFirst, "\\_SB.SPI1",)
	    GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
		     "\\_SB.GPO2", 0x00, ResourceConsumer, , )
	    { // Pin list
		    1
	    }
	})
	Return (RBUF)
    }
    Name (_DSD, Package ()
    {
	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
	Package ()
	{
	    Package () {"compatible", "st,lis3dh"},
	}
    })
}

Credit to Leonard Crestez for the original version of this patch set.

Link to v5: http://www.spinics.net/lists/linux-acpi/msg71902.html
Changes:
 * Change formatting of arguments passed to acpi_set_modalias (Mark Brown)

Link to v4: http://www.spinics.net/lists/linux-acpi/msg71657.html
Changes:
 * add acpi_set_modalias wrapper to handle fallback to ACPI ID (Mark Brown)

Link to v3: http://www.spinics.net/lists/linux-acpi/msg71531.html
Changes:
 * Minor cosmetic/readability improvements (Andy Shevchenko)

Link to v2: https://lkml.org/lkml/2016/7/13/392
Changes:
 * Use appropriate subject prefix for each subsystem (Mark Brown)
 * Use ACPI info as before if getting OF info fails (Mark Brown)
 * Minor cosmetic/readability improvements (Rafael J. Wysocki)

Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
Changes:
 * Rebase on after acpi overlays got it.
 * Change acpi_of_modalias outlen param to size_t
 * Use {} after else

Dan O'Donovan (3):
  ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  i2c: acpi: Initialize info.type from of_compatible
  spi: acpi: Initialize modalias from of_compatible

 drivers/acpi/bus.c      | 42 ++++++++++++++++++++++++++++++++++++++++++
 drivers/i2c/i2c-core.c  |  3 ++-
 drivers/spi/spi.c       |  4 +++-
 include/acpi/acpi_bus.h |  2 ++
 4 files changed, 49 insertions(+), 2 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v6 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
  2017-02-05 16:30       ` [PATCH v6 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
@ 2017-02-05 16:30         ` Dan O'Donovan
  2017-02-05 16:30         ` [PATCH v6 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-05 16:30 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

When using devicetree stuff like i2c_client.name or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this try to replicate it when using
ACPI with DT ids.

Signed-off-by: Dan O'Donovan <dan@emutex.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/acpi/bus.c      | 42 ++++++++++++++++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h |  2 ++
 2 files changed, 44 insertions(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 95855cb..80cb5eb 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -677,6 +677,48 @@ static bool acpi_of_match_device(struct acpi_device *adev,
 	return false;
 }
 
+static bool acpi_of_modalias(struct acpi_device *adev,
+			     char *modalias, size_t len)
+{
+	const union acpi_object *of_compatible;
+	const union acpi_object *obj;
+	const char *str, *chr;
+
+	of_compatible = adev->data.of_compatible;
+	if (!of_compatible)
+		return false;
+
+	if (of_compatible->type == ACPI_TYPE_PACKAGE)
+		obj = of_compatible->package.elements;
+	else /* Must be ACPI_TYPE_STRING. */
+		obj = of_compatible;
+
+	str = obj->string.pointer;
+	chr = strchr(str, ',');
+	strlcpy(modalias, chr ? chr + 1 : str, len);
+
+	return true;
+}
+
+/**
+ * acpi_set_modalias - Set modalias using "compatible" property or supplied ID
+ * @adev:	ACPI device object to match
+ * @default_id:	ID string to use as default if no compatible string found
+ * @modalias:   Pointer to buffer that modalias value will be copied into
+ * @len:	Length of modalias buffer
+ *
+ * This is a counterpart of of_modalias_node() for struct acpi_device objects.
+ * If there is a compatible string for @adev, it will be copied to @modalias
+ * with the vendor prefix stripped; otherwise, @default_id will be used.
+ */
+void acpi_set_modalias(struct acpi_device *adev, const char *default_id,
+		       char *modalias, size_t len)
+{
+	if (!acpi_of_modalias(adev, modalias, len))
+		strlcpy(modalias, default_id, len);
+}
+EXPORT_SYMBOL_GPL(acpi_set_modalias);
+
 static bool __acpi_match_device_cls(const struct acpi_device_id *id,
 				    struct acpi_hardware_id *hwid)
 {
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 4242c31..ef0ae8a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -522,6 +522,8 @@ void acpi_bus_trim(struct acpi_device *start);
 acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
 int acpi_match_device_ids(struct acpi_device *device,
 			  const struct acpi_device_id *ids);
+void acpi_set_modalias(struct acpi_device *adev, const char *default_id,
+		       char *modalias, size_t len);
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v6 2/3] i2c: acpi: Initialize info.type from of_compatible
  2017-02-05 16:30       ` [PATCH v6 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
  2017-02-05 16:30         ` [PATCH v6 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
@ 2017-02-05 16:30         ` Dan O'Donovan
  2017-02-05 16:30         ` [PATCH v6 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
       [not found]         ` <1486312214-20770-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
  3 siblings, 0 replies; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-05 16:30 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

When using devicetree i2c_board_info.type is set to the compatible
string with the vendor prefix removed. For I2C devices described via
ACPI the i2c_board_info.type string is set to the ACPI device name. When
using ACPI and DT ids this string ends up something like "PRP0001:00".

If the of_compatible property is present try to use that instead. This
makes it easier to instantiate i2c drivers through ACPI with DT ids.

Signed-off-by: Dan O'Donovan <dan@emutex.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
---
 drivers/i2c/i2c-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 583e950..1e52395 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -221,7 +221,8 @@ static int i2c_acpi_get_info(struct acpi_device *adev,
 
 	acpi_dev_free_resource_list(&resource_list);
 
-	strlcpy(info->type, dev_name(&adev->dev), sizeof(info->type));
+	acpi_set_modalias(adev, dev_name(&adev->dev), info->type,
+			  sizeof(info->type));
 
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v6 3/3] spi: acpi: Initialize modalias from of_compatible
  2017-02-05 16:30       ` [PATCH v6 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
  2017-02-05 16:30         ` [PATCH v6 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
  2017-02-05 16:30         ` [PATCH v6 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
@ 2017-02-05 16:30         ` Dan O'Donovan
       [not found]           ` <1486312214-20770-4-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
       [not found]         ` <1486312214-20770-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
  3 siblings, 1 reply; 48+ messages in thread
From: Dan O'Donovan @ 2017-02-05 16:30 UTC (permalink / raw)
  To: linux-acpi, Rafael J . Wysocki, Jarkko Nikula, Mika Westerberg,
	Mark Brown
  Cc: Len Brown, linux-i2c, Wolfram Sang, linux-spi, linux-kernel,
	Dan O'Donovan

When using devicetree spi_device.modalias is set to the compatible
string with the vendor prefix removed. For SPI devices described via
ACPI the spi_device.modalias string is initialized by acpi_device_hid.
When using ACPI and DT ids this string ends up something like "PRP0001".

Change acpi_register_spi_device to use the of_compatible property if
present. This makes it easier to instantiate spi drivers through ACPI
with DT ids.

Signed-off-by: Dan O'Donovan <dan@emutex.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 656dd3e..ad7f638 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1722,13 +1722,15 @@ static acpi_status acpi_register_spi_device(struct spi_master *master,
 		return AE_OK;
 	}
 
+	acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias,
+			  sizeof(spi->modalias));
+
 	if (spi->irq < 0)
 		spi->irq = acpi_dev_gpio_irq_get(adev, 0);
 
 	acpi_device_set_enumerated(adev);
 
 	adev->power.flags.ignore_parent = true;
-	strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias));
 	if (spi_add_device(spi)) {
 		adev->power.flags.ignore_parent = false;
 		dev_err(&master->dev, "failed to add SPI device %s from ACPI\n",
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH v6 3/3] spi: acpi: Initialize modalias from of_compatible
       [not found]           ` <1486312214-20770-4-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
@ 2017-02-06 16:31             ` Mark Brown
  0 siblings, 0 replies; 48+ messages in thread
From: Mark Brown @ 2017-02-06 16:31 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA, Rafael J . Wysocki,
	Jarkko Nikula, Mika Westerberg, Len Brown,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

On Sun, Feb 05, 2017 at 04:30:14PM +0000, Dan O'Donovan wrote:
> When using devicetree spi_device.modalias is set to the compatible
> string with the vendor prefix removed. For SPI devices described via
> ACPI the spi_device.modalias string is initialized by acpi_device_hid.
> When using ACPI and DT ids this string ends up something like "PRP0001".

Acked-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH v6 0/3] Init device ids from ACPI of_compatible
       [not found]         ` <1486312214-20770-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
@ 2017-02-09 13:53           ` Rafael J. Wysocki
  0 siblings, 0 replies; 48+ messages in thread
From: Rafael J. Wysocki @ 2017-02-09 13:53 UTC (permalink / raw)
  To: Dan O'Donovan
  Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA, Jarkko Nikula,
	Mika Westerberg, Mark Brown, Len Brown,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Sunday, February 05, 2017 04:30:11 PM Dan O'Donovan wrote:
> When using devicetree, stuff like i2c_client.name or spi_device.modalias
> is initialized to the first DT compatible id with the vendor prefix
> stripped. Since some drivers rely on this in order to differentiate between
> hardware variants, try to replicate it when using ACPI with DT ids.
> 
> This also makes it so that the i2c_device_id parameter passed to probe is
> non-NULL when matching with ACPI and DT ids.
> 
> Tested using ACPI overlays but there is no actual dependency. This series
> just extends the PRP0001 feature to be more useful for I2C/SPI.
> 
> The patches only touches the ACPI-specific parts of the i2c and spi core.
> 
> Here is an example .dsl for an SPI accelerometer connected to minnowboard max:
> 
> Device (ACCL)
> {
>     Name (_ADR, Zero)
>     Name (_HID, "PRP0001")
>     Name (_UID, One)
> 
>     Method (_CRS, 0, Serialized)
>     {
> 	Name (RBUF, ResourceTemplate ()
> 	{
> 	    SPISerialBus(1, PolarityLow, FourWireMode, 16,
> 		    ControllerInitiated, 1000000, ClockPolarityLow,
> 		    ClockPhaseFirst, "\\_SB.SPI1",)
> 	    GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
> 		     "\\_SB.GPO2", 0x00, ResourceConsumer, , )
> 	    { // Pin list
> 		    1
> 	    }
> 	})
> 	Return (RBUF)
>     }
>     Name (_DSD, Package ()
>     {
> 	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> 	Package ()
> 	{
> 	    Package () {"compatible", "st,lis3dh"},
> 	}
>     })
> }
> 
> Credit to Leonard Crestez for the original version of this patch set.
> 
> Link to v5: http://www.spinics.net/lists/linux-acpi/msg71902.html
> Changes:
>  * Change formatting of arguments passed to acpi_set_modalias (Mark Brown)
> 
> Link to v4: http://www.spinics.net/lists/linux-acpi/msg71657.html
> Changes:
>  * add acpi_set_modalias wrapper to handle fallback to ACPI ID (Mark Brown)
> 
> Link to v3: http://www.spinics.net/lists/linux-acpi/msg71531.html
> Changes:
>  * Minor cosmetic/readability improvements (Andy Shevchenko)
> 
> Link to v2: https://lkml.org/lkml/2016/7/13/392
> Changes:
>  * Use appropriate subject prefix for each subsystem (Mark Brown)
>  * Use ACPI info as before if getting OF info fails (Mark Brown)
>  * Minor cosmetic/readability improvements (Rafael J. Wysocki)
> 
> Link to v1: https://www.spinics.net/lists/linux-acpi/msg66469.html
> Changes:
>  * Rebase on after acpi overlays got it.
>  * Change acpi_of_modalias outlen param to size_t
>  * Use {} after else
> 
> Dan O'Donovan (3):
>   ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
>   i2c: acpi: Initialize info.type from of_compatible
>   spi: acpi: Initialize modalias from of_compatible

All [1-3/3] applied.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2017-02-09 13:53 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-13 11:53 [PATCH v2 0/3] Init device ids from ACPI of_compatible Crestez Dan Leonard
2016-07-13 11:53 ` [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible Crestez Dan Leonard
2016-07-13 12:22   ` Rafael J. Wysocki
2016-07-19  7:08     ` Mika Westerberg
2016-07-19 10:22   ` Mark Brown
2016-07-20 11:21     ` Crestez Dan Leonard
2016-07-20 11:37       ` Mark Brown
     [not found] ` <cover.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-13 11:53   ` [PATCH v2 1/3] acpi: Export acpi_of_modalias equiv of of_modalias_node Crestez Dan Leonard
     [not found]     ` <fde8d7c9312a887553feab9877a33f01e5ceda47.1468409668.git.leonard.crestez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-13 12:19       ` Rafael J. Wysocki
2016-07-19  7:14       ` Mika Westerberg
2016-07-13 11:53   ` [PATCH v2 2/3] acpi i2c: Initialize info.type from of_compatible Crestez Dan Leonard
2016-07-13 12:20     ` Rafael J. Wysocki
     [not found]       ` <CAJZ5v0jz-E0RTBWVzO0Vc_jChUSeSseFeewi1UtsjLudoVP7Pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-19  7:07         ` Mika Westerberg
2016-07-13 12:09   ` [PATCH v2 0/3] Init device ids from ACPI of_compatible Rafael J. Wysocki
2016-07-13 14:15 ` Dan O'Donovan
2017-01-23 16:08 ` [PATCH v3 " Dan O'Donovan
2017-01-23 16:08   ` [PATCH v3 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
2017-01-23 17:10     ` Andy Shevchenko
     [not found]   ` <1485187737-22414-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
2017-01-23 16:08     ` [PATCH v3 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
2017-01-23 16:08     ` [PATCH v3 3/3] spi: acpi: Initialize modalias from of_compatible Dan O'Donovan
2017-01-23 17:11       ` Andy Shevchenko
2017-01-27 10:35         ` Dan O'Donovan
2017-01-27 13:43           ` Andy Shevchenko
2017-01-30  9:41       ` Rafael J. Wysocki
2017-01-31 20:17         ` Mark Brown
     [not found]           ` <20170131201736.cmiyq2obzrhgdsck-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2017-01-31 21:18             ` Rafael J. Wysocki
2017-01-23 17:13   ` [PATCH v3 0/3] Init device ids from ACPI of_compatible Andy Shevchenko
2017-01-24 15:11   ` Jarkko Nikula
     [not found]     ` <6ff3138c-ac16-d310-28b7-cee0b0e5f11c-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-01-24 15:19       ` Andy Shevchenko
2017-01-27 13:30   ` [PATCH v4 " Dan O'Donovan
2017-01-27 13:30     ` [PATCH v4 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
2017-02-02 11:41       ` Rafael J. Wysocki
2017-02-02 13:30         ` Dan O'Donovan
2017-01-27 13:30     ` [PATCH v4 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
2017-01-28 21:38       ` Wolfram Sang
2017-01-27 13:30     ` [PATCH v4 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
2017-02-01 18:34       ` Mark Brown
2017-02-04  8:00     ` [PATCH v5 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
2017-02-04  8:00       ` [PATCH v5 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
     [not found]       ` <1486195228-10929-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
2017-02-04  8:00         ` [PATCH v5 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
2017-02-04  8:00       ` [PATCH v5 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
2017-02-04 10:16         ` Mark Brown
2017-02-05 16:30       ` [PATCH v6 0/3] Init device ids from ACPI of_compatible Dan O'Donovan
2017-02-05 16:30         ` [PATCH v6 1/3] ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node Dan O'Donovan
2017-02-05 16:30         ` [PATCH v6 2/3] i2c: acpi: Initialize info.type from of_compatible Dan O'Donovan
2017-02-05 16:30         ` [PATCH v6 3/3] spi: acpi: Initialize modalias " Dan O'Donovan
     [not found]           ` <1486312214-20770-4-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
2017-02-06 16:31             ` Mark Brown
     [not found]         ` <1486312214-20770-1-git-send-email-dan-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org>
2017-02-09 13:53           ` [PATCH v6 0/3] Init device ids from ACPI of_compatible Rafael J. Wysocki

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).