I fixed the following indentation errors (a couple of errors were on the
wm831x_power.c)
WARNING: suspect code indent for conditional statements
Signed-off-by: Sangho Yi <[email protected]>
---
drivers/power/wm831x_power.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c
index fc1ad95..833841b 100644
--- a/drivers/power/wm831x_power.c
+++ b/drivers/power/wm831x_power.c
@@ -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"));
--
1.7.9.5
I removed trailing whitespaces and removed unnecessary whitespaces and
indentation tabs.
Signed-off-by: Sangho Yi <[email protected]>
---
drivers/power/wm831x_power.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c
index 1afca43..ff8316e 100644
--- a/drivers/power/wm831x_power.c
+++ b/drivers/power/wm831x_power.c
@@ -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);
}
--
1.7.9.5
I fixed the following coding style violation;
WARNING: static const char * array should probably be static const char
* const
Signed-off-by: Sangho Yi <[email protected]>
---
drivers/power/wm831x_power.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c
index 833841b..1afca43 100644
--- a/drivers/power/wm831x_power.c
+++ b/drivers/power/wm831x_power.c
@@ -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",
--
1.7.9.5
On Thu, 2012-10-18 at 00:01 +0900, Sangho Yi wrote:
> I removed trailing whitespaces and removed unnecessary whitespaces and
> indentation tabs.
[]
> diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c
[]
> @@ -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...
> - platform_get_irq_byname(pdev,
> - wm831x_bat_irqs[i]));
but there's nothing wrong with this.
> + 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);
}
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(-)
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 4a3b83a..96cd081 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -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
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c
index 52abb98..82722b3 100644
--- a/drivers/input/touchscreen/wm831x-ts.c
+++ b/drivers/input/touchscreen/wm831x-ts.c
@@ -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;
diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c
index fc1ad95..39a6125 100644
--- a/drivers/power/wm831x_power.c
+++ b/drivers/power/wm831x_power.c
@@ -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)
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 782c228..b6bd0be 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -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;
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index c2dc039..6cada4a 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -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;
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index ea5c6f8..f111f38 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -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);
On Wed, 17 Oct 2012 11:00:55 -0700, Joe Perches <[email protected]> wrote:
> 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(-)
>
> diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
> index 4a3b83a..96cd081 100644
> --- a/include/linux/mfd/wm831x/core.h
> +++ b/include/linux/mfd/wm831x/core.h
> @@ -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;
Looks reasonable
g.
On Mon, Nov 26, 2012 at 09:35:15PM +0000, Grant Likely wrote:
> On Wed, 17 Oct 2012 11:00:55 -0700, Joe Perches <[email protected]> wrote:
> > 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...