Skip to content

Commit 7cc7478

Browse files
committed
power: supply: generic-adc-battery: style fixes
This does the following code-style changes: * fix inconsistent indentation in 'struct gab' * remove unused cable_plugged from 'struct gab' * remove pointless temporary is_plugged variable * add gab_ prefix to read_channel No functionality changes are intended. Signed-off-by: Sebastian Reichel <sre@kernel.org>
1 parent 4fc1bef commit 7cc7478

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

drivers/power/supply/generic-adc-battery.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ static const char *const gab_chan_name[] = {
4242
};
4343

4444
struct gab {
45-
struct power_supply *psy;
46-
struct power_supply_desc psy_desc;
47-
struct iio_channel *channel[GAB_MAX_CHAN_TYPE];
45+
struct power_supply *psy;
46+
struct power_supply_desc psy_desc;
47+
struct iio_channel *channel[GAB_MAX_CHAN_TYPE];
4848
struct delayed_work bat_work;
49-
int status;
50-
bool cable_plugged;
49+
int status;
5150
struct gpio_desc *charge_finished;
5251
};
5352

@@ -85,7 +84,7 @@ static bool gab_charge_finished(struct gab *adc_bat)
8584
return gpiod_get_value(adc_bat->charge_finished);
8685
}
8786

88-
static int read_channel(struct gab *adc_bat, enum gab_chan_type channel,
87+
static int gab_read_channel(struct gab *adc_bat, enum gab_chan_type channel,
8988
int *result)
9089
{
9190
int ret;
@@ -109,13 +108,13 @@ static int gab_get_property(struct power_supply *psy,
109108
val->intval = adc_bat->status;
110109
return 0;
111110
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
112-
return read_channel(adc_bat, GAB_VOLTAGE, &val->intval);
111+
return gab_read_channel(adc_bat, GAB_VOLTAGE, &val->intval);
113112
case POWER_SUPPLY_PROP_CURRENT_NOW:
114-
return read_channel(adc_bat, GAB_CURRENT, &val->intval);
113+
return gab_read_channel(adc_bat, GAB_CURRENT, &val->intval);
115114
case POWER_SUPPLY_PROP_POWER_NOW:
116-
return read_channel(adc_bat, GAB_POWER, &val->intval);
115+
return gab_read_channel(adc_bat, GAB_POWER, &val->intval);
117116
case POWER_SUPPLY_PROP_TEMP:
118-
return read_channel(adc_bat, GAB_TEMP, &val->intval);
117+
return gab_read_channel(adc_bat, GAB_TEMP, &val->intval);
119118
default:
120119
return -EINVAL;
121120
}
@@ -125,17 +124,13 @@ static void gab_work(struct work_struct *work)
125124
{
126125
struct gab *adc_bat;
127126
struct delayed_work *delayed_work;
128-
bool is_plugged;
129127
int status;
130128

131129
delayed_work = to_delayed_work(work);
132130
adc_bat = container_of(delayed_work, struct gab, bat_work);
133131
status = adc_bat->status;
134132

135-
is_plugged = power_supply_am_i_supplied(adc_bat->psy);
136-
adc_bat->cable_plugged = is_plugged;
137-
138-
if (!is_plugged)
133+
if (!power_supply_am_i_supplied(adc_bat->psy))
139134
adc_bat->status = POWER_SUPPLY_STATUS_DISCHARGING;
140135
else if (gab_charge_finished(adc_bat))
141136
adc_bat->status = POWER_SUPPLY_STATUS_NOT_CHARGING;
@@ -177,7 +172,6 @@ static int gab_probe(struct platform_device *pdev)
177172
psy_desc->name = dev_name(&pdev->dev);
178173

179174
/* bootup default values for the battery */
180-
adc_bat->cable_plugged = false;
181175
adc_bat->status = POWER_SUPPLY_STATUS_DISCHARGING;
182176
psy_desc->type = POWER_SUPPLY_TYPE_BATTERY;
183177
psy_desc->get_property = gab_get_property;

0 commit comments

Comments
 (0)