[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210820144527.19137-1-niklaslantau@gmail.com>
Date: Fri, 20 Aug 2021 16:45:27 +0200
From: Niklas Lantau <niklaslantau@...il.com>
To: jikos@...nel.org
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
Niklas Lantau <niklaslantau@...il.com>
Subject: [PATCH] Hid: hid-logitech-hidpp: fixed coding style issues
Fixed coding style issues that generated 5 errors and 10 warnings.
Signed-off-by: Niklas Lantau <niklaslantau@...il.com>
---
drivers/hid/hid-logitech-hidpp.c | 195 ++++++++++++++++---------------
1 file changed, 101 insertions(+), 94 deletions(-)
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 61635e629469..8fbf65d74c0f 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -1086,30 +1086,32 @@ 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;
- /* 5 = invalid battery type
- 6 = thermal error
- 7 = other charging error */
- default:
- status = POWER_SUPPLY_STATUS_NOT_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;
}
return status;
@@ -1287,15 +1289,12 @@ static int hidpp20_battery_map_status_voltage(u8 data[3], int *voltage,
status = POWER_SUPPLY_STATUS_DISCHARGING;
*charge_type = POWER_SUPPLY_CHARGE_TYPE_STANDARD;
- if (test_bit(3, &flags)) {
+ if (test_bit(3, &flags))
*charge_type = POWER_SUPPLY_CHARGE_TYPE_FAST;
- }
- if (test_bit(4, &flags)) {
+ if (test_bit(4, &flags))
*charge_type = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
- }
- if (test_bit(5, &flags)) {
+ if (test_bit(5, &flags))
*level = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL;
- }
*voltage = get_unaligned_be16(data);
@@ -1458,24 +1457,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;
@@ -1624,44 +1623,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;
@@ -3190,7 +3189,9 @@ static int lg_dinovo_input_mapping(struct hid_device *hdev, struct hid_input *hi
return 0;
switch (usage->hid & HID_USAGE) {
- case 0x00d: lg_map_key_clear(KEY_MEDIA); break;
+ case 0x00d:
+ lg_map_key_clear(KEY_MEDIA);
+ break;
default:
return 0;
}
@@ -3620,8 +3621,10 @@ static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report,
break;
}
- /* If no report is available for further processing, skip calling
- * raw_event of subclasses. */
+ /*
+ * If no report is available for further processing, skip calling
+ * raw_event of subclasses.
+ */
if (ret != 0)
return ret;
@@ -3681,9 +3684,11 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
if (hidpp->quirks & HIDPP_QUIRK_CLASS_K750)
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 */
+ /*
+ * 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
+ */
ret = hidpp20_query_battery_info_1000(hidpp);
if (ret)
ret = hidpp20_query_battery_info_1004(hidpp);
@@ -3859,8 +3864,10 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
return;
}
- /* the device is already connected, we can ask for its name and
- * protocol */
+ /*
+ * the device is already connected, we can ask for its name and
+ * protocol
+ */
if (!hidpp->protocol_major) {
ret = hidpp_root_get_protocol_version(hidpp);
if (ret) {
--
2.33.0
Powered by blists - more mailing lists