Skip to contentSkip to conversation

staging: axis-fifo: Fix line over 80 characters error

PATCH In review Aleksa Zdravkovic 3 participants 4 messages Oct 24, 2018 – Oct 25, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: axis-fifo: Fix line over 80 characters error

This patch fixes the checkpatch.pl warning:

WARNING: line over 80 characters
+ (write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :

---
 drivers/staging/axis-fifo/axis-fifo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +3 -3
index c18bf31f55b6..2f609712f507 100644
@@ -482,10 +482,10 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
 		spin_lock_irq(&fifo->write_queue_lock);
 		ret = wait_event_interruptible_lock_irq_timeout
 			(fifo->write_queue,
-			 ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
+			ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
 				>= words_to_write,
-			 fifo->write_queue_lock,
-			 (write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
+			fifo->write_queue_lock,
+			(write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
 				MAX_SCHEDULE_TIMEOUT);
 		spin_unlock_irq(&fifo->write_queue_lock);
 
Signature · 1 line
2.19.1
#1 lore raw
Quoted 16 lines · Aleksa Zdravkovic

This patch fixes the checkpatch.pl warning:

WARNING: line over 80 characters

drivers/staging/axis-fifo/axis-fifo.c +1 -0
+			 (write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
---
 drivers/staging/axis-fifo/axis-fifo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +0 -0
index c18bf31f55b6..2f609712f507 100644
@@ -482,10 +482,10 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
 		spin_lock_irq(&fifo->write_queue_lock);

drivers/staging/axis-fifo/axis-fifo.c static ssize_t axis_fifo_write(struct file *f, const char __user *buf, · line 489

Quoted 10 lines
drivers/staging/axis-fifo/axis-fifo.c +3 -3
 		ret = wait_event_interruptible_lock_irq_timeout
 			(fifo->write_queue,
-			 ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
+			ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
 				>= words_to_write,
-			 fifo->write_queue_lock,
-			 (write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
+			fifo->write_queue_lock,
+			(write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
 				MAX_SCHEDULE_TIMEOUT);

The original was fine. Just leave it.

Checkpatch.pl is only useful if it improves the readability for humans.

regards,
dan carpenter

#2 lore raw
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Aleksa Zdravkovic

This patch fixes the checkpatch.pl warning:

[]

Quoted 1 line

drivers/staging/axis-fifo/axis-fifo.c

Quoted 1 line
drivers/staging/axis-fifo/axis-fifo.c +0 -0

[]

Quoted 15 lines

drivers/staging/axis-fifo/axis-fifo.c static ssize_t axis_fifo_write(struct file *f, const char __user *buf, · line 489

Quoted 12 lines
drivers/staging/axis-fifo/axis-fifo.c +3 -3
@@ -482,10 +482,10 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
 		spin_lock_irq(&fifo->write_queue_lock);
 		ret = wait_event_interruptible_lock_irq_timeout
 			(fifo->write_queue,
-			 ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
+			ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
 				>= words_to_write,
-			 fifo->write_queue_lock,
-			 (write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
+			fifo->write_queue_lock,
+			(write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
 				MAX_SCHEDULE_TIMEOUT);

The original was fine. Just leave it.

Quoted 1 line

Checkpatch.pl is only useful if it improves the readability for humans.

True, but I think the original is just OK.

Any suggestion on how to make the thing better?

wait_event_interruptible_lock_irq_timeout is a fairly long identifier with multiple long arguments.

It's as if it should be written here as

ret = wait_event_interruptible_lock_irq_timeout(fifo->write_queue,

								ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) >= words_to_write,
								fifo->write_queue_lock,
								write_timeout >= 0 ? msecs_to_jiffies(write_timeout) : MAX_SCHEDULE_TIMEOUT);

where the longest is way over 80 chars, (140?) but I simply don't care because it's just that much more readable for me.

#3 lore raw
Quoted 32 lines · Joe Perches
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Aleksa Zdravkovic

This patch fixes the checkpatch.pl warning:

[]

Quoted 1 line

drivers/staging/axis-fifo/axis-fifo.c

Quoted 1 line
drivers/staging/axis-fifo/axis-fifo.c +0 -0

[]

Quoted 15 lines

drivers/staging/axis-fifo/axis-fifo.c static ssize_t axis_fifo_write(struct file *f, const char __user *buf, · line 489

Quoted 12 lines
drivers/staging/axis-fifo/axis-fifo.c +3 -3
@@ -482,10 +482,10 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
 		spin_lock_irq(&fifo->write_queue_lock);
 		ret = wait_event_interruptible_lock_irq_timeout
 			(fifo->write_queue,
-			 ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
+			ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
 				>= words_to_write,
-			 fifo->write_queue_lock,
-			 (write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
+			fifo->write_queue_lock,
+			(write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
 				MAX_SCHEDULE_TIMEOUT);

The original was fine. Just leave it.

Quoted 1 line

Checkpatch.pl is only useful if it improves the readability for humans.

True, but I think the original is just OK.

Any suggestion on how to make the thing better?

wait_event_interruptible_lock_irq_timeout is a fairly long identifier with multiple long arguments.

It's as if it should be written here as

Quoted 9 lines

ret = wait_event_interruptible_lock_irq_timeout(fifo->write_queue,

								ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) >= words_to_write,
								fifo->write_queue_lock,
								write_timeout >= 0 ? msecs_to_jiffies(write_timeout) : MAX_SCHEDULE_TIMEOUT);

where the longest is way over 80 chars, (140?) but I simply don't care because it's just that much more readable for me.

Thank you Dan and Joe for your feedback.

I don't have any suggestion how to improve this code otherwise. I will try to find a way to improve it. Maybe we can define some macros but I don't think it would help much.