Skip to contentSkip to conversation

tosa_battery: fix FTBFS bug due to driver_data access

PATCH In review Dmitry Eremin-Solenikov 4 participants 7 messages Apr 27, 2010 – May 4, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tosa_battery: fix FTBFS bug due to driver_data access

---
 drivers/power/tosa_battery.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/power/tosa_battery.c +2 -2
index 2eab35a..ee04936 100644
@@ -61,7 +61,7 @@ static unsigned long tosa_read_bat(struct tosa_bat *bat)
 	mutex_lock(&bat_lock);
 	gpio_set_value(bat->gpio_bat, 1);
 	msleep(5);
-	value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
+	value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy.dev->parent),
 			bat->adc_bat);
 	gpio_set_value(bat->gpio_bat, 0);
 	mutex_unlock(&bat_lock);
@@ -81,7 +81,7 @@ static unsigned long tosa_read_temp(struct tosa_bat *bat)
 	mutex_lock(&bat_lock);
 	gpio_set_value(bat->gpio_temp, 1);
 	msleep(5);
-	value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
+	value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy.dev->parent),
 			bat->adc_temp);
 	gpio_set_value(bat->gpio_temp, 0);
 	mutex_unlock(&bat_lock);
Signature · 1 line
1.7.0
#1 lore raw
Quoted 4 lines · On Tue, 27 Apr 2010 17:18:22 +0400 Dmitry Eremin-Solenikov…
---
 drivers/power/tosa_battery.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Please don't send unchangelogged patches.

Please don't send patches which require recipients to go googling acronyms to work out wtf you're up to.

<googles the acronym>

Ah, it appears to be a build fix.

Please always quote the compiler errors when fixing a build error.

IOW: bah.

#2 lore raw

PATCH 1/1 Remove tosa_battery driver (was: Re: [PATCH] tosa_battery: fix FTBFS bug due to driver_data access)

Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Tue, 27 Apr 2010 17:18:22 +0400 Dmitry Eremin-Solenikov…
---
 drivers/power/tosa_battery.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Quoted 8 lines

Please don't send unchangelogged patches.

Please don't send patches which require recipients to go googling acronyms to work out wtf you're up to.

<googles the acronym>

Ah, it appears to be a build fix.

It seems that the driver isn't buildable since 2.6.32 (i.e. commit b4028437 "Driver core: move dev_get/set_drvdata to drivers/base/dd.c").

Also, IIRC it was deprecated in favor of wm97xx_battery.c driver.

So, I'm not picking this patch for 2.6.34, it's not a new regression, and the driver is probably needs to be removed.

Any objections on the patch down below?

- - - -

Quoted 1 line

From 464e18bb5c7230daaa741d308f76cf0671be4bf2 Mon Sep 17 00:00:00 2001

From: Anton Vorontsov <[email protected]>
Date: Fri, 30 Apr 2010 21:55:58 +0400
Subject: [PATCH] Remove tosa_battery driver

- The driver is broken since commit b4028437 "Driver core: move dev_get/set_drvdata to drivers/base/dd.c", i.e. since 2.6.32;

- The driver isn't selected by any ARM defconfig.

- wm97xx_battery is a more generic driver, and should be suitable as a replacement;

So, remove the tosa_battery driver.

Signed-off-by Anton Vorontsov <Anton Vorontsov>
---
 drivers/power/Kconfig        |    7 -
 drivers/power/Makefile       |    1 -
 drivers/power/tosa_battery.c |  486 ------------------------------------------
 3 files changed, 0 insertions(+), 494 deletions(-)
 delete mode 100644 drivers/power/tosa_battery.c
drivers/power/Kconfig +0 -7
index c59bcb7..058347d 100644
@@ -84,13 +84,6 @@ config BATTERY_OLPC
 	help
 	  Say Y to enable support for the battery on the OLPC laptop.
 
-config BATTERY_TOSA
-	tristate "Sharp SL-6000 (tosa) battery"
-	depends on MACH_TOSA && MFD_TC6393XB && TOUCHSCREEN_WM97XX
-	help
-	  Say Y to enable support for the battery on the Sharp Zaurus
-	  SL-6000 (tosa) models.
-
 config BATTERY_COLLIE
 	tristate "Sharp SL-5500 (collie) battery"
 	depends on SA1100_COLLIE && MCP_UCB1200
drivers/power/Makefile +0 -1
index a82f292..dd4de16 100644
@@ -25,7 +25,6 @@ obj-$(CONFIG_BATTERY_DS2760)	+= ds2760_battery.o
 obj-$(CONFIG_BATTERY_DS2782)	+= ds2782_battery.o
 obj-$(CONFIG_BATTERY_PMU)	+= pmu_battery.o
 obj-$(CONFIG_BATTERY_OLPC)	+= olpc_battery.o
-obj-$(CONFIG_BATTERY_TOSA)	+= tosa_battery.o
 obj-$(CONFIG_BATTERY_COLLIE)	+= collie_battery.o
 obj-$(CONFIG_BATTERY_WM97XX)	+= wm97xx_battery.o
 obj-$(CONFIG_BATTERY_BQ27x00)	+= bq27x00_battery.o
drivers/power/tosa_battery.c deleted +0 -486

486 lines not on this page · raw message

Signature · 1 line
1.7.0.5
#3 lore raw

Re: [PATCH] Remove tosa_battery driver (was: Re: [PATCH] tosa_battery: fix FTBFS bug due to driver_data access)

Hello,

Quoted 22 lines · Anton Vorontsov
Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Tue, 27 Apr 2010 17:18:22 +0400 Dmitry Eremin-Solenikov…

---
 drivers/power/tosa_battery.c |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
Quoted 8 lines

Please don't send unchangelogged patches.

Please don't send patches which require recipients to go googling acronyms to work out wtf you're up to.

<googles the acronym>

Ah, it appears to be a build fix.

It seems that the driver isn't buildable since 2.6.32 (i.e. commit b4028437 "Driver core: move dev_get/set_drvdata to drivers/base/dd.c").

Quoted 8 lines

Also, IIRC it was deprecated in favor of wm97xx_battery.c driver.

So, I'm not picking this patch for 2.6.34, it's not a new regression, and the driver is probably needs to be removed.

Any objections on the patch down below?

Yes. wm97xx_battery handles only one battery, while tosa uses 3 different batterires.
So, wm97xx_battery needs to be adapted/enhanced.

Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

Re: [PATCH] Remove tosa_battery driver (was: Re: [PATCH] tosa_battery: fix FTBFS bug due to driver_data access)

On Sat, May 01, 2010 at 12:40:54AM +0400, Dmitry Eremin-Solenikov wrote:
[...]

Quoted 13 lines
Quoted 13 lines
Quoted 1 line

Ah, it appears to be a build fix.

It seems that the driver isn't buildable since 2.6.32 (i.e. commit b4028437 "Driver core: move dev_get/set_drvdata to drivers/base/dd.c").

Also, IIRC it was deprecated in favor of wm97xx_battery.c driver.

So, I'm not picking this patch for 2.6.34, it's not a new regression, and the driver is probably needs to be removed.

Quoted 5 lines
Quoted 1 line

Any objections on the patch down below?

Yes. wm97xx_battery handles only one battery, while tosa uses 3 different batterires.
So, wm97xx_battery needs to be adapted/enhanced.

Eh. I see, thanks for making this clear. I added some changelog and applied the following patch to battery-2.6.git:

- - -
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Tue, 27 Apr 2010 17:18:22 +0400
Subject: [PATCH] tosa_battery: Fix build error due to direct driver_data usage

The driver isn't buildable since 2.6.32 (i.e. commit b4028437 "Driver core: move dev_get/set_drvdata to drivers/base/dd.c"):

CC tosa_battery.o
tosa_battery.c: In function 'tosa_read_bat':
tosa_battery.c:64: error: 'struct device' has no member named 'driver_data' tosa_battery.c: In function 'tosa_read_temp':
tosa_battery.c:84: error: 'struct device' has no member named 'driver_data'

Nowadays we must not access driver_data directly, use dev_get_drvdata() instead.

---
 drivers/power/tosa_battery.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/power/tosa_battery.c +2 -2
index 2eab35a..ee04936 100644
@@ -61,7 +61,7 @@ static unsigned long tosa_read_bat(struct tosa_bat *bat)
 	mutex_lock(&bat_lock);
 	gpio_set_value(bat->gpio_bat, 1);
 	msleep(5);
-	value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
+	value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy.dev->parent),
 			bat->adc_bat);
 	gpio_set_value(bat->gpio_bat, 0);
 	mutex_unlock(&bat_lock);
@@ -81,7 +81,7 @@ static unsigned long tosa_read_temp(struct tosa_bat *bat)
 	mutex_lock(&bat_lock);
 	gpio_set_value(bat->gpio_temp, 1);
 	msleep(5);
-	value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
+	value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy.dev->parent),
 			bat->adc_temp);
 	gpio_set_value(bat->gpio_temp, 0);
 	mutex_unlock(&bat_lock);
Signature · 1 line
1.7.0.5
#5 lore raw

Re: [PATCH] Remove tosa_battery driver (was: Re: [PATCH] tosa_battery: fix FTBFS bug due to driver_data access)

Quoted 15 lines · Anton Vorontsov

On Sat, May 01, 2010 at 12:40:54AM +0400, Dmitry Eremin-Solenikov wrote:
[...]

Quoted 13 lines
Quoted 13 lines
Quoted 1 line

Ah, it appears to be a build fix.

It seems that the driver isn't buildable since 2.6.32 (i.e. commit b4028437 "Driver core: move dev_get/set_drvdata to drivers/base/dd.c").

Also, IIRC it was deprecated in favor of wm97xx_battery.c driver.

So, I'm not picking this patch for 2.6.34, it's not a new regression, and the driver is probably needs to be removed.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Any objections on the patch down below?

Yes. wm97xx_battery handles only one battery, while tosa uses 3 different batterires.
So, wm97xx_battery needs to be adapted/enhanced.

Eh. I see, thanks for making this clear. I added some changelog and applied the following patch to battery-2.6.git:

Thank you. Merging these two drivers is on my goal list, but it won't come in the near future.

Quoted 51 lines

- - -
From: Dmitry Eremin-Solenikov <[email protected]>
Date: Tue, 27 Apr 2010 17:18:22 +0400
Subject: [PATCH] tosa_battery: Fix build error due to direct driver_data usage

The driver isn't buildable since 2.6.32 (i.e. commit b4028437 "Driver core: move dev_get/set_drvdata to drivers/base/dd.c"):

 CC      tosa_battery.o
tosa_battery.c: In function 'tosa_read_bat':
tosa_battery.c:64: error: 'struct device' has no member named 'driver_data' tosa_battery.c: In function 'tosa_read_temp':
tosa_battery.c:84: error: 'struct device' has no member named 'driver_data'

Nowadays we must not access driver_data directly, use dev_get_drvdata() instead.

---
 drivers/power/tosa_battery.c |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/power/tosa_battery.c +2 -3
index 2eab35a..ee04936 100644
@@ -61,7 +61,7 @@ static unsigned long tosa_read_bat(struct tosa_bat *bat)
        mutex_lock(&bat_lock);
        gpio_set_value(bat->gpio_bat, 1);
        msleep(5);
-       value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
+       value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy.dev->parent),
                        bat->adc_bat);
        gpio_set_value(bat->gpio_bat, 0);
        mutex_unlock(&bat_lock);
@@ -81,7 +81,7 @@ static unsigned long tosa_read_temp(struct tosa_bat *bat)
        mutex_lock(&bat_lock);
        gpio_set_value(bat->gpio_temp, 1);
        msleep(5);
-       value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
+       value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy.dev->parent),
                        bat->adc_temp);
        gpio_set_value(bat->gpio_temp, 0);
        mutex_unlock(&bat_lock);
--

1.7.0.5

Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

Re: [PATCH] Remove tosa_battery driver (was: Re: [PATCH] tosa_battery: fix FTBFS bug due to driver_data access)

Quoted 7 lines · Dmitry Eremin-Solenikov
Quoted 2 lines · Anton Vorontsov

Eh. I see, thanks for making this clear. I added some changelog and applied the following patch to battery-2.6.git:

Thank you. Merging these two drivers is on my goal list, but it won't come in the near future.

TBH I'm not entirely sure it's worth it - I'd be somewhat surprised to see users outside of tosa for the more complex functionality.