diff mbox

ACPI / I2C: Use parent's ACPI_HANDLE() in acpi_i2c_register_devices()

Message ID 2966020.zlpeyGGUDW@vostro.rjw.lan
State Awaiting Upstream
Headers show

Commit Message

Rafael J. Wysocki April 1, 2013, 12:25 a.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The ACPI handle of struct i2c_adapter's dev member should not be
set, because this causes that struct i2c_adapter to be associated
with the ACPI device node corresponding to its parent as the
second "physical_device", which is incorrect (this happens during
the registration of struct i2c_adapter).  Consequently,
acpi_i2c_register_devices() should use the ACPI handle of the
parent of the struct i2c_adapter it is called for rather than the
struct i2c_adapter's ACPI handle (which should be NULL).

Make that happen and modify the i2c-designware-platdrv driver,
which currently is the only driver for ACPI-enumerated I2C
controller chips, not to set the ACPI handle for the
struct i2c_adapter it creates.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpi_i2c.c                     |    2 +-
 drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
 2 files changed, 1 insertion(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Aaron Lu April 1, 2013, 1:27 a.m. UTC | #1
On 04/01/2013 08:25 AM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The ACPI handle of struct i2c_adapter's dev member should not be
> set, because this causes that struct i2c_adapter to be associated
> with the ACPI device node corresponding to its parent as the
> second "physical_device", which is incorrect (this happens during
> the registration of struct i2c_adapter).  Consequently,
> acpi_i2c_register_devices() should use the ACPI handle of the
> parent of the struct i2c_adapter it is called for rather than the
> struct i2c_adapter's ACPI handle (which should be NULL).
> 
> Make that happen and modify the i2c-designware-platdrv driver,
> which currently is the only driver for ACPI-enumerated I2C
> controller chips, not to set the ACPI handle for the
> struct i2c_adapter it creates.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Reviewed-by: Aaron Lu <aaron.lu@intel.com>

Thanks,
Aaron

> ---
>  drivers/acpi/acpi_i2c.c                     |    2 +-
>  drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> Index: linux-pm/drivers/acpi/acpi_i2c.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/acpi_i2c.c
> +++ linux-pm/drivers/acpi/acpi_i2c.c
> @@ -90,7 +90,7 @@ void acpi_i2c_register_devices(struct i2
>  	acpi_handle handle;
>  	acpi_status status;
>  
> -	handle = ACPI_HANDLE(&adapter->dev);
> +	handle = ACPI_HANDLE(adapter->dev.parent);
>  	if (!handle)
>  		return;
>  
> Index: linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c
> ===================================================================
> --- linux-pm.orig/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -182,7 +182,6 @@ static int dw_i2c_probe(struct platform_
>  	adap->algo = &i2c_dw_algo;
>  	adap->dev.parent = &pdev->dev;
>  	adap->dev.of_node = pdev->dev.of_node;
> -	ACPI_HANDLE_SET(&adap->dev, ACPI_HANDLE(&pdev->dev));
>  
>  	r = i2c_add_numbered_adapter(adap);
>  	if (r) {
> 
> --
> 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
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mika Westerberg April 1, 2013, 8:28 a.m. UTC | #2
On Mon, Apr 01, 2013 at 02:25:03AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The ACPI handle of struct i2c_adapter's dev member should not be
> set, because this causes that struct i2c_adapter to be associated
> with the ACPI device node corresponding to its parent as the
> second "physical_device", which is incorrect (this happens during
> the registration of struct i2c_adapter).  Consequently,
> acpi_i2c_register_devices() should use the ACPI handle of the
> parent of the struct i2c_adapter it is called for rather than the
> struct i2c_adapter's ACPI handle (which should be NULL).
> 
> Make that happen and modify the i2c-designware-platdrv driver,
> which currently is the only driver for ACPI-enumerated I2C
> controller chips, not to set the ACPI handle for the
> struct i2c_adapter it creates.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang April 2, 2013, 4:52 a.m. UTC | #3
On Mon, Apr 01, 2013 at 02:25:03AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The ACPI handle of struct i2c_adapter's dev member should not be
> set, because this causes that struct i2c_adapter to be associated
> with the ACPI device node corresponding to its parent as the
> second "physical_device", which is incorrect (this happens during
> the registration of struct i2c_adapter).  Consequently,
> acpi_i2c_register_devices() should use the ACPI handle of the
> parent of the struct i2c_adapter it is called for rather than the
> struct i2c_adapter's ACPI handle (which should be NULL).
> 
> Make that happen and modify the i2c-designware-platdrv driver,
> which currently is the only driver for ACPI-enumerated I2C
> controller chips, not to set the ACPI handle for the
> struct i2c_adapter it creates.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Shall this go via the I2C tree? If not, for the I2C part:

Acked-by: Wolfram Sang <wsa@the-dreams.de>

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki April 2, 2013, 12:44 p.m. UTC | #4
On Tuesday, April 02, 2013 06:52:37 AM Wolfram Sang wrote:
> On Mon, Apr 01, 2013 at 02:25:03AM +0200, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > The ACPI handle of struct i2c_adapter's dev member should not be
> > set, because this causes that struct i2c_adapter to be associated
> > with the ACPI device node corresponding to its parent as the
> > second "physical_device", which is incorrect (this happens during
> > the registration of struct i2c_adapter).  Consequently,
> > acpi_i2c_register_devices() should use the ACPI handle of the
> > parent of the struct i2c_adapter it is called for rather than the
> > struct i2c_adapter's ACPI handle (which should be NULL).
> > 
> > Make that happen and modify the i2c-designware-platdrv driver,
> > which currently is the only driver for ACPI-enumerated I2C
> > controller chips, not to set the ACPI handle for the
> > struct i2c_adapter it creates.
> > 
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Shall this go via the I2C tree? If not, for the I2C part:

Well, I'm going to push it through the ACPI/PM tree, if that's not a problem
along with an analogous SPI patch.

> Acked-by: Wolfram Sang <wsa@the-dreams.de>

Thanks!
diff mbox

Patch

Index: linux-pm/drivers/acpi/acpi_i2c.c
===================================================================
--- linux-pm.orig/drivers/acpi/acpi_i2c.c
+++ linux-pm/drivers/acpi/acpi_i2c.c
@@ -90,7 +90,7 @@  void acpi_i2c_register_devices(struct i2
 	acpi_handle handle;
 	acpi_status status;
 
-	handle = ACPI_HANDLE(&adapter->dev);
+	handle = ACPI_HANDLE(adapter->dev.parent);
 	if (!handle)
 		return;
 
Index: linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c
===================================================================
--- linux-pm.orig/drivers/i2c/busses/i2c-designware-platdrv.c
+++ linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -182,7 +182,6 @@  static int dw_i2c_probe(struct platform_
 	adap->algo = &i2c_dw_algo;
 	adap->dev.parent = &pdev->dev;
 	adap->dev.of_node = pdev->dev.of_node;
-	ACPI_HANDLE_SET(&adap->dev, ACPI_HANDLE(&pdev->dev));
 
 	r = i2c_add_numbered_adapter(adap);
 	if (r) {