* [PATCH 0/2] ACPI: Device enumeration udates @ 2017-04-16 23:18 Rafael J. Wysocki 2017-04-16 23:19 ` [PATCH 1/2] ACPI / scan: Apply default enumeration to devices with ACPI drivers Rafael J. Wysocki 2017-04-16 23:20 ` [PATCH 2/2] ACPI / scan: Avoid enumerating devices more than once Rafael J. Wysocki 0 siblings, 2 replies; 7+ messages in thread From: Rafael J. Wysocki @ 2017-04-16 23:18 UTC (permalink / raw) To: Linux ACPI; +Cc: LKML, Mika Westerberg, Andy Shevchenko Hi, These two patches change a couple of things related to the ACPI enumeration of devices. [1/2] causes the default enumeration to also be used for device objects with ACPI drivers bound for consistency. [2/2] makes acpi_bus_attach() look at the "visited" flag of device objects as it should really. Please let me know if you see any potential problems with these patches. Thanks, Rafael ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ACPI / scan: Apply default enumeration to devices with ACPI drivers 2017-04-16 23:18 [PATCH 0/2] ACPI: Device enumeration udates Rafael J. Wysocki @ 2017-04-16 23:19 ` Rafael J. Wysocki 2017-04-18 10:21 ` Mika Westerberg 2017-04-19 16:38 ` joeyli 2017-04-16 23:20 ` [PATCH 2/2] ACPI / scan: Avoid enumerating devices more than once Rafael J. Wysocki 1 sibling, 2 replies; 7+ messages in thread From: Rafael J. Wysocki @ 2017-04-16 23:19 UTC (permalink / raw) To: Linux ACPI; +Cc: LKML, Mika Westerberg, Andy Shevchenko From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> The current code in acpi_bus_attach() is inconsistent with respect to device objects with ACPI drivers bound to them, as it allows ACPI drivers to bind to device objects with existing "physical" device companions, but it doesn't allow "physical" device objects to be created for ACPI device objects with ACPI drivers bound to them. Thus, in some cases, the outcome depends on the ordering of events which is confusing at best. For this reason, modify acpi_bus_attach() to call acpi_default_enumeration() for device objects with the pnp.type.platform_id flag set regardless of whether or not any ACPI drivers are bound to them. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/scan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -1866,10 +1866,10 @@ static void acpi_bus_attach(struct acpi_ if (ret < 0) return; - if (ret > 0 || !device->pnp.type.platform_id) - acpi_device_set_enumerated(device); - else + if (device->pnp.type.platform_id) acpi_default_enumeration(device); + else + acpi_device_set_enumerated(device); ok: list_for_each_entry(child, &device->children, node) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ACPI / scan: Apply default enumeration to devices with ACPI drivers 2017-04-16 23:19 ` [PATCH 1/2] ACPI / scan: Apply default enumeration to devices with ACPI drivers Rafael J. Wysocki @ 2017-04-18 10:21 ` Mika Westerberg 2017-04-19 16:38 ` joeyli 1 sibling, 0 replies; 7+ messages in thread From: Mika Westerberg @ 2017-04-18 10:21 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML, Andy Shevchenko On Mon, Apr 17, 2017 at 01:19:50AM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > The current code in acpi_bus_attach() is inconsistent with respect > to device objects with ACPI drivers bound to them, as it allows > ACPI drivers to bind to device objects with existing "physical" > device companions, but it doesn't allow "physical" device objects > to be created for ACPI device objects with ACPI drivers bound to > them. Thus, in some cases, the outcome depends on the ordering > of events which is confusing at best. > > For this reason, modify acpi_bus_attach() to call > acpi_default_enumeration() for device objects with the > pnp.type.platform_id flag set regardless of whether or not > any ACPI drivers are bound to them. > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ACPI / scan: Apply default enumeration to devices with ACPI drivers 2017-04-16 23:19 ` [PATCH 1/2] ACPI / scan: Apply default enumeration to devices with ACPI drivers Rafael J. Wysocki 2017-04-18 10:21 ` Mika Westerberg @ 2017-04-19 16:38 ` joeyli 1 sibling, 0 replies; 7+ messages in thread From: joeyli @ 2017-04-19 16:38 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML, Mika Westerberg, Andy Shevchenko On Mon, Apr 17, 2017 at 01:19:50AM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > The current code in acpi_bus_attach() is inconsistent with respect > to device objects with ACPI drivers bound to them, as it allows > ACPI drivers to bind to device objects with existing "physical" > device companions, but it doesn't allow "physical" device objects > to be created for ACPI device objects with ACPI drivers bound to > them. Thus, in some cases, the outcome depends on the ordering > of events which is confusing at best. > > For this reason, modify acpi_bus_attach() to call > acpi_default_enumeration() for device objects with the > pnp.type.platform_id flag set regardless of whether or not > any ACPI drivers are bound to them. > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> I did my best to review the context of codes in this patchset. Reviewed-by: Joey Lee <jlee@suse.com> Thanka a lot! Joey Lee > --- > drivers/acpi/scan.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > Index: linux-pm/drivers/acpi/scan.c > =================================================================== > --- linux-pm.orig/drivers/acpi/scan.c > +++ linux-pm/drivers/acpi/scan.c > @@ -1866,10 +1866,10 @@ static void acpi_bus_attach(struct acpi_ > if (ret < 0) > return; > > - if (ret > 0 || !device->pnp.type.platform_id) > - acpi_device_set_enumerated(device); > - else > + if (device->pnp.type.platform_id) > acpi_default_enumeration(device); > + else > + acpi_device_set_enumerated(device); > > ok: > list_for_each_entry(child, &device->children, node) > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] ACPI / scan: Avoid enumerating devices more than once 2017-04-16 23:18 [PATCH 0/2] ACPI: Device enumeration udates Rafael J. Wysocki 2017-04-16 23:19 ` [PATCH 1/2] ACPI / scan: Apply default enumeration to devices with ACPI drivers Rafael J. Wysocki @ 2017-04-16 23:20 ` Rafael J. Wysocki 2017-04-18 10:21 ` Mika Westerberg 2017-04-19 16:39 ` joeyli 1 sibling, 2 replies; 7+ messages in thread From: Rafael J. Wysocki @ 2017-04-16 23:20 UTC (permalink / raw) To: Linux ACPI; +Cc: LKML, Mika Westerberg, Andy Shevchenko From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> acpi_bus_attach() does not check the visited flag for devices that have been enumerated already and some of them may be enumerated for multiple times as a result, because some callers of acpi_bus_scan() don't check the visited flag either. For this reason, modify acpi_bus_attach() to check the visited flag and avoid enumerating devices that have already been enumerated. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/scan.c | 2 ++ 1 file changed, 2 insertions(+) Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -1850,6 +1850,8 @@ static void acpi_bus_attach(struct acpi_ device->flags.power_manageable = 0; device->flags.initialized = true; + } else if (device->flags.visited) { + goto ok; } ret = acpi_scan_attach_handler(device); ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ACPI / scan: Avoid enumerating devices more than once 2017-04-16 23:20 ` [PATCH 2/2] ACPI / scan: Avoid enumerating devices more than once Rafael J. Wysocki @ 2017-04-18 10:21 ` Mika Westerberg 2017-04-19 16:39 ` joeyli 1 sibling, 0 replies; 7+ messages in thread From: Mika Westerberg @ 2017-04-18 10:21 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML, Andy Shevchenko On Mon, Apr 17, 2017 at 01:20:48AM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > acpi_bus_attach() does not check the visited flag for devices that > have been enumerated already and some of them may be enumerated > for multiple times as a result, because some callers of > acpi_bus_scan() don't check the visited flag either. > > For this reason, modify acpi_bus_attach() to check the visited flag > and avoid enumerating devices that have already been enumerated. > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ACPI / scan: Avoid enumerating devices more than once 2017-04-16 23:20 ` [PATCH 2/2] ACPI / scan: Avoid enumerating devices more than once Rafael J. Wysocki 2017-04-18 10:21 ` Mika Westerberg @ 2017-04-19 16:39 ` joeyli 1 sibling, 0 replies; 7+ messages in thread From: joeyli @ 2017-04-19 16:39 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML, Mika Westerberg, Andy Shevchenko On Mon, Apr 17, 2017 at 01:20:48AM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > acpi_bus_attach() does not check the visited flag for devices that > have been enumerated already and some of them may be enumerated > for multiple times as a result, because some callers of > acpi_bus_scan() don't check the visited flag either. > > For this reason, modify acpi_bus_attach() to check the visited flag > and avoid enumerating devices that have already been enumerated. > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Joey Lee <jlee@suse.com> Thanka a lot! Joey Lee > --- > drivers/acpi/scan.c | 2 ++ > 1 file changed, 2 insertions(+) > > Index: linux-pm/drivers/acpi/scan.c > =================================================================== > --- linux-pm.orig/drivers/acpi/scan.c > +++ linux-pm/drivers/acpi/scan.c > @@ -1850,6 +1850,8 @@ static void acpi_bus_attach(struct acpi_ > device->flags.power_manageable = 0; > > device->flags.initialized = true; > + } else if (device->flags.visited) { > + goto ok; > } > > ret = acpi_scan_attach_handler(device); > > -- > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-04-19 16:40 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-04-16 23:18 [PATCH 0/2] ACPI: Device enumeration udates Rafael J. Wysocki 2017-04-16 23:19 ` [PATCH 1/2] ACPI / scan: Apply default enumeration to devices with ACPI drivers Rafael J. Wysocki 2017-04-18 10:21 ` Mika Westerberg 2017-04-19 16:38 ` joeyli 2017-04-16 23:20 ` [PATCH 2/2] ACPI / scan: Avoid enumerating devices more than once Rafael J. Wysocki 2017-04-18 10:21 ` Mika Westerberg 2017-04-19 16:39 ` joeyli
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox