linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hid-led.c: remove unneccessary underscores
@ 2016-10-03  8:16 Pavel Machek
  2016-10-03  9:45 ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2016-10-03  8:16 UTC (permalink / raw)
  To: j.anaszewski, linux-leds, kernel list, jikos, benjamin.tissoires,
	linux-input
  Cc: trivial

[-- Attachment #1: Type: text/plain, Size: 3581 bytes --]


u8 (and friends) can be used directly in kernel sources (not kernel
headers).

Signed-off-by: Pavel Machek <pavel@ucw.cz>

diff --git a/drivers/hid/hid-led.c b/drivers/hid/hid-led.c
index d8d55f3..cd208ca 100644
--- a/drivers/hid/hid-led.c
+++ b/drivers/hid/hid-led.c
@@ -46,20 +46,20 @@ static unsigned const char riso_kagaku_tbl[] = {
 #define RISO_KAGAKU_IX(r, g, b) riso_kagaku_tbl[((r)?1:0)+((g)?2:0)+((b)?4:0)]
 
 union delcom_packet {
-	__u8 data[8];
+	u8 data[8];
 	struct {
-		__u8 major_cmd;
-		__u8 minor_cmd;
-		__u8 data_lsb;
-		__u8 data_msb;
+		u8 major_cmd;
+		u8 minor_cmd;
+		u8 data_lsb;
+		u8 data_msb;
 	} tx;
 	struct {
-		__u8 cmd;
+		u8 cmd;
 	} rx;
 	struct {
-		__le16 family_code;
-		__le16 security_code;
-		__u8 fw_version;
+		le16 family_code;
+		le16 security_code;
+		u8 fw_version;
 	} fw;
 };
 
@@ -112,7 +112,7 @@ module_param(riso_kagaku_switch_green_blue, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(riso_kagaku_switch_green_blue,
 	"switch green and blue RGB component for Riso Kagaku devices");
 
-static int hidled_send(struct hidled_device *ldev, __u8 *buf)
+static int hidled_send(struct hidled_device *ldev, u8 *buf)
 {
 	int ret;
 
@@ -138,7 +138,7 @@ static int hidled_send(struct hidled_device *ldev, __u8 *buf)
 }
 
 /* reading data is supported for report type RAW_REQUEST only */
-static int hidled_recv(struct hidled_device *ldev, __u8 *buf)
+static int hidled_recv(struct hidled_device *ldev, u8 *buf)
 {
 	int ret;
 
@@ -182,7 +182,7 @@ static int riso_kagaku_write(struct led_classdev *cdev, enum led_brightness br)
 {
 	struct hidled_led *led = to_hidled_led(cdev);
 	struct hidled_rgb *rgb = led->rgb;
-	__u8 buf[MAX_REPORT_SIZE] = {};
+	u8 buf[MAX_REPORT_SIZE] = {};
 
 	buf[1] = riso_kagaku_index(rgb);
 
@@ -193,7 +193,7 @@ static int dream_cheeky_write(struct led_classdev *cdev, enum led_brightness br)
 {
 	struct hidled_led *led = to_hidled_led(cdev);
 	struct hidled_rgb *rgb = led->rgb;
-	__u8 buf[MAX_REPORT_SIZE] = {};
+	u8 buf[MAX_REPORT_SIZE] = {};
 
 	buf[1] = rgb->red.cdev.brightness;
 	buf[2] = rgb->green.cdev.brightness;
@@ -206,7 +206,7 @@ static int dream_cheeky_write(struct led_classdev *cdev, enum led_brightness br)
 
 static int dream_cheeky_init(struct hidled_device *ldev)
 {
-	__u8 buf[MAX_REPORT_SIZE] = {};
+	u8 buf[MAX_REPORT_SIZE] = {};
 
 	/* Dream Cheeky magic */
 	buf[1] = 0x1f;
@@ -222,7 +222,7 @@ static int _thingm_write(struct led_classdev *cdev, enum led_brightness br,
 			 u8 offset)
 {
 	struct hidled_led *led = to_hidled_led(cdev);
-	__u8 buf[MAX_REPORT_SIZE] = { 1, 'c' };
+	u8 buf[MAX_REPORT_SIZE] = { 1, 'c' };
 
 	buf[2] = led->rgb->red.cdev.brightness;
 	buf[3] = led->rgb->green.cdev.brightness;
@@ -254,7 +254,7 @@ static const struct hidled_config hidled_config_thingm_v1 = {
 
 static int thingm_init(struct hidled_device *ldev)
 {
-	__u8 buf[MAX_REPORT_SIZE] = { 1, 'v' };
+	u8 buf[MAX_REPORT_SIZE] = { 1, 'v' };
 	int ret;
 
 	ret = hidled_recv(ldev, buf);
@@ -333,7 +333,7 @@ static int delcom_init(struct hidled_device *ldev)
 static int luxafor_write(struct led_classdev *cdev, enum led_brightness br)
 {
 	struct hidled_led *led = to_hidled_led(cdev);
-	__u8 buf[MAX_REPORT_SIZE] = { [1] = 1 };
+	u8 buf[MAX_REPORT_SIZE] = { [1] = 1 };
 
 	buf[2] = led->rgb->num + 1;
 	buf[3] = led->rgb->red.cdev.brightness;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] hid-led.c: remove unneccessary underscores
  2016-10-03  8:16 [PATCH] hid-led.c: remove unneccessary underscores Pavel Machek
@ 2016-10-03  9:45 ` Pavel Machek
  2016-10-07 16:25   ` Benjamin Tissoires
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2016-10-03  9:45 UTC (permalink / raw)
  To: j.anaszewski, linux-leds, kernel list, jikos, benjamin.tissoires,
	linux-input
  Cc: trivial

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

On Mon 2016-10-03 10:16:26, Pavel Machek wrote:
> 
> u8 (and friends) can be used directly in kernel sources (not kernel
> headers).
> 
> Signed-off-by: Pavel Machek <pavel@ucw.cz>

Zero day bot warned me that this is not quiet correct.

This would be needed on top. Is there interest in fixed patch?

diff --git a/drivers/hid/hid-led.c b/drivers/hid/hid-led.c
index cd208ca..be659ca 100644
--- a/drivers/hid/hid-led.c
+++ b/drivers/hid/hid-led.c
@@ -57,8 +57,8 @@ union delcom_packet {
 		u8 cmd;
 	} rx;
 	struct {
-		le16 family_code;
-		le16 security_code;
+		__le16 family_code;
+		__le16 security_code;
 		u8 fw_version;
 	} fw;
 };



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] hid-led.c: remove unneccessary underscores
  2016-10-03  9:45 ` Pavel Machek
@ 2016-10-07 16:25   ` Benjamin Tissoires
  2016-10-07 18:46     ` Heiner Kallweit
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Tissoires @ 2016-10-07 16:25 UTC (permalink / raw)
  To: Pavel Machek
  Cc: j.anaszewski, linux-leds, kernel list, jikos, linux-input, trivial

On Oct 03 2016 or thereabouts, Pavel Machek wrote:
> On Mon 2016-10-03 10:16:26, Pavel Machek wrote:
> > 
> > u8 (and friends) can be used directly in kernel sources (not kernel
> > headers).
> > 
> > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> 
> Zero day bot warned me that this is not quiet correct.
> 
> This would be needed on top. Is there interest in fixed patch?

Having both __ and not __ in the same driver would be a little bit
weird. So I'd say we just continue with the existing code. Thanks for
the submission BTW!

Cheers,
Benjamin

> 
> diff --git a/drivers/hid/hid-led.c b/drivers/hid/hid-led.c
> index cd208ca..be659ca 100644
> --- a/drivers/hid/hid-led.c
> +++ b/drivers/hid/hid-led.c
> @@ -57,8 +57,8 @@ union delcom_packet {
>  		u8 cmd;
>  	} rx;
>  	struct {
> -		le16 family_code;
> -		le16 security_code;
> +		__le16 family_code;
> +		__le16 security_code;
>  		u8 fw_version;
>  	} fw;
>  };
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hid-led.c: remove unneccessary underscores
  2016-10-07 16:25   ` Benjamin Tissoires
@ 2016-10-07 18:46     ` Heiner Kallweit
  0 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2016-10-07 18:46 UTC (permalink / raw)
  To: Benjamin Tissoires, Pavel Machek
  Cc: j.anaszewski, linux-leds, kernel list, jikos, linux-input, trivial

Am 07.10.2016 um 18:25 schrieb Benjamin Tissoires:
> On Oct 03 2016 or thereabouts, Pavel Machek wrote:
>> On Mon 2016-10-03 10:16:26, Pavel Machek wrote:
>>>
>>> u8 (and friends) can be used directly in kernel sources (not kernel
>>> headers).
>>>
>>> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>
>> Zero day bot warned me that this is not quiet correct.
>>
>> This would be needed on top. Is there interest in fixed patch?
> 
> Having both __ and not __ in the same driver would be a little bit
> weird. So I'd say we just continue with the existing code. Thanks for
> the submission BTW!
> 
Reason for me to choose the __ types here was that hid_hw_raw_request
defines the buffer argument as "__u8 *buf" and I wanted to be in line
with that.

> Cheers,
> Benjamin
> 
>>
>> diff --git a/drivers/hid/hid-led.c b/drivers/hid/hid-led.c
>> index cd208ca..be659ca 100644
>> --- a/drivers/hid/hid-led.c
>> +++ b/drivers/hid/hid-led.c
>> @@ -57,8 +57,8 @@ union delcom_packet {
>>  		u8 cmd;
>>  	} rx;
>>  	struct {
>> -		le16 family_code;
>> -		le16 security_code;
>> +		__le16 family_code;
>> +		__le16 security_code;
>>  		u8 fw_version;
>>  	} fw;
>>  };
>>
>>
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-leds" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-07 18:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-03  8:16 [PATCH] hid-led.c: remove unneccessary underscores Pavel Machek
2016-10-03  9:45 ` Pavel Machek
2016-10-07 16:25   ` Benjamin Tissoires
2016-10-07 18:46     ` Heiner Kallweit

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).