power: wm831x_power: Fixed indentation errors
Subsystems (5)
PATCH 1/3 power: wm831x_power: Fixed indentation errors
I fixed the following indentation errors (a couple of errors were on the wm831x_power.c)
WARNING: suspect code indent for conditional statements
--- drivers/power/wm831x_power.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/power/wm831x_power.c +8 -8
@@ -555,14 +555,14 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev) power->have_battery = ret &WM831X_CHG_ENA ;if (power->have_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; - battery->use_for_apm =1 ; - ret =power_supply_register (&pdev->dev, battery); -if (ret) - goto err_usb; + 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; + battery->use_for_apm =1 ; + ret =power_supply_register (&pdev->dev, battery); +if (ret) + goto err_usb; } irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"SYSLO" ));
Signature · 1 line
1.7.9.5
PATCH 2/3 power: wm831x_power.c: fixed const struct declaration warning
I fixed the following coding style violation;
WARNING: static const char * array should probably be static const char
* const
--- drivers/power/wm831x_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/wm831x_power.c +1 -1
@@ -430,7 +430,7 @@ static enum power_supply_property wm831x_bat_props[] = { POWER_SUPPLY_PROP_CHARGE_TYPE, }; -static const char *wm831x_bat_irqs[] = { +static const char *const wm831x_bat_irqs[] = {"BATT HOT" ,"BATT COLD" ,"BATT FAIL" ,
Signature · 1 line
1.7.9.5
PATCH 3/3 power: wm831x_power.c: Fixed indentation bug and whitespace errors
In reply to Sangho YiI removed trailing whitespaces and removed unnecessary whitespaces and indentation tabs.
--- drivers/power/wm831x_power.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/power/wm831x_power.c +2 -3
@@ -632,9 +632,8 @@ static __devexit int wm831x_power_remove(struct platform_device *pdev)int irq, i;for (i =0 ; i <ARRAY_SIZE (wm831x_bat_irqs); i++) { - irq =wm831x_irq (wm831x, -platform_get_irq_byname (pdev, - wm831x_bat_irqs[i])); + irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev, + wm831x_bat_irqs[i]));free_irq (irq, wm831x_power); }
Signature · 1 line
1.7.9.5
Re: [PATCH 3/3] power: wm831x_power.c: Fixed indentation bug and whitespace errors
Quoted 2 lines · Sangho Yi
I removed trailing whitespaces and removed unnecessary whitespaces and indentation tabs.
[]
drivers/power/wm831x_power.c
Quoted 1 line
drivers/power/wm831x_power.c +0
-0
[]
drivers/power/wm831x_power.c static __devexit int wm831x_power_remove(struct platform_device *pdev) · line 635
Quoted 5 lines
drivers/power/wm831x_power.c +0
-1@@ -632,9 +632,8 @@ static __devexit int wm831x_power_remove(struct platform_device *pdev)int irq, i;for (i =0 ; i <ARRAY_SIZE (wm831x_bat_irqs); i++) { - irq = wm831x_irq(wm831x,
There is a trailing space here...
drivers/power/wm831x_power.c static __devexit int wm831x_power_remove(struct platform_device *pdev) · line 637
Quoted 2 lines
drivers/power/wm831x_power.c +0
-2-platform_get_irq_byname (pdev, - wm831x_bat_irqs[i]));
but there's nothing wrong with this.
drivers/power/wm831x_power.c static __devexit int wm831x_power_remove(struct platform_device *pdev) · line 636
Quoted 2 lines
drivers/power/wm831x_power.c +2
-0+ irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev, + wm831x_bat_irqs[i]));
ugh.
If you're really going to do these sorts of changes just to minimize overall line length, please keep arguments aligned on parentheses where appropriate.
Maybe use a temporary if you're really concerned about overall line length.
for (i = 0; i < ARRAY_SIZE(wm831x_bat_irqs); i++) {
irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]);
irq = wm831x_irq(wm831x, irq);
}PATCH 1/1 wm831x: Add and use a wm831x_irq_byname convenience function
Add and use a convenience inline to get an irq by name.
---
Perhaps this is a better alternative to code reflowing.
include/linux/mfd/wm831x/core.h | 8 ++++++++ drivers/input/touchscreen/wm831x-ts.c | 7 ++----- drivers/power/wm831x_power.c | 20 ++++++++------------ drivers/regulator/wm831x-dcdc.c | 23 +++++++++-------------- drivers/regulator/wm831x-ldo.c | 10 ++++------ drivers/rtc/rtc-wm831x.c | 2 +- 6 files changed, 32 insertions(+), 38 deletions(-)
include/linux/mfd/wm831x/core.h +8 -0
@@ -20,6 +20,7 @@#include <linux/irqdomain.h> #include <linux/list.h> #include <linux/regmap.h> +#include <linux/platform_device.h> /* * Register values.
@@ -425,6 +426,13 @@ static inline int wm831x_irq(struct wm831x *wm831x, int irq) return irq_create_mapping(wm831x->irq_domain, irq); } +static inline int wm831x_irq_byname (struct wm831x *wm831x, +struct platform_device *pdev, +const char *name) +{ +return wm831x_irq (wm831x,platform_get_irq_byname (pdev, name)); +} +extern struct regmap_config wm831x_regmap_config;#endif
drivers/input/touchscreen/wm831x-ts.c +2 -5
@@ -260,14 +260,11 @@ static __devinit int wm831x_ts_probe(struct platform_device *pdev)* If we have a direct IRQ use it, otherwise use the interrupt * from the WM831x IRQ controller. */ - wm831x_ts->data_irq =wm831x_irq (wm831x, -platform_get_irq_byname (pdev, -"TCHDATA" )); + wm831x_ts->data_irq =wm831x_irq_byname (wm831x, pdev,"TCHDATA" );if (pdata && pdata->data_irq) wm831x_ts->data_irq = pdata->data_irq; - wm831x_ts->pd_irq =wm831x_irq (wm831x, -platform_get_irq_byname (pdev,"TCHPD" )); + wm831x_ts->pd_irq =wm831x_irq_byname (wm831x, pdev,"TCHPD" );if (pdata && pdata->pd_irq) wm831x_ts->pd_irq = pdata->pd_irq;
drivers/power/wm831x_power.c +8 -12
@@ -565,7 +565,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev) goto err_usb; } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"SYSLO" )); + irq =wm831x_irq_byname (wm831x, pdev,"SYSLO" ); ret =request_threaded_irq (irq,NULL , wm831x_syslo_irq,IRQF_TRIGGER_RISING ,"System power low" , power);
@@ -575,7 +575,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev) goto err_battery; } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"PWR SRC" )); + irq =wm831x_irq_byname (wm831x, pdev,"PWR SRC" ); ret =request_threaded_irq (irq,NULL , wm831x_pwr_src_irq,IRQF_TRIGGER_RISING ,"Power source" , power);
@@ -586,9 +586,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev) }for (i =0 ; i <ARRAY_SIZE (wm831x_bat_irqs); i++) { - irq =wm831x_irq (wm831x, -platform_get_irq_byname (pdev, - wm831x_bat_irqs[i])); + irq =wm831x_irq_byname (wm831x, pdev, wm831x_bat_irqs[i]); ret = request_threaded_irq(irq, NULL, wm831x_bat_irq, IRQF_TRIGGER_RISING, wm831x_bat_irqs[i],
@@ -608,10 +606,10 @@ err_bat_irq: irq =platform_get_irq_byname (pdev, wm831x_bat_irqs[i]);free_irq (irq, power); } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"PWR SRC" )); + irq =wm831x_irq_byname (wm831x, pdev,"PWR SRC" );free_irq (irq, power); err_syslo: - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"SYSLO" )); + irq =wm831x_irq_byname (wm831x, pdev,"SYSLO" );free_irq (irq, power); err_battery:if (power->have_battery)
@@ -632,16 +630,14 @@ static __devexit int wm831x_power_remove(struct platform_device *pdev)int irq, i;for (i =0 ; i <ARRAY_SIZE (wm831x_bat_irqs); i++) { - irq =wm831x_irq (wm831x, -platform_get_irq_byname (pdev, - wm831x_bat_irqs[i])); + irq =wm831x_irq_byname (wm831x, pdev, wm831x_bat_irqs[i]);free_irq (irq, wm831x_power); } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"PWR SRC" )); + irq =wm831x_irq_byname (wm831x, pdev,"PWR SRC" );free_irq (irq, wm831x_power); - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"SYSLO" )); + irq =wm831x_irq_byname (wm831x, pdev,"SYSLO" );free_irq (irq, wm831x_power);if (wm831x_power->have_battery)
drivers/regulator/wm831x-dcdc.c +9 -14
@@ -529,7 +529,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev) goto err; } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"UV" )); + irq =wm831x_irq_byname (wm831x, pdev,"UV" ); ret =request_threaded_irq (irq,NULL , wm831x_dcdc_uv_irq,IRQF_TRIGGER_RISING , dcdc->name, dcdc);if (ret !=0 ) {
@@ -538,7 +538,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev) goto err_regulator; } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"HC" )); + irq =wm831x_irq_byname (wm831x, pdev,"HC" ); ret =request_threaded_irq (irq,NULL , wm831x_dcdc_oc_irq,IRQF_TRIGGER_RISING , dcdc->name, dcdc);if (ret !=0 ) {
@@ -552,8 +552,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)return 0 ; err_uv: -free_irq (wm831x_irq (wm831x,platform_get_irq_byname (pdev,"UV" )), - dcdc); +free_irq (wm831x_irq_byname (wm831x, pdev,"UV" ), dcdc); err_regulator:regulator_unregister (dcdc->regulator); err:
@@ -569,10 +568,8 @@ static __devexit int wm831x_buckv_remove(struct platform_device *pdev)platform_set_drvdata (pdev,NULL ); -free_irq (wm831x_irq (wm831x,platform_get_irq_byname (pdev,"HC" )), - dcdc); -free_irq (wm831x_irq (wm831x,platform_get_irq_byname (pdev,"UV" )), - dcdc); +free_irq (wm831x_irq_byname (wm831x, pdev,"HC" ), dcdc); +free_irq (wm831x_irq_byname (wm831x, pdev,"UV" ), dcdc);regulator_unregister (dcdc->regulator);if (dcdc->dvs_gpio)gpio_free (dcdc->dvs_gpio);
@@ -691,7 +688,7 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev) goto err; } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"UV" )); + irq =wm831x_irq_byname (wm831x, pdev,"UV" ); ret =request_threaded_irq (irq,NULL , wm831x_dcdc_uv_irq,IRQF_TRIGGER_RISING , dcdc->name, dcdc);if (ret !=0 ) {
@@ -716,8 +713,7 @@ static __devexit int wm831x_buckp_remove(struct platform_device *pdev)platform_set_drvdata (pdev,NULL ); -free_irq (wm831x_irq (dcdc->wm831x,platform_get_irq_byname (pdev,"UV" )), - dcdc); +free_irq (wm831x_irq_byname (dcdc->wm831x, pdev,"UV" ), dcdc);regulator_unregister (dcdc->regulator);return 0 ;
@@ -825,7 +821,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev) goto err; } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"UV" )); + irq =wm831x_irq_byname (wm831x, pdev,"UV" ); ret =request_threaded_irq (irq,NULL , wm831x_dcdc_uv_irq,IRQF_TRIGGER_RISING , dcdc->name, dcdc);
@@ -851,8 +847,7 @@ static __devexit int wm831x_boostp_remove(struct platform_device *pdev)platform_set_drvdata (pdev,NULL ); -free_irq (wm831x_irq (dcdc->wm831x,platform_get_irq_byname (pdev,"UV" )), - dcdc); +free_irq (wm831x_irq_byname (dcdc->wm831x, pdev,"UV" ), dcdc);regulator_unregister (dcdc->regulator);return 0 ;
drivers/regulator/wm831x-ldo.c +4 -6
@@ -314,7 +314,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev) goto err; } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"UV" )); + irq =wm831x_irq_byname (wm831x, pdev,"UV" ); ret =request_threaded_irq (irq,NULL , wm831x_ldo_uv_irq,IRQF_TRIGGER_RISING , ldo->name, ldo);
@@ -340,8 +340,7 @@ static __devexit int wm831x_gp_ldo_remove(struct platform_device *pdev)platform_set_drvdata (pdev,NULL ); -free_irq (wm831x_irq (ldo->wm831x, -platform_get_irq_byname (pdev,"UV" )), ldo); +free_irq (wm831x_irq_byname (ldo->wm831x, pdev,"UV" ), ldo);regulator_unregister (ldo->regulator);return 0 ;
@@ -571,7 +570,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev) goto err; } - irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"UV" )); + irq =wm831x_irq_byname (wm831x, pdev,"UV" ); ret =request_threaded_irq (irq,NULL , wm831x_ldo_uv_irq,IRQF_TRIGGER_RISING , ldo->name, ldo);if (ret !=0 ) {
@@ -594,8 +593,7 @@ static __devexit int wm831x_aldo_remove(struct platform_device *pdev) {struct wm831x_ldo *ldo =platform_get_drvdata (pdev); -free_irq (wm831x_irq (ldo->wm831x,platform_get_irq_byname (pdev,"UV" )), - ldo); +free_irq (wm831x_irq_byname (ldo->wm831x, pdev,"UV" ), ldo);regulator_unregister (ldo->regulator);return 0 ;
drivers/rtc/rtc-wm831x.c +1 -1
@@ -416,7 +416,7 @@ static int wm831x_rtc_probe(struct platform_device *pdev) {struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent);struct wm831x_rtc *wm831x_rtc; -int alm_irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"ALM" )); +int alm_irq =wm831x_irq_byname (wm831x, pdev,"ALM" );int ret =0 ; wm831x_rtc =devm_kzalloc (&pdev->dev,sizeof (*wm831x_rtc),GFP_KERNEL );
Re: [PATCH] wm831x: Add and use a wm831x_irq_byname convenience function
Quoted 28 lines · Joe Perches
Add and use a convenience inline to get an irq by name.
Signed-off-by Joe Perches <[email protected]>---
Perhaps this is a better alternative to code reflowing.include/linux/mfd/wm831x/core.h | 8 ++++++++ drivers/input/touchscreen/wm831x-ts.c | 7 ++----- drivers/power/wm831x_power.c | 20 ++++++++------------ drivers/regulator/wm831x-dcdc.c | 23 +++++++++-------------- drivers/regulator/wm831x-ldo.c | 10 ++++------ drivers/rtc/rtc-wm831x.c | 2 +- 6 files changed, 32 insertions(+), 38 deletions(-)include/linux/mfd/wm831x/core.h +1
-0@@ -20,6 +20,7 @@#include <linux/irqdomain.h> #include <linux/list.h> #include <linux/regmap.h> +#include <linux/platform_device.h> /* * Register values. @@ -425,6 +426,13 @@ static inline int wm831x_irq(struct wm831x *wm831x, int irq)return irq_create_mapping (wm831x->irq_domain, irq);
include/linux/mfd/wm831x/core.h static inline int wm831x_irq(struct wm831x *wm831x, int irq) · line 436
Quoted 10 lines
include/linux/mfd/wm831x/core.h +7
-0} +static inline int wm831x_irq_byname (struct wm831x *wm831x, +struct platform_device *pdev, +const char *name) +{ +return wm831x_irq (wm831x,platform_get_irq_byname (pdev, name)); +} +extern struct regmap_config wm831x_regmap_config;
Looks reasonable
g.
Re: [PATCH] wm831x: Add and use a wm831x_irq_byname convenience function
Quoted 4 lines · Grant Likely
Quoted 3 lines · Joe Perches
Add and use a convenience inline to get an irq by name.
Signed-off-by Joe Perches <[email protected]>
You'll probably have more luck getting your patches applied if you send them to the relevant maintainers...