power_supply: Fix annotation for s3c_adc_battery_probe()
PATCH 1/3 power_supply: Fix annotation for s3c_adc_battery_probe()
A probe() function is used at device init time rather than system init time.
--- drivers/power/s3c_adc_battery.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/power/s3c_adc_battery.c +1 -1
@@ -266,7 +266,7 @@ static irqreturn_t s3c_adc_bat_charged(int irq, void *dev_id)return IRQ_HANDLED ; } -static int __init s3c_adc_bat_probe (struct platform_device *pdev) +static int __devinit s3c_adc_bat_probe (struct platform_device *pdev) {struct s3c_adc_client *client;struct s3c_adc_bat_pdata *pdata = pdev->dev.platform_data;
Signature · 1 line
1.7.5.4
PATCH 2/3 power_supply: Support multiple wm831x_backup instances
If there are multiple wm831x devices in the system we need to assign different names to the power supply devices in order to ensure we can create the sysfs entries for them.
--- drivers/power/wm831x_backup.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/power/wm831x_backup.c +11 -1
@@ -22,6 +22,7 @@struct wm831x_backup {struct wm831x *wm831x;struct power_supply backup; +char name[20 ]; }; static int wm831x_backup_read_voltage(struct wm831x *wm831x,
@@ -163,6 +164,7 @@ static enum power_supply_property wm831x_backup_props[] = {static __devinit int wm831x_backup_probe (struct platform_device *pdev) {struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_pdata *wm831x_pdata = wm831x->dev->platform_data;struct wm831x_backup *devdata;struct power_supply *backup;int ret;
@@ -182,7 +184,14 @@ static __devinit int wm831x_backup_probe(struct platform_device *pdev)*/ wm831x_config_backup (wm831x); - backup->name ="wm831x-backup" ; +if (wm831x_pdata && wm831x_pdata->wm831x_num) +snprintf (devdata->name,sizeof (devdata->name), +"wm831x-backup.%d" , wm831x_pdata->wm831x_num); +else +snprintf (devdata->name,sizeof (devdata->name), +"wm831x-backup" ); + + backup->name = devdata->name; backup->type =POWER_SUPPLY_TYPE_BATTERY ; backup->properties = wm831x_backup_props; backup->num_properties =ARRAY_SIZE (wm831x_backup_props);
@@ -203,6 +212,7 @@ static __devexit int wm831x_backup_remove(struct platform_device *pdev)struct wm831x_backup *devdata =platform_get_drvdata (pdev);power_supply_unregister (&devdata->backup); +kfree (devdata->backup.name);kfree (devdata);return 0 ;
Signature · 1 line
1.7.5.4
Re: [PATCH 2/3] power_supply: Support multiple wm831x_backup instances
Quoted 6 lines · Mark Brown
If there are multiple wm831x devices in the system we need to assign different names to the power supply devices in order to ensure we can create the sysfs entries for them.
Signed-off-by Mark Brown <[email protected]>---
All three applied, thanks.
PATCH 3/3 power_supply: Support multiple wm831x_power instances
In reply to Mark BrownIf there are multiple wm831x devices in the system we need to assign different names to the power supply devices in order to ensure we can create the sysfs entries for them.
--- drivers/power/wm831x_power.c | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-)
drivers/power/wm831x_power.c +23 -3
@@ -24,6 +24,9 @@ struct wm831x_power {struct power_supply wall;struct power_supply usb;struct power_supply battery; +char wall_name[20 ]; +char usb_name[20 ]; +char battery_name[20 ]; }; static int wm831x_power_check_online(struct wm831x *wm831x, int supply,
@@ -486,6 +489,7 @@ static irqreturn_t wm831x_pwr_src_irq(int irq, void *data)static __devinit int wm831x_power_probe (struct platform_device *pdev) {struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_pdata *wm831x_pdata = wm831x->dev->platform_data;struct wm831x_power *power;struct power_supply *usb;struct power_supply *battery;
@@ -503,12 +507,28 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev) battery = &power->battery; wall = &power->wall; +if (wm831x_pdata && wm831x_pdata->wm831x_num) { +snprintf (power->wall_name,sizeof (power->wall_name), +"wm831x-wall.%d" , wm831x_pdata->wm831x_num); +snprintf (power->battery_name,sizeof (power->wall_name), +"wm831x-battery.%d" , wm831x_pdata->wm831x_num); +snprintf (power->usb_name,sizeof (power->wall_name), +"wm831x-usb.%d" , wm831x_pdata->wm831x_num); + }else { +snprintf (power->wall_name,sizeof (power->wall_name), +"wm831x-wall" ); +snprintf (power->battery_name,sizeof (power->wall_name), +"wm831x-battery" ); +snprintf (power->usb_name,sizeof (power->wall_name), +"wm831x-usb" ); + } +/* We ignore configuration failures since we can still read back * the status without enabling the charger. */ wm831x_config_battery (wm831x); - wall->name ="wm831x-wall" ; + wall->name = power->wall_name; wall->type =POWER_SUPPLY_TYPE_MAINS ; wall->properties = wm831x_wall_props; wall->num_properties =ARRAY_SIZE (wm831x_wall_props);
@@ -517,7 +537,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)if (ret) goto err_kmalloc; - battery->name ="wm831x-battery" ; + battery->name = power->battery_name; battery->properties = wm831x_bat_props; battery->num_properties =ARRAY_SIZE (wm831x_bat_props); battery->get_property = wm831x_bat_get_prop;
@@ -526,7 +546,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)if (ret) goto err_wall; - usb->name ="wm831x-usb" , + usb->name = power->usb_name, usb->type =POWER_SUPPLY_TYPE_USB ; usb->properties = wm831x_usb_props; usb->num_properties =ARRAY_SIZE (wm831x_usb_props);
Signature · 1 line
1.7.5.4