Commit df36442c authored by Lee Jones's avatar Lee Jones

mfd: ab8500-gpadc: Squash a whole bunch of Checkpatch warnings and one error

WARNING: line over 80 characters
+#define ADC_CH_IBAT_MIN                        (-6000) /* mA range measured by ADC for ib
t*/

WARNING: line over 80 characters
+#define ADC_CH_IBAT_MIN_V              (-60)   /* mV range measured by ADC for ibat*/

WARNING: suspect code indent for conditional statements (16, 20)
+               if (!strcmp(name, dev_name(gpadc->dev)))
+                   return gpadc;

WARNING: suspect code indent for conditional statements (0, 16)
+if (ad_value < 0) {
+               dev_err(gpadc->dev, "GPADC raw value failed ch: %d\n",

WARNING: quoted string split across lines
+               dev_err(gpadc->dev, "GPADC to voltage conversion failed ch:"
+                       " %d AD: 0x%x\n", channel, ad_value);

WARNING: Missing a blank line after declarations
+       int raw_data;
+       raw_data = ab8500_gpadc_double_read_raw(gpadc, channel,

WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt
+               msleep(10);

ERROR: else should follow close brace '}'
+       }
+       else

WARNING: line over 80 characters
+                       delay_max = 10000; /* large range to optimise sleep mode */

WARNING: line over 80 characters
+                       gpadc->cal_data[ADC_INPUT_IBAT].gain = V_gain * V2A_gain;

WARNING: line over 80 characters
+       gpadc = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_gpadc), GFP_KERNEL);

WARNING: Possible unnecessary 'out of memory' message
+       if (!gpadc) {
+               dev_err(&pdev->dev, "Error: No memory\n");

WARNING: space prohibited before semicolon
+       return ;

WARNING: void function return statements are not generally useful
+       return ;
+}

WARNING: quoted string split across lines
+MODULE_AUTHOR("Arun R Murthy, Daniel Willerud, Johan Palsson,"
+               "M'boumba Cedric Madianga");

total: 1 errors, 14 warnings, 1089 lines checked

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent de6a7693
......@@ -98,9 +98,9 @@
#define ADC_CH_BKBAT_MAX 3200
/* GPADC constants from AB8540 spec */
#define ADC_CH_IBAT_MIN (-6000) /* mA range measured by ADC for ibat*/
#define ADC_CH_IBAT_MIN (-6000) /* mA range measured by ADC for ibat */
#define ADC_CH_IBAT_MAX 6000
#define ADC_CH_IBAT_MIN_V (-60) /* mV range measured by ADC for ibat*/
#define ADC_CH_IBAT_MIN_V (-60) /* mV range measured by ADC for ibat */
#define ADC_CH_IBAT_MAX_V 60
#define IBAT_VDROP_L (-56) /* mV */
#define IBAT_VDROP_H 56
......@@ -315,11 +315,12 @@ int ab8500_gpadc_sw_hw_convert(struct ab8500_gpadc *gpadc, u8 channel,
ad_value = ab8500_gpadc_read_raw(gpadc, channel, avg_sample,
trig_edge, trig_timer, conv_type);
/* On failure retry a second time */
/* On failure retry a second time */
if (ad_value < 0)
ad_value = ab8500_gpadc_read_raw(gpadc, channel, avg_sample,
trig_edge, trig_timer, conv_type);
if (ad_value < 0) {
if (ad_value < 0) {
dev_err(gpadc->dev, "GPADC raw value failed ch: %d\n",
channel);
return ad_value;
......@@ -327,8 +328,9 @@ if (ad_value < 0) {
voltage = ab8500_gpadc_ad_to_voltage(gpadc, channel, ad_value);
if (voltage < 0)
dev_err(gpadc->dev, "GPADC to voltage conversion failed ch:"
" %d AD: 0x%x\n", channel, ad_value);
dev_err(gpadc->dev,
"GPADC to voltage conversion failed ch: %d AD: 0x%x\n",
channel, ad_value);
return voltage;
}
......@@ -348,10 +350,9 @@ EXPORT_SYMBOL(ab8500_gpadc_sw_hw_convert);
int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type)
{
int raw_data;
raw_data = ab8500_gpadc_double_read_raw(gpadc, channel,
avg_sample, trig_edge, trig_timer, conv_type, NULL);
return raw_data;
return ab8500_gpadc_double_read_raw(gpadc, channel, avg_sample,
trig_edge, trig_timer, conv_type,
NULL);
}
int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
......@@ -388,7 +389,7 @@ int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
goto out;
if (!(val & GPADC_BUSY))
break;
msleep(10);
msleep(20);
} while (++looplimit < 10);
if (looplimit >= 10 && (val & GPADC_BUSY)) {
dev_err(gpadc->dev, "gpadc_conversion: GPADC busy");
......@@ -421,8 +422,7 @@ int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
val_reg1 |= EN_TRIG_EDGE;
if (trig_edge)
val_reg1 |= EN_FALLING;
}
else
} else
ret = abx500_set_register_interruptible(gpadc->dev,
AB8500_GPADC, AB8500_GPADC_CTRL2_REG, val);
if (ret < 0) {
......@@ -449,7 +449,7 @@ int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
* remove when hardware will be availible
*/
delay_min = 1000; /* Delay in micro seconds */
delay_max = 10000; /* large range to optimise sleep mode */
delay_max = 10000; /* large range optimises sleepmode */
break;
}
/* Intentional fallthrough */
......@@ -785,9 +785,10 @@ static void ab8500_gpadc_read_calibration_data(struct ab8500_gpadc *gpadc)
<< CALIB_SHIFT_IBAT)
/ (ADC_CH_IBAT_MAX_V - ADC_CH_IBAT_MIN_V);
gpadc->cal_data[ADC_INPUT_IBAT].gain = V_gain * V2A_gain;
gpadc->cal_data[ADC_INPUT_IBAT].offset = V_offset *
V2A_gain + V2A_offset;
gpadc->cal_data[ADC_INPUT_IBAT].gain =
V_gain * V2A_gain;
gpadc->cal_data[ADC_INPUT_IBAT].offset =
V_offset * V2A_gain + V2A_offset;
} else {
gpadc->cal_data[ADC_INPUT_IBAT].gain = 0;
}
......@@ -923,11 +924,10 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
int ret = 0;
struct ab8500_gpadc *gpadc;
gpadc = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_gpadc), GFP_KERNEL);
if (!gpadc) {
dev_err(&pdev->dev, "Error: No memory\n");
gpadc = devm_kzalloc(&pdev->dev,
sizeof(struct ab8500_gpadc), GFP_KERNEL);
if (!gpadc)
return -ENOMEM;
}
gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
if (gpadc->irq_sw < 0)
......@@ -1076,14 +1076,15 @@ void ab8540_gpadc_get_otp(struct ab8500_gpadc *gpadc,
*vbat_h = gpadc->cal_data[ADC_INPUT_VBAT].otp_calib_hi;
*ibat_l = gpadc->cal_data[ADC_INPUT_IBAT].otp_calib_lo;
*ibat_h = gpadc->cal_data[ADC_INPUT_IBAT].otp_calib_hi;
return ;
}
subsys_initcall_sync(ab8500_gpadc_init);
module_exit(ab8500_gpadc_exit);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Arun R Murthy, Daniel Willerud, Johan Palsson,"
"M'boumba Cedric Madianga");
MODULE_AUTHOR("Arun R Murthy");
MODULE_AUTHOR("Daniel Willerud");
MODULE_AUTHOR("Johan Palsson");
MODULE_AUTHOR("M'boumba Cedric Madianga");
MODULE_ALIAS("platform:ab8500_gpadc");
MODULE_DESCRIPTION("AB8500 GPADC driver");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment