Skip to contentSkip to conversation

staging: kpc2000: kpc2000_i2c: void* -> void *

PATCH In review Hao Xu 3 participants 4 messages Jun 8, 2019 – Jun 9, 2019 Staging

lore
Share & tools
lore

Hao Xu

author
#0 lore raw

PATCH 1/2 staging: kpc2000: kpc2000_i2c: void* -> void *

modify void* to void * for #define inb_p(a) readq((void*)a) and #define outb_p(d,a) writeq(d,(void*)a)

---
 drivers/staging/kpc2000/kpc2000_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/kpc2000/kpc2000_i2c.c +2 -2
index a434dd0..de3a0c8 100644
@@ -124,9 +124,9 @@ struct i2c_device {
 
 // FIXME!
 #undef inb_p
-#define inb_p(a) readq((void*)a)
+#define inb_p(a) readq((void *)a)
 #undef outb_p
-#define outb_p(d,a) writeq(d,(void*)a)
+#define outb_p(d,a) writeq(d,(void *)a)
 
 /* Make sure the SMBus host is ready to start transmitting.
  * Return 0 if it is, -EBUSY if it is not.
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 2/2 staging: kpc2000: kpc2000_i2c: add space after ,

add space after , for #define outb_p(d,a) writeq(d,(void *)a)

---
 drivers/staging/kpc2000/kpc2000_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/kpc2000/kpc2000_i2c.c +1 -1
index de3a0c8..69e8773 100644
@@ -126,7 +126,7 @@ struct i2c_device {
 #undef inb_p
 #define inb_p(a) readq((void *)a)
 #undef outb_p
-#define outb_p(d,a) writeq(d,(void *)a)
+#define outb_p(d, a) writeq(d, (void *)a)
 
 /* Make sure the SMBus host is ready to start transmitting.
  * Return 0 if it is, -EBUSY if it is not.
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Hao Xu
Quoted 13 lines · Hao Xu

modify void* to void * for #define inb_p(a) readq((void*)a) and #define outb_p(d,a) writeq(d,(void*)a)

---
 drivers/staging/kpc2000/kpc2000_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/kpc2000/kpc2000_i2c.c +0 -0
index a434dd0..de3a0c8 100644

drivers/staging/kpc2000/kpc2000_i2c.c struct i2c_device { · line 129

Quoted 8 lines
drivers/staging/kpc2000/kpc2000_i2c.c +2 -2
@@ -124,9 +124,9 @@ struct i2c_device {
 
 // FIXME!
 #undef inb_p
-#define inb_p(a) readq((void*)a)
+#define inb_p(a) readq((void *)a)
 #undef outb_p
-#define outb_p(d,a) writeq(d,(void*)a)
+#define outb_p(d,a) writeq(d,(void *)a)

Alternatively to fixing up the style here, did you consider just removing these two macros altogether and calling [read|write]q directly throughout the kpc_i2c driver (per the '//FIXME' comment)?

Unless, I'm misunderstanding something, these macros are shadowing the functions [in|out]b_p, which already exist in io.h. [in|out]b_p are for 8-bit i/o transactions and [read|write]q are for 64-bit transactions, so shadowing the original [in|out]b_p with something that actually does 64-bit transactions is probably potentially misleading here.

maintainer
#3 lore raw
Quoted 27 lines · Geordan Neukum
Quoted 13 lines · Hao Xu

modify void* to void * for #define inb_p(a) readq((void*)a) and #define outb_p(d,a) writeq(d,(void*)a)

---
 drivers/staging/kpc2000/kpc2000_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/kpc2000/kpc2000_i2c.c +0 -0
index a434dd0..de3a0c8 100644

drivers/staging/kpc2000/kpc2000_i2c.c struct i2c_device { · line 129

Quoted 8 lines
drivers/staging/kpc2000/kpc2000_i2c.c +2 -2
@@ -124,9 +124,9 @@ struct i2c_device {
 
 // FIXME!
 #undef inb_p
-#define inb_p(a) readq((void*)a)
+#define inb_p(a) readq((void *)a)
 #undef outb_p
-#define outb_p(d,a) writeq(d,(void*)a)
+#define outb_p(d,a) writeq(d,(void *)a)

Alternatively to fixing up the style here, did you consider just removing these two macros altogether and calling [read|write]q directly throughout the kpc_i2c driver (per the '//FIXME' comment)?

Quoted 5 lines

Unless, I'm misunderstanding something, these macros are shadowing the functions [in|out]b_p, which already exist in io.h. [in|out]b_p are for 8-bit i/o transactions and [read|write]q are for 64-bit transactions, so shadowing the original [in|out]b_p with something that actually does 64-bit transactions is probably potentially misleading here.

Yes, these should be fixed up "properly". But I'll take the coding style cleanups for now.

thanks,

greg k-h