From: Anton Vorontsov on
On Sat, May 01, 2010 at 12:40:54AM +0400, Dmitry Eremin-Solenikov wrote:
[...]
> >> 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?
>
> 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 <dbaryshkov(a)gmail.com>
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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov(a)gmail.com>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbouatmailru(a)gmail.com>
---
drivers/power/tosa_battery.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/tosa_battery.c b/drivers/power/tosa_battery.c
index 2eab35a..ee04936 100644
--- a/drivers/power/tosa_battery.c
+++ b/drivers/power/tosa_battery.c
@@ -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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Mark Brown on
On Mon, May 03, 2010 at 12:52:48AM +0400, Dmitry Eremin-Solenikov wrote:
> On Mon, May 3, 2010 at 12:12 AM, Anton Vorontsov <cbouatmailru(a)gmail.com> wrote:

> > 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/