Skip to contentSkip to conversation

mfd: remove driver_data direct access of struct device

PATCH In review Greg Kroah-Hartman 3 participants 6 messages Apr 30, 2009 – May 4, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: remove driver_data direct access of struct device

From: Greg Kroah-Hartman <[email protected]>

In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.

---
 drivers/mfd/htc-pasic3.c    |    4 ++--
 drivers/mfd/pcf50633-core.c |    2 +-
 drivers/mfd/wm8400-core.c   |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/htc-pasic3.c +2 -2
@@ -35,7 +35,7 @@ struct pasic3_data {
  */
 void pasic3_write_register(struct device *dev, u32 reg, u8 val)
 {
-	struct pasic3_data *asic = dev->driver_data;
+	struct pasic3_data *asic = dev_get_drvdata(dev);
 	int bus_shift = asic->bus_shift;
 	void __iomem *addr = asic->mapping + (REG_ADDR << bus_shift);
 	void __iomem *data = asic->mapping + (REG_DATA << bus_shift);
@@ -50,7 +50,7 @@ EXPORT_SYMBOL(pasic3_write_register); /*
  */
 u8 pasic3_read_register(struct device *dev, u32 reg)
 {
-	struct pasic3_data *asic = dev->driver_data;
+	struct pasic3_data *asic = dev_get_drvdata(dev);
 	int bus_shift = asic->bus_shift;
 	void __iomem *addr = asic->mapping + (REG_ADDR << bus_shift);
 	void __iomem *data = asic->mapping + (REG_DATA << bus_shift);
drivers/mfd/pcf50633-core.c +1 -1
@@ -618,7 +618,7 @@ static int __devinit pcf50633_probe(stru
 
 		pdev->dev.parent = pcf->dev;
 		pdev->dev.platform_data = &pdata->reg_init_data[i];
-		pdev->dev.driver_data = pcf;
+		dev_set_drvdata(&pdev->dev, pcf);
 		pcf->regulator_pdev[i] = pdev;
 
 		platform_device_add(pdev);
drivers/mfd/wm8400-core.c +1 -1
@@ -265,7 +265,7 @@ static int wm8400_init(struct wm8400 *wm
 
 	mutex_init(&wm8400->io_lock);
 
-	wm8400->dev->driver_data = wm8400;
+	dev_set_drvdata(wm8400->dev, wm8400);
 
 	/* Check that this is actually a WM8400 */
 	ret = wm8400->read_dev(wm8400->io_data, WM8400_RESET_ID, 1, &reg);
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.

For wm8400:

author
#2 lore raw
Quoted 9 lines · Mark Brown
Quoted 7 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.

Quoted 6 lines
Quoted 2 lines

For wm8400:

Thanks. Do you mind if I take this in my tree? Or is there a mfd tree somewhere that it should go through?

greg k-h

#3 lore raw

Hi Greg,

Quoted 13 lines · Greg KH
Quoted 12 lines · Mark Brown
Quoted 10 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.

Quoted 6 lines
Quoted 3 lines

For wm8400:

Thanks. Do you mind if I take this in my tree? Or is there a mfd tree somewhere that it should go through?

It should probably go through the mfd tree, I'll take it.

Thanks,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#4 lore raw
In reply to Greg KH

Hi Greg,

Quoted 13 lines · Greg KH
Quoted 12 lines · Mark Brown
Quoted 10 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.

Quoted 6 lines
Quoted 3 lines

For wm8400:

Thanks. Do you mind if I take this in my tree? Or is there a mfd tree somewhere that it should go through?

I applied this one to my for-next branch.
When do you plan to remove the direct driver_data direct access ? I'm asking to know if I should schedule this patch for sometimes earlier than the next merge window.

Cheers,
Samuel.

Quoted 1 line

greg k-h

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
author
#5 lore raw
Quoted 16 lines · Samuel Ortiz

Hi Greg,

Quoted 13 lines · Greg KH
Quoted 12 lines · Mark Brown
Quoted 10 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

For wm8400:

Thanks. Do you mind if I take this in my tree? Or is there a mfd tree somewhere that it should go through?

I applied this one to my for-next branch.
When do you plan to remove the direct driver_data direct access ?

In 2.6.31.

Quoted 2 lines

I'm asking to know if I should schedule this patch for sometimes earlier than the next merge window.

next merge window is fine with me.

thanks,

greg k-h