From 5ebf6e6a96e41220edec23a90e4140985d1a5732 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 14 Jul 2007 19:12:04 -0400 Subject: pda_power: clean up irq, timer Clean up pda_power interrupt handling: Prior to this patch, the driver would pass information it needed to the interrupt handler dev_id pointer, and then prompt forget it ever did so, recreating that same information after a couple passes through the timer-based state machine. This patch removes the redundant checks by passing the pda_power_supply[] pointer through the state machine. The current code passed 'irq' through the state machine, as an index to recreate the pointer, when we could more simply pass around the pointer itself. This patch makes it easier to remove the 'irq' argument in the future, in addition to cleaning up the driver today. Signed-off-by: Jeff Garzik --- drivers/power/pda_power.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c index 4e1eb040e14..cdc28923e0c 100644 --- a/drivers/power/pda_power.c +++ b/drivers/power/pda_power.c @@ -101,32 +101,31 @@ static void update_charger(void) return; } -static void supply_timer_func(unsigned long irq) +static void supply_timer_func(unsigned long power_supply_ptr) { - if (ac_irq && irq == ac_irq->start) - power_supply_changed(&pda_power_supplies[0]); - else if (usb_irq && irq == usb_irq->start) - power_supply_changed(&pda_power_supplies[1]); + void *power_supply = (void *)power_supply_ptr; + + power_supply_changed(power_supply); return; } -static void charger_timer_func(unsigned long irq) +static void charger_timer_func(unsigned long power_supply_ptr) { update_charger(); /* Okay, charger set. Now wait a bit before notifying supplicants, * charge power should stabilize. */ - supply_timer.data = irq; + supply_timer.data = power_supply_ptr; mod_timer(&supply_timer, jiffies + msecs_to_jiffies(pdata->wait_for_charger)); return; } -static irqreturn_t power_changed_isr(int irq, void *unused) +static irqreturn_t power_changed_isr(int irq, void *power_supply) { /* Wait a bit before reading ac/usb line status and setting charger, * because ac/usb status readings may lag from irq. */ - charger_timer.data = irq; + charger_timer.data = (unsigned long)power_supply; mod_timer(&charger_timer, jiffies + msecs_to_jiffies(pdata->wait_for_status)); return IRQ_HANDLED; -- cgit v1.2.3 From 7b3d54a8c30d2c524889a05d0c1334813d516b93 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sun, 15 Jul 2007 05:18:25 +0400 Subject: Power supply class and drivers: remove non obligatory return statements Per Jeff Garzik request. Signed-off-by: Jeff Garzik Signed-off-by: Anton Vorontsov --- drivers/power/apm_power.c | 4 ---- drivers/power/ds2760_battery.c | 7 ------- drivers/power/olpc_battery.c | 1 - drivers/power/pda_power.c | 5 ----- drivers/power/pmu_battery.c | 2 -- drivers/power/power_supply_core.c | 6 ------ drivers/power/power_supply_leds.c | 8 -------- drivers/power/power_supply_sysfs.c | 2 -- drivers/w1/slaves/w1_ds2760.c | 4 ---- 9 files changed, 39 deletions(-) (limited to 'drivers') diff --git a/drivers/power/apm_power.c b/drivers/power/apm_power.c index 042bd950d03..39a90a6f0f8 100644 --- a/drivers/power/apm_power.c +++ b/drivers/power/apm_power.c @@ -48,8 +48,6 @@ static void find_main_battery(void) } if (!main_battery) main_battery = batm; - - return; } static int calculate_time(int status) @@ -218,7 +216,6 @@ static void apm_battery_apm_get_power_status(struct apm_power_info *info) } up(&power_supply_class->sem); - return; } static int __init apm_battery_init(void) @@ -232,7 +229,6 @@ static int __init apm_battery_init(void) static void __exit apm_battery_exit(void) { apm_get_power_status = NULL; - return; } module_init(apm_battery_init); diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c index 00e1ea6f1de..be7021ee361 100644 --- a/drivers/power/ds2760_battery.c +++ b/drivers/power/ds2760_battery.c @@ -254,8 +254,6 @@ static void ds2760_battery_update_status(struct ds2760_device_info *di) if (di->charge_status != old_charge_status) power_supply_changed(&di->bat); - - return; } static void ds2760_battery_work(struct work_struct *work) @@ -268,8 +266,6 @@ static void ds2760_battery_work(struct work_struct *work) ds2760_battery_update_status(di); queue_delayed_work(di->monitor_wqueue, &di->monitor_work, interval); - - return; } #define to_ds2760_device_info(x) container_of((x), struct ds2760_device_info, \ @@ -283,8 +279,6 @@ static void ds2760_battery_external_power_changed(struct power_supply *psy) cancel_delayed_work(&di->monitor_work); queue_delayed_work(di->monitor_wqueue, &di->monitor_work, HZ/10); - - return; } static int ds2760_battery_get_property(struct power_supply *psy, @@ -457,7 +451,6 @@ static int __init ds2760_battery_init(void) static void __exit ds2760_battery_exit(void) { platform_driver_unregister(&ds2760_battery_driver); - return; } module_init(ds2760_battery_init); diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c index 878684df766..c998e68d060 100644 --- a/drivers/power/olpc_battery.c +++ b/drivers/power/olpc_battery.c @@ -341,7 +341,6 @@ static void __exit olpc_bat_exit(void) power_supply_unregister(&olpc_bat); power_supply_unregister(&olpc_ac); platform_device_unregister(bat_pdev); - return; } module_init(olpc_bat_init); diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c index cdc28923e0c..c058f285be1 100644 --- a/drivers/power/pda_power.c +++ b/drivers/power/pda_power.c @@ -97,8 +97,6 @@ static void update_charger(void) dev_dbg(dev, "charger off\n"); pdata->set_charge(0); } - - return; } static void supply_timer_func(unsigned long power_supply_ptr) @@ -106,7 +104,6 @@ static void supply_timer_func(unsigned long power_supply_ptr) void *power_supply = (void *)power_supply_ptr; power_supply_changed(power_supply); - return; } static void charger_timer_func(unsigned long power_supply_ptr) @@ -118,7 +115,6 @@ static void charger_timer_func(unsigned long power_supply_ptr) supply_timer.data = power_supply_ptr; mod_timer(&supply_timer, jiffies + msecs_to_jiffies(pdata->wait_for_charger)); - return; } static irqreturn_t power_changed_isr(int irq, void *power_supply) @@ -251,7 +247,6 @@ static int __init pda_power_init(void) static void __exit pda_power_exit(void) { platform_driver_unregister(&pda_power_pdrv); - return; } module_init(pda_power_init); diff --git a/drivers/power/pmu_battery.c b/drivers/power/pmu_battery.c index 2fea4af0e40..60a8cf3a043 100644 --- a/drivers/power/pmu_battery.c +++ b/drivers/power/pmu_battery.c @@ -203,8 +203,6 @@ static void __exit pmu_bat_exit(void) } power_supply_unregister(&pmu_ac); platform_device_unregister(bat_pdev); - - return; } module_init(pmu_bat_init); diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index e87ea515675..a63b75cf75e 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c @@ -46,8 +46,6 @@ static void power_supply_changed_work(struct work_struct *work) power_supply_update_leds(psy); kobject_uevent(&psy->dev->kobj, KOBJ_CHANGE); - - return; } void power_supply_changed(struct power_supply *psy) @@ -55,8 +53,6 @@ void power_supply_changed(struct power_supply *psy) dev_dbg(psy->dev, "%s\n", __FUNCTION__); schedule_work(&psy->changed_work); - - return; } int power_supply_am_i_supplied(struct power_supply *psy) @@ -129,7 +125,6 @@ void power_supply_unregister(struct power_supply *psy) power_supply_remove_triggers(psy); power_supply_remove_attrs(psy); device_unregister(psy->dev); - return; } static int __init power_supply_class_init(void) @@ -147,7 +142,6 @@ static int __init power_supply_class_init(void) static void __exit power_supply_class_exit(void) { class_destroy(power_supply_class); - return; } EXPORT_SYMBOL_GPL(power_supply_changed); diff --git a/drivers/power/power_supply_leds.c b/drivers/power/power_supply_leds.c index 7232490bb59..7f8f3590b02 100644 --- a/drivers/power/power_supply_leds.c +++ b/drivers/power/power_supply_leds.c @@ -40,8 +40,6 @@ static void power_supply_update_bat_leds(struct power_supply *psy) led_trigger_event(psy->full_trig, LED_OFF); break; } - - return; } static int power_supply_create_bat_triggers(struct power_supply *psy) @@ -97,7 +95,6 @@ static void power_supply_remove_bat_triggers(struct power_supply *psy) kfree(psy->full_trig_name); kfree(psy->charging_trig_name); kfree(psy->charging_full_trig_name); - return; } /* Generated power specific LEDs triggers. */ @@ -115,8 +112,6 @@ static void power_supply_update_gen_leds(struct power_supply *psy) led_trigger_event(psy->online_trig, LED_FULL); else led_trigger_event(psy->online_trig, LED_OFF); - - return; } static int power_supply_create_gen_triggers(struct power_supply *psy) @@ -145,7 +140,6 @@ static void power_supply_remove_gen_triggers(struct power_supply *psy) { led_trigger_unregister_simple(psy->online_trig); kfree(psy->online_trig_name); - return; } /* Choice what triggers to create&update. */ @@ -156,7 +150,6 @@ void power_supply_update_leds(struct power_supply *psy) power_supply_update_bat_leds(psy); else power_supply_update_gen_leds(psy); - return; } int power_supply_create_triggers(struct power_supply *psy) @@ -172,5 +165,4 @@ void power_supply_remove_triggers(struct power_supply *psy) power_supply_remove_bat_triggers(psy); else power_supply_remove_gen_triggers(psy); - return; } diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index c07d4258d34..c7c4574729b 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c @@ -176,8 +176,6 @@ void power_supply_remove_attrs(struct power_supply *psy) for (i = 0; i < psy->num_properties; i++) device_remove_file(psy->dev, &power_supply_attrs[psy->properties[i]]); - - return; } static char *kstruprdup(const char *str, gfp_t gfp) diff --git a/drivers/w1/slaves/w1_ds2760.c b/drivers/w1/slaves/w1_ds2760.c index 88a37fbccc3..15e7f9af3bc 100644 --- a/drivers/w1/slaves/w1_ds2760.c +++ b/drivers/w1/slaves/w1_ds2760.c @@ -121,8 +121,6 @@ static void release_bat_id(int id) mutex_lock(&bat_idr_lock); idr_remove(&bat_idr, id); mutex_unlock(&bat_idr_lock); - - return; } static int w1_ds2760_add_slave(struct w1_slave *sl) @@ -174,8 +172,6 @@ static void w1_ds2760_remove_slave(struct w1_slave *sl) platform_device_unregister(pdev); release_bat_id(id); sysfs_remove_bin_file(&sl->dev.kobj, &w1_ds2760_bin_attr); - - return; } static struct w1_family_ops w1_ds2760_fops = { -- cgit v1.2.3 From 0909fca51346d0ece688532c54d41ebc986aef7f Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 15 Jul 2007 22:37:03 +0400 Subject: git-battery vs git-acpi drivers/w1/slaves/w1_ds2760.c:85: warning: initialization from incompatible pointer type The ACPI guys changed the bin_attr APIs (commit 91a6902958f052358899f58683d44e36228d85c2) Cc: Anton Vorontsov Cc: Len Brown Signed-off-by: Andrew Morton --- drivers/w1/slaves/w1_ds2760.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/w1/slaves/w1_ds2760.c b/drivers/w1/slaves/w1_ds2760.c index 15e7f9af3bc..ed6b0576208 100644 --- a/drivers/w1/slaves/w1_ds2760.c +++ b/drivers/w1/slaves/w1_ds2760.c @@ -68,8 +68,9 @@ int w1_ds2760_write(struct device *dev, char *buf, int addr, size_t count) return w1_ds2760_io(dev, buf, addr, count, 1); } -static ssize_t w1_ds2760_read_bin(struct kobject *kobj, char *buf, loff_t off, - size_t count) +static ssize_t w1_ds2760_read_bin(struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) { struct device *dev = container_of(kobj, struct device, kobj); return w1_ds2760_read(dev, buf, off, count); -- cgit v1.2.3