linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: hid: hid-logitech-hidpp.c: Fix indentation errors
@ 2021-05-03  7:36 Shubhankar Kuranagatti
  0 siblings, 0 replies; only message in thread
From: Shubhankar Kuranagatti @ 2021-05-03  7:36 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, rydberg, linux-input, linux-kernel,
	sanjanasrinidhi1810

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@gmail.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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-03  7:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03  7:36 [PATCH] drivers: hid: hid-logitech-hidpp.c: Fix indentation errors Shubhankar Kuranagatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).