Re: [REGRESSION? v4.8] i2c-core: acpi_i2c_get_info() touches non-existent devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

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?
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux