[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210503073613.utl3xmlglboxv4qg@kewl-virtual-machine>
Date: Mon, 3 May 2021 13:06:13 +0530
From: Shubhankar Kuranagatti <shubhankarvk@...il.com>
To: jikos@...nel.org
Cc: benjamin.tissoires@...hat.com, rydberg@...math.org,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
sanjanasrinidhi1810@...il.com
Subject: [PATCH] drivers: hid: hid-logitech-hidpp.c: Fix indentation errors
case and switch have been indented one below the other.
A * has been added for every line in a multi line comment.
The closing */ has been shifted to a new line
This is done to maintain code uniformity.
Incorrect repetiton of the word 'in' corrected.
Signed-off-by: Shubhankar Kuranagatti <shubhankarvk@...il.com>
---
drivers/hid/hid-logitech-hidpp.c | 170 ++++++++++++++++---------------
1 file changed, 87 insertions(+), 83 deletions(-)
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index d459e2dbe647..1de187c9a0eb 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -1083,30 +1083,31 @@ static int hidpp20_batterylevel_map_status_capacity(u8 data[3], int *capacity,
* For all other states the device reports 0 (unknown).
*/
switch (data[2]) {
- case 0: /* discharging (in use) */
- status = POWER_SUPPLY_STATUS_DISCHARGING;
- *level = hidpp_map_battery_level(*capacity);
- break;
- case 1: /* recharging */
- status = POWER_SUPPLY_STATUS_CHARGING;
- break;
- case 2: /* charge in final stage */
- status = POWER_SUPPLY_STATUS_CHARGING;
- break;
- case 3: /* charge complete */
- status = POWER_SUPPLY_STATUS_FULL;
- *level = POWER_SUPPLY_CAPACITY_LEVEL_FULL;
- *capacity = 100;
- break;
- case 4: /* recharging below optimal speed */
- status = POWER_SUPPLY_STATUS_CHARGING;
- break;
+ case 0: /* discharging (in use) */
+ status = POWER_SUPPLY_STATUS_DISCHARGING;
+ *level = hidpp_map_battery_level(*capacity);
+ break;
+ case 1: /* recharging */
+ status = POWER_SUPPLY_STATUS_CHARGING;
+ break;
+ case 2: /* charge in final stage */
+ status = POWER_SUPPLY_STATUS_CHARGING;
+ break;
+ case 3: /* charge complete */
+ status = POWER_SUPPLY_STATUS_FULL;
+ *level = POWER_SUPPLY_CAPACITY_LEVEL_FULL;
+ *capacity = 100;
+ break;
+ case 4: /* recharging below optimal speed */
+ status = POWER_SUPPLY_STATUS_CHARGING;
+ break;
/* 5 = invalid battery type
- 6 = thermal error
- 7 = other charging error */
- default:
- status = POWER_SUPPLY_STATUS_NOT_CHARGING;
- break;
+ * 6 = thermal error
+ * 7 = other charging error
+ */
+ default:
+ status = POWER_SUPPLY_STATUS_NOT_CHARGING;
+ break;
}
return status;
@@ -1454,24 +1455,24 @@ static int hidpp20_unifiedbattery_map_status(struct hidpp_device *hidpp,
int status;
switch (charging_status) {
- case 0: /* discharging */
- status = POWER_SUPPLY_STATUS_DISCHARGING;
- break;
- case 1: /* charging */
- case 2: /* charging slow */
- status = POWER_SUPPLY_STATUS_CHARGING;
- break;
- case 3: /* complete */
- status = POWER_SUPPLY_STATUS_FULL;
- break;
- case 4: /* error */
- status = POWER_SUPPLY_STATUS_NOT_CHARGING;
- hid_info(hidpp->hid_dev, "%s: charging error",
- hidpp->name);
- break;
- default:
- status = POWER_SUPPLY_STATUS_NOT_CHARGING;
- break;
+ case 0: /* discharging */
+ status = POWER_SUPPLY_STATUS_DISCHARGING;
+ break;
+ case 1: /* charging */
+ case 2: /* charging slow */
+ status = POWER_SUPPLY_STATUS_CHARGING;
+ break;
+ case 3: /* complete */
+ status = POWER_SUPPLY_STATUS_FULL;
+ break;
+ case 4: /* error */
+ status = POWER_SUPPLY_STATUS_NOT_CHARGING;
+ hid_info(hidpp->hid_dev, "%s: charging error",
+ hidpp->name);
+ break;
+ default:
+ status = POWER_SUPPLY_STATUS_NOT_CHARGING;
+ break;
}
return status;
@@ -1620,44 +1621,44 @@ static int hidpp_battery_get_property(struct power_supply *psy,
struct hidpp_device *hidpp = power_supply_get_drvdata(psy);
int ret = 0;
- switch(psp) {
- case POWER_SUPPLY_PROP_STATUS:
- val->intval = hidpp->battery.status;
- break;
- case POWER_SUPPLY_PROP_CAPACITY:
- val->intval = hidpp->battery.capacity;
- break;
- case POWER_SUPPLY_PROP_CAPACITY_LEVEL:
- val->intval = hidpp->battery.level;
- break;
- case POWER_SUPPLY_PROP_SCOPE:
- val->intval = POWER_SUPPLY_SCOPE_DEVICE;
- break;
- case POWER_SUPPLY_PROP_ONLINE:
- val->intval = hidpp->battery.online;
- break;
- case POWER_SUPPLY_PROP_MODEL_NAME:
- if (!strncmp(hidpp->name, "Logitech ", 9))
- val->strval = hidpp->name + 9;
- else
- val->strval = hidpp->name;
- break;
- case POWER_SUPPLY_PROP_MANUFACTURER:
- val->strval = "Logitech";
- break;
- case POWER_SUPPLY_PROP_SERIAL_NUMBER:
- val->strval = hidpp->hid_dev->uniq;
- break;
- case POWER_SUPPLY_PROP_VOLTAGE_NOW:
- /* hardware reports voltage in in mV. sysfs expects uV */
- val->intval = hidpp->battery.voltage * 1000;
- break;
- case POWER_SUPPLY_PROP_CHARGE_TYPE:
- val->intval = hidpp->battery.charge_type;
- break;
- default:
- ret = -EINVAL;
- break;
+ switch (psp) {
+ case POWER_SUPPLY_PROP_STATUS:
+ val->intval = hidpp->battery.status;
+ break;
+ case POWER_SUPPLY_PROP_CAPACITY:
+ val->intval = hidpp->battery.capacity;
+ break;
+ case POWER_SUPPLY_PROP_CAPACITY_LEVEL:
+ val->intval = hidpp->battery.level;
+ break;
+ case POWER_SUPPLY_PROP_SCOPE:
+ val->intval = POWER_SUPPLY_SCOPE_DEVICE;
+ break;
+ case POWER_SUPPLY_PROP_ONLINE:
+ val->intval = hidpp->battery.online;
+ break;
+ case POWER_SUPPLY_PROP_MODEL_NAME:
+ if (!strncmp(hidpp->name, "Logitech ", 9))
+ val->strval = hidpp->name + 9;
+ else
+ val->strval = hidpp->name;
+ break;
+ case POWER_SUPPLY_PROP_MANUFACTURER:
+ val->strval = "Logitech";
+ break;
+ case POWER_SUPPLY_PROP_SERIAL_NUMBER:
+ val->strval = hidpp->hid_dev->uniq;
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+ /* hardware reports voltage in mV. sysfs expects uV */
+ val->intval = hidpp->battery.voltage * 1000;
+ break;
+ case POWER_SUPPLY_PROP_CHARGE_TYPE:
+ val->intval = hidpp->battery.charge_type;
+ break;
+ default:
+ ret = -EINVAL;
+ break;
}
return ret;
@@ -3607,7 +3608,8 @@ static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report,
}
/* If no report is available for further processing, skip calling
- * raw_event of subclasses. */
+ * raw_event of subclasses.
+ */
if (ret != 0)
return ret;
@@ -3668,8 +3670,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
ret = hidpp_solar_request_battery_event(hidpp);
else {
/* we only support one battery feature right now, so let's
- first check the ones that support battery level first
- and leave voltage for last */
+ * first check the ones that support battery level first
+ * and leave voltage for last
+ */
ret = hidpp20_query_battery_info_1000(hidpp);
if (ret)
ret = hidpp20_query_battery_info_1004(hidpp);
@@ -3846,7 +3849,8 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
}
/* the device is already connected, we can ask for its name and
- * protocol */
+ * protocol
+ */
if (!hidpp->protocol_major) {
ret = hidpp_root_get_protocol_version(hidpp);
if (ret) {
--
2.17.1
Powered by blists - more mailing lists