* FAILED: patch "[PATCH] ACPI / scan: Fix enumeration for special SPI and I2C devices" failed to apply to 4.11-stable tree
@ 2017-06-26 6:04 gregkh
2017-06-26 7:38 ` Jarkko Nikula
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2017-06-26 6:04 UTC (permalink / raw)
To: jarkko.nikula, mika.westerberg, rafael.j.wysocki, stable; +Cc: stable
The patch below does not apply to the 4.11-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From e4330d8bf669139a983255d1801733b64c2ae841 Mon Sep 17 00:00:00 2001
From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Date: Mon, 19 Jun 2017 15:53:01 +0300
Subject: [PATCH] ACPI / scan: Fix enumeration for special SPI and I2C devices
Commit f406270bf73d ("ACPI / scan: Set the visited flag for all
enumerated devices") caused that two group of special SPI or I2C
devices do not enumerate. SPI and I2C devices are expected to be
enumerated by the SPI and I2C subsystems but change caused that
acpi_bus_attach() marks those devices with acpi_device_set_enumerated().
First group of devices are matched using Device Tree compatible property
with special _HID "PRP0001". Those devices have matched scan handler,
acpi_scan_attach_handler() retuns 1 and acpi_bus_attach() marks them
with acpi_device_set_enumerated().
Second group of devices without valid _HID such as "LNXVIDEO" have
device->pnp.type.platform_id set to zero and change again marks them
with acpi_device_set_enumerated().
Fix this by flagging the SPI and I2C devices during struct acpi_device
object initialization time and let the code in acpi_bus_attach() to go
through the device_attach() and acpi_default_enumeration() path for all
SPI and I2C devices.
Fixes: f406270bf73d (ACPI / scan: Set the visited flag for all enumerated devices)
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: 4.11+ <stable@vger.kernel.org> # 4.11+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 3a10d7573477..d53162997f32 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1428,6 +1428,37 @@ static void acpi_init_coherency(struct acpi_device *adev)
adev->flags.coherent_dma = cca;
}
+static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
+{
+ bool *is_spi_i2c_slave_p = data;
+
+ if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
+ return 1;
+
+ /*
+ * devices that are connected to UART still need to be enumerated to
+ * platform bus
+ */
+ if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
+ *is_spi_i2c_slave_p = true;
+
+ /* no need to do more checking */
+ return -1;
+}
+
+static bool acpi_is_spi_i2c_slave(struct acpi_device *device)
+{
+ struct list_head resource_list;
+ bool is_spi_i2c_slave = false;
+
+ INIT_LIST_HEAD(&resource_list);
+ acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
+ &is_spi_i2c_slave);
+ acpi_dev_free_resource_list(&resource_list);
+
+ return is_spi_i2c_slave;
+}
+
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
int type, unsigned long long sta)
{
@@ -1443,6 +1474,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
acpi_bus_get_flags(device);
device->flags.match_driver = false;
device->flags.initialized = true;
+ device->flags.spi_i2c_slave = acpi_is_spi_i2c_slave(device);
acpi_device_clear_enumerated(device);
device_initialize(&device->dev);
dev_set_uevent_suppress(&device->dev, true);
@@ -1727,38 +1759,13 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
return AE_OK;
}
-static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
-{
- bool *is_spi_i2c_slave_p = data;
-
- if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
- return 1;
-
- /*
- * devices that are connected to UART still need to be enumerated to
- * platform bus
- */
- if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
- *is_spi_i2c_slave_p = true;
-
- /* no need to do more checking */
- return -1;
-}
-
static void acpi_default_enumeration(struct acpi_device *device)
{
- struct list_head resource_list;
- bool is_spi_i2c_slave = false;
-
/*
* Do not enumerate SPI/I2C slaves as they will be enumerated by their
* respective parents.
*/
- INIT_LIST_HEAD(&resource_list);
- acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
- &is_spi_i2c_slave);
- acpi_dev_free_resource_list(&resource_list);
- if (!is_spi_i2c_slave) {
+ if (!device->flags.spi_i2c_slave) {
acpi_create_platform_device(device, NULL);
acpi_device_set_enumerated(device);
} else {
@@ -1854,7 +1861,7 @@ static void acpi_bus_attach(struct acpi_device *device)
return;
device->flags.match_driver = true;
- if (ret > 0) {
+ if (ret > 0 && !device->flags.spi_i2c_slave) {
acpi_device_set_enumerated(device);
goto ok;
}
@@ -1863,10 +1870,10 @@ static void acpi_bus_attach(struct acpi_device *device)
if (ret < 0)
return;
- if (device->pnp.type.platform_id)
- acpi_default_enumeration(device);
- else
+ if (!device->pnp.type.platform_id && !device->flags.spi_i2c_slave)
acpi_device_set_enumerated(device);
+ else
+ acpi_default_enumeration(device);
ok:
list_for_each_entry(child, &device->children, node)
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 197f3fffc9a7..408c7820e200 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -210,7 +210,8 @@ struct acpi_device_flags {
u32 of_compatible_ok:1;
u32 coherent_dma:1;
u32 cca_seen:1;
- u32 reserved:20;
+ u32 spi_i2c_slave:1;
+ u32 reserved:19;
};
/* File System */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] ACPI / scan: Fix enumeration for special SPI and I2C devices" failed to apply to 4.11-stable tree
2017-06-26 6:04 FAILED: patch "[PATCH] ACPI / scan: Fix enumeration for special SPI and I2C devices" failed to apply to 4.11-stable tree gregkh
@ 2017-06-26 7:38 ` Jarkko Nikula
2017-06-26 12:20 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Nikula @ 2017-06-26 7:38 UTC (permalink / raw)
To: gregkh, mika.westerberg, rafael.j.wysocki, stable
Hi
On 06/26/2017 09:04 AM, gregkh@linuxfoundation.org wrote:
>
> The patch below does not apply to the 4.11-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> thanks,
>
> greg k-h
>
> ------------------ original commit in Linus's tree ------------------
>
> From e4330d8bf669139a983255d1801733b64c2ae841 Mon Sep 17 00:00:00 2001
> From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Date: Mon, 19 Jun 2017 15:53:01 +0300
> Subject: [PATCH] ACPI / scan: Fix enumeration for special SPI and I2C devices
>
Rafael: this was meant to queue to stable either together with commit
f5beabfe6179 ("ACPI / scan: Apply default enumeration to devices with
ACPI drivers") or have another version.
Although I don't know does f5beabfe6179 fix any regression I think best
would be to queue them together as end result will be the same if I cook
another version for stable.
--
Jarkko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] ACPI / scan: Fix enumeration for special SPI and I2C devices" failed to apply to 4.11-stable tree
2017-06-26 7:38 ` Jarkko Nikula
@ 2017-06-26 12:20 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-06-26 12:20 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: mika.westerberg, rafael.j.wysocki, stable
On Mon, Jun 26, 2017 at 10:38:16AM +0300, Jarkko Nikula wrote:
> Hi
>
> On 06/26/2017 09:04 AM, gregkh@linuxfoundation.org wrote:
> >
> > The patch below does not apply to the 4.11-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> >
> > thanks,
> >
> > greg k-h
> >
> > ------------------ original commit in Linus's tree ------------------
> >
> > From e4330d8bf669139a983255d1801733b64c2ae841 Mon Sep 17 00:00:00 2001
> > From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> > Date: Mon, 19 Jun 2017 15:53:01 +0300
> > Subject: [PATCH] ACPI / scan: Fix enumeration for special SPI and I2C devices
> >
> Rafael: this was meant to queue to stable either together with commit
> f5beabfe6179 ("ACPI / scan: Apply default enumeration to devices with ACPI
> drivers") or have another version.
>
> Although I don't know does f5beabfe6179 fix any regression I think best
> would be to queue them together as end result will be the same if I cook
> another version for stable.
No, I'll just take them together, let me see if that works...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-26 12:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-26 6:04 FAILED: patch "[PATCH] ACPI / scan: Fix enumeration for special SPI and I2C devices" failed to apply to 4.11-stable tree gregkh
2017-06-26 7:38 ` Jarkko Nikula
2017-06-26 12:20 ` Greg KH
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).