linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Octavian Purdila <octavian.purdila@intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Mark Brown <broonie@kernel.org>, Wolfram Sang <wsa@the-dreams.de>
Cc: Joel Becker <jlbec@evilplan.org>,
	linux-acpi@vger.kernel.org, linux-efi@vger.kernel.org,
	linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org,
	linux-kernel@vger.kernel.org, irina.tirdea@intel.com,
	Octavian Purdila <octavian.purdila@intel.com>
Subject: [RFC PATCH v2 03/10] acpi: fix enumeration (visited) flags for bus rescans
Date: Wed, 20 Apr 2016 01:39:01 +0300	[thread overview]
Message-ID: <1461105548-20618-4-git-send-email-octavian.purdila@intel.com> (raw)
In-Reply-To: <1461105548-20618-1-git-send-email-octavian.purdila@intel.com>

If the ACPI tables changes as a result of a dinamically loaded table and
a bus rescan is required the enumeration/visited flag are not
consistent.

I2C/SPI are not directly enumerated in acpi_bus_attach(), however the
visited flag is set. This makes it impossible to check if an ACPI device
has already been enumerated by the I2C and SPI subsystems. To fix this
issue we only set the visited flags if the device is not I2C or SPI.

With this change we also need to remove setting visited to false from
acpi_bus_attach(), otherwise if we rescan already enumerated I2C/SPI
devices we try to re-enumerate them.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
---
 drivers/acpi/scan.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5f28cf7..7656ea4 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1670,7 +1670,7 @@ static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
 	return -1;
 }
 
-static void acpi_default_enumeration(struct acpi_device *device)
+static bool acpi_default_enumeration(struct acpi_device *device)
 {
 	struct list_head resource_list;
 	bool is_spi_i2c_slave = false;
@@ -1685,6 +1685,7 @@ static void acpi_default_enumeration(struct acpi_device *device)
 	acpi_dev_free_resource_list(&resource_list);
 	if (!is_spi_i2c_slave)
 		acpi_create_platform_device(device);
+	return !is_spi_i2c_slave;
 }
 
 static const struct acpi_device_id generic_device_ids[] = {
@@ -1744,6 +1745,7 @@ static void acpi_bus_attach(struct acpi_device *device)
 	struct acpi_device *child;
 	acpi_handle ejd;
 	int ret;
+	bool enumerated = true;
 
 	if (ACPI_SUCCESS(acpi_bus_get_ejd(device->handle, &ejd)))
 		register_dock_dependent_device(device, ejd);
@@ -1766,7 +1768,7 @@ static void acpi_bus_attach(struct acpi_device *device)
 
 		device->flags.initialized = true;
 	}
-	device->flags.visited = false;
+
 	ret = acpi_scan_attach_handler(device);
 	if (ret < 0)
 		return;
@@ -1778,9 +1780,10 @@ static void acpi_bus_attach(struct acpi_device *device)
 			return;
 
 		if (!ret && device->pnp.type.platform_id)
-			acpi_default_enumeration(device);
+			enumerated = acpi_default_enumeration(device);
 	}
-	device->flags.visited = true;
+	if (enumerated)
+		device->flags.visited = true;
 
  ok:
 	list_for_each_entry(child, &device->children, node)
-- 
1.9.1

  parent reply	other threads:[~2016-04-19 22:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 22:38 [RFC PATCH v2 00/10] ACPI overlays Octavian Purdila
2016-04-19 22:38 ` [RFC PATCH v2 01/10] kernel: add TAINT_OVERLAY_ACPI_TABLE Octavian Purdila
2016-04-19 22:39 ` [RFC PATCH v2 02/10] acpi: decouple initrd table install from CONFIG_ACPI_INITRD_TABLE_OVERRIDE Octavian Purdila
2016-04-19 22:39 ` Octavian Purdila [this message]
2016-04-19 22:39 ` [RFC PATCH v2 04/10] acpi: add support for ACPI reconfiguration notifiers Octavian Purdila
2016-04-19 22:39 ` [RFC PATCH v2 05/10] i2c: add support for ACPI reconfigure notifications Octavian Purdila
     [not found]   ` <1461105548-20618-6-git-send-email-octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-21 21:27     ` Andy Shevchenko
2016-04-21 21:41       ` Octavian Purdila
2016-04-28 14:58   ` Mika Westerberg
2016-04-19 22:39 ` [RFC PATCH v2 06/10] spi: " Octavian Purdila
     [not found]   ` <1461105548-20618-7-git-send-email-octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-28 15:00     ` Mika Westerberg
2016-04-28 17:42     ` Mark Brown
2016-04-28 19:37       ` Octavian Purdila
2016-05-03 12:19         ` Mark Brown
     [not found]           ` <20160503121954.GQ6292-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-05-04 15:04             ` Octavian Purdila
2016-04-19 22:39 ` [RFC PATCH v2 07/10] efi: load SSTDs from EFI variables Octavian Purdila
2016-05-09  4:13   ` Jon Masters
     [not found]     ` <da0e65ef-7c04-e274-2f15-a50daa8c4c8c-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-09  9:59       ` Octavian Purdila
2016-04-19 22:39 ` [RFC PATCH v2 08/10] acpi: add support for configfs Octavian Purdila
2016-04-19 22:39 ` [RFC PATCH v2 09/10] acpi: add support for loading SSDTs via configfs Octavian Purdila
2016-04-19 22:39 ` [RFC PATCH v2 10/10] HACK: acpi: configfs: add unload_hanlde_path attribute for tables Octavian Purdila

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1461105548-20618-4-git-send-email-octavian.purdila@intel.com \
    --to=octavian.purdila@intel.com \
    --cc=broonie@kernel.org \
    --cc=irina.tirdea@intel.com \
    --cc=jlbec@evilplan.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=rjw@rjwysocki.net \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).