[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160920075543.GL1811@lahna.fi.intel.com>
Date: Tue, 20 Sep 2016 10:55:43 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Nicolai Stange <nicstange@...il.com>
Cc: Wolfram Sang <wsa@...-dreams.de>,
Octavian Purdila <octavian.purdila@...el.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [REGRESSION? v4.8] i2c-core: acpi_i2c_get_info() touches
non-existent devices
On Mon, Sep 19, 2016 at 03:58:52PM +0200, Nicolai Stange wrote:
> > Can you try if the following patch cures the problem?
>
> Unfortunately not. That patch installs the check after the
> acpi_i2c_get_info() invocation which is part of the backtrace above.
Ah, indeed it needs to happen before we parse resources.
> I moved your check into i2c_get_info(), right in front of the IRQ
> handling and this works.
>
> So,
>
> Tested-by: Nicolai Stange <nicstange@...il.com>
Thanks.
> for this:
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 74e5aea..3f2b3cf 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -141,6 +141,7 @@ static int acpi_i2c_get_info(struct acpi_device *adev,
> struct list_head resource_list;
> struct resource_entry *entry;
> struct acpi_i2c_lookup lookup;
> + struct acpi_device *adapter_adev;
> int ret;
>
> if (acpi_bus_get_status(adev) || !adev->status.present ||
> @@ -163,6 +164,12 @@ static int acpi_i2c_get_info(struct acpi_device *adev,
> if (ret < 0 || !info->addr)
> return -EINVAL;
>
> + /* The adapter must be present */
> + if (acpi_bus_get_device(lookup.adapter_handle, &adapter_adev))
> + return -EINVAL;
> + if (acpi_bus_get_status(adapter_adev) || !adapter_adev->status.present)
> + return -EINVAL;;
> +
> *adapter_handle = lookup.adapter_handle;
>
> /* Then fill IRQ number if any */
>
>
>
> But it is still true that acpi_i2c_register_devices() configures the
> interrupts for all ACPI I2C slaves attached to an available adapter,
> independent of whether their adapter is the one given as an argument or
> not. I can't tell whether this is desired, just a note...
You are right it should not do that. I'll send you an updated patch
shortly, can you try if it works?
Powered by blists - more mailing lists