Skip to contentSkip to conversation

drivers/hid/wacom: fixed coding style issues

PATCH In review Robin Schroer 3 participants 8 messages Jan 21, 2014 – Jan 22, 2014 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/hid/wacom: fixed coding style issues

Fixed some coding style issues regarding spaces before semicolons and closing parenthesis.

---
 drivers/hid/hid-wacom.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hid/hid-wacom.c +4 -4
index 60c75dc..ebcca0d 100644
@@ -77,8 +77,8 @@ static void wacom_scramble(__u8 *image)
 	__u16 mask;
 	__u16 s1;
 	__u16 s2;
-	__u16 r1 ;
-	__u16 r2 ;
+	__u16 r1;
+	__u16 r2;
 	__u16 r;
 	__u8 buf[256];
 	int i, w, x, y, z;
@@ -336,7 +336,7 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
-		rep_data[0] = 0x03 ; rep_data[1] = 0x00;
+		rep_data[0] = 0x03; rep_data[1] = 0x00;
 		limit = 3;
 		do {
 			ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
@@ -404,7 +404,7 @@ static ssize_t wacom_store_speed(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	int new_speed;
 
-	if (sscanf(buf, "%1d", &new_speed ) != 1)
+	if (sscanf(buf, "%1d", &new_speed) != 1)
 		return -EINVAL;
 
 	if (new_speed == 0 || new_speed == 1) {
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 33 lines · Robin Schroer

Fixed some coding style issues regarding spaces before semicolons and closing parenthesis.

---
 drivers/hid/hid-wacom.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hid/hid-wacom.c +3 -3
index 60c75dc..ebcca0d 100644
@@ -77,8 +77,8 @@ static void wacom_scramble(__u8 *image)
 	__u16 mask;
 	__u16 s1;
 	__u16 s2;
-	__u16 r1 ;
-	__u16 r2 ;
+	__u16 r1;
+	__u16 r2;
 	__u16 r;
 	__u8 buf[256];
 	int i, w, x, y, z;
@@ -336,7 +336,7 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
-		rep_data[0] = 0x03 ; rep_data[1] = 0x00;
+		rep_data[0] = 0x03; rep_data[1] = 0x00;
 		limit = 3;
 		do {
 			ret = hdev->hid_output_raw_report(hdev, rep_data, 2,

drivers/hid/hid-wacom.c static ssize_t wacom_store_speed(struct device *dev, · line 408

Quoted 6 lines
drivers/hid/hid-wacom.c +1 -1
@@ -404,7 +404,7 @@ static ssize_t wacom_store_speed(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	int new_speed;
 
-	if (sscanf(buf, "%1d", &new_speed ) != 1)
+	if (sscanf(buf, "%1d", &new_speed) != 1)
 		return -EINVAL;

Why doesn't it use kstrtoXXX()?

Thanks.

Quoted 10 lines
drivers/hid/hid-wacom.c +0 -0
 	if (new_speed == 0 || new_speed == 1) {
Signature · 7 lines
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
Dmitry
#2 lore raw
Quoted 37 lines · Dmitry Torokhov
Quoted 36 lines · Robin Schroer

Fixed some coding style issues regarding spaces before semicolons and closing parenthesis.

---
 drivers/hid/hid-wacom.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hid/hid-wacom.c +3 -3
index 60c75dc..ebcca0d 100644
@@ -77,8 +77,8 @@ static void wacom_scramble(__u8 *image)
 	__u16 mask;
 	__u16 s1;
 	__u16 s2;
-	__u16 r1 ;
-	__u16 r2 ;
+	__u16 r1;
+	__u16 r2;
 	__u16 r;
 	__u8 buf[256];
 	int i, w, x, y, z;
@@ -336,7 +336,7 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
-		rep_data[0] = 0x03 ; rep_data[1] = 0x00;
+		rep_data[0] = 0x03; rep_data[1] = 0x00;
 		limit = 3;
 		do {
 			ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
@@ -404,7 +404,7 @@ static ssize_t wacom_store_speed(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	int new_speed;
 
Quoted 8 lines

drivers/hid/hid-wacom.c static ssize_t wacom_store_speed(struct device *dev, · line 408

Quoted 3 lines
drivers/hid/hid-wacom.c +1 -1
-	if (sscanf(buf, "%1d", &new_speed ) != 1)
+	if (sscanf(buf, "%1d", &new_speed) != 1)
 		return -EINVAL;

Why doesn't it use kstrtoXXX()?

Thanks.

As far as I can see, kstrtoXXX() might be an alternative, but I was just fixing coding style issues, no need to break anything IMO.

Quoted 5 lines
Quoted 5 lines
drivers/hid/hid-wacom.c +0 -0
 	if (new_speed == 0 || new_speed == 1) {
Signature · 1 line
1.8.4.2
Quoted 8 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 1 line
Dmitry

--
Robin

#3 lore raw
Quoted 44 lines · Rob Schroer
Quoted 43 lines · Dmitry Torokhov
Quoted 33 lines · Robin Schroer

Fixed some coding style issues regarding spaces before semicolons and closing parenthesis.

---
 drivers/hid/hid-wacom.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hid/hid-wacom.c +3 -3
index 60c75dc..ebcca0d 100644
@@ -77,8 +77,8 @@ static void wacom_scramble(__u8 *image)
 	__u16 mask;
 	__u16 s1;
 	__u16 s2;
-	__u16 r1 ;
-	__u16 r2 ;
+	__u16 r1;
+	__u16 r2;
 	__u16 r;
 	__u8 buf[256];
 	int i, w, x, y, z;
@@ -336,7 +336,7 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
-		rep_data[0] = 0x03 ; rep_data[1] = 0x00;
+		rep_data[0] = 0x03; rep_data[1] = 0x00;
 		limit = 3;
 		do {
 			ret = hdev->hid_output_raw_report(hdev, rep_data, 2,

drivers/hid/hid-wacom.c static ssize_t wacom_store_speed(struct device *dev, · line 408

Quoted 6 lines
drivers/hid/hid-wacom.c +1 -1
@@ -404,7 +404,7 @@ static ssize_t wacom_store_speed(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	int new_speed;
 
-	if (sscanf(buf, "%1d", &new_speed ) != 1)
+	if (sscanf(buf, "%1d", &new_speed) != 1)
 		return -EINVAL;

Why doesn't it use kstrtoXXX()?

Quoted 5 lines
Quoted 2 lines

Thanks.

As far as I can see, kstrtoXXX() might be an alternative, but I was just fixing coding style issues, no need to break anything IMO.

You could do the breaking in a follow up patch ;)

Thanks.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 5 lines · Dmitry Torokhov
Quoted 2 lines · Rob Schroer

As far as I can see, kstrtoXXX() might be an alternative, but I was just fixing coding style issues, no need to break anything IMO.

You could do the breaking in a follow up patch ;)

Yes please.

Include the breaking of multiple statements
into multiple lines too please like

from:

	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
		rep_data[0] = 0x03; rep_data[1] = 0x00;

to:

	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
		rep_data[0] = 0x03;
		rep_data[1] = 0x00;
#5 lore raw
Quoted 12 lines · Joe Perches
Quoted 5 lines · Dmitry Torokhov
Quoted 2 lines · Rob Schroer

As far as I can see, kstrtoXXX() might be an alternative, but I was just fixing coding style issues, no need to break anything IMO.

You could do the breaking in a follow up patch ;)

Yes please.

Include the breaking of multiple statements
into multiple lines too please like

Quoted 10 lines

from:

	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
		rep_data[0] = 0x03; rep_data[1] = 0x00;

to:

	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
		rep_data[0] = 0x03;
		rep_data[1] = 0x00;

Added a cosmetical linebreak, switched an occurence of sscanf to kstrtoint.

---
 drivers/hid/hid-wacom.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hid/hid-wacom.c +3 -2
index ebcca0d..5daf80c 100644
@@ -336,7 +336,8 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
-		rep_data[0] = 0x03; rep_data[1] = 0x00;
+		rep_data[0] = 0x03;
+		rep_data[1] = 0x00;
 		limit = 3;
 		do {
 			ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
@@ -404,7 +405,7 @@ static ssize_t wacom_store_speed(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	int new_speed;
 
-	if (sscanf(buf, "%1d", &new_speed) != 1)
+	if (kstrtoint(buf, 10, &new_speed))
 		return -EINVAL;
 
 	if (new_speed == 0 || new_speed == 1) {

--
1.8.4.2

Well, I hope this works as intended.

--
Robin

#6 lore raw
Quoted 46 lines · Rob Schroer
Quoted 12 lines · Joe Perches
Quoted 5 lines · Dmitry Torokhov
Quoted 2 lines · Rob Schroer

As far as I can see, kstrtoXXX() might be an alternative, but I was just fixing coding style issues, no need to break anything IMO.

You could do the breaking in a follow up patch ;)

Yes please.

Include the breaking of multiple statements
into multiple lines too please like

Quoted 10 lines

from:

	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
		rep_data[0] = 0x03; rep_data[1] = 0x00;

to:

	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
		rep_data[0] = 0x03;
		rep_data[1] = 0x00;

Added a cosmetical linebreak, switched an occurence of sscanf to kstrtoint.

---
 drivers/hid/hid-wacom.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hid/hid-wacom.c +2 -1
index ebcca0d..5daf80c 100644
@@ -336,7 +336,8 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
-		rep_data[0] = 0x03; rep_data[1] = 0x00;
+		rep_data[0] = 0x03;
+		rep_data[1] = 0x00;
 		limit = 3;
 		do {
 			ret = hdev->hid_output_raw_report(hdev, rep_data, 2,

drivers/hid/hid-wacom.c static ssize_t wacom_store_speed(struct device *dev, · line 409

Quoted 6 lines
drivers/hid/hid-wacom.c +1 -1
@@ -404,7 +405,7 @@ static ssize_t wacom_store_speed(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	int new_speed;
 
-	if (sscanf(buf, "%1d", &new_speed) != 1)
+	if (kstrtoint(buf, 10, &new_speed))
 		return -EINVAL;

I think this should be

	error = kstrtoint(buf, 10, &new_speed);
	if (error)
		return error;
Quoted 9 lines
drivers/hid/hid-wacom.c +0 -1
 	if (new_speed == 0 || new_speed == 1) {
--

1.8.4.2

Well, I hope this works as intended.

--
Robin

Signature · 1 line
Dmitry
#7 lore raw
Quoted 6 lines · Dmitry Torokhov

I think this should be

	error = kstrtoint(buf, 10, &new_speed);
	if (error)
		return error;

I just lost my SSD/branch, so here is a fresh patch for mainline:

Fixed some coding style issues, removed unessecary spaces, added linebreaks, converted an occurence of sscanf to kstrtoint.

---
 drivers/hid/hid-wacom.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/hid/hid-wacom.c +8 -5
index 60c75dc..c7f9d1c 100644
@@ -77,8 +77,8 @@ static void wacom_scramble(__u8 *image)
 	__u16 mask;
 	__u16 s1;
 	__u16 s2;
-	__u16 r1 ;
-	__u16 r2 ;
+	__u16 r1;
+	__u16 r2;
 	__u16 r;
 	__u8 buf[256];
 	int i, w, x, y, z;
@@ -336,7 +336,8 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
-		rep_data[0] = 0x03 ; rep_data[1] = 0x00;
+		rep_data[0] = 0x03;
+		rep_data[1] = 0x00;
 		limit = 3;
 		do {
 			ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
@@ -403,9 +404,11 @@ static ssize_t wacom_store_speed(struct device *dev,
 {
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	int new_speed;
+	int error;
 
-	if (sscanf(buf, "%1d", &new_speed ) != 1)
-		return -EINVAL;
+	error = kstrtoint(buf, 10, &new_speed);
+	if (error)
+		return error;
 
 	if (new_speed == 0 || new_speed == 1) {
 		wacom_set_features(hdev, new_speed);

--
1.8.4.2

--
Robin