linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: axis-fifo: Fix line over 80 characters error
@ 2018-10-24 15:05 Aleksa Zdravkovic
  2018-10-25  6:05 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Aleksa Zdravkovic @ 2018-10-24 15:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

This patch fixes the checkpatch.pl warning:

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

Signed-off-by: Aleksa Zdravkovic <alex.zdravkovic98@gmail.com>
---
 drivers/staging/axis-fifo/axis-fifo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index c18bf31f55b6..2f609712f507 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -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);
 
-- 
2.19.1


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

* Re: [PATCH] staging: axis-fifo: Fix line over 80 characters error
  2018-10-24 15:05 [PATCH] staging: axis-fifo: Fix line over 80 characters error Aleksa Zdravkovic
@ 2018-10-25  6:05 ` Dan Carpenter
  2018-10-25  6:18   ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2018-10-25  6:05 UTC (permalink / raw)
  To: Aleksa Zdravkovic; +Cc: gregkh, devel, linux-kernel

On Wed, Oct 24, 2018 at 05:05:53PM +0200, Aleksa Zdravkovic wrote:
> This patch fixes the checkpatch.pl warning:
> 
> WARNING: line over 80 characters
> +			 (write_timeout >= 0) ? msecs_to_jiffies(write_timeout) :
> 
> Signed-off-by: Aleksa Zdravkovic <alex.zdravkovic98@gmail.com>
> ---
>  drivers/staging/axis-fifo/axis-fifo.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
> index c18bf31f55b6..2f609712f507 100644
> --- a/drivers/staging/axis-fifo/axis-fifo.c
> +++ b/drivers/staging/axis-fifo/axis-fifo.c
> @@ -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.

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

regards,
dan carpenter


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

* Re: [PATCH] staging: axis-fifo: Fix line over 80 characters error
  2018-10-25  6:05 ` Dan Carpenter
@ 2018-10-25  6:18   ` Joe Perches
  2018-10-25 14:44     ` Aleksa Zdravkovic
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2018-10-25  6:18 UTC (permalink / raw)
  To: Dan Carpenter, Aleksa Zdravkovic; +Cc: gregkh, devel, linux-kernel

On Thu, 2018-10-25 at 09:05 +0300, Dan Carpenter wrote:
> On Wed, Oct 24, 2018 at 05:05:53PM +0200, Aleksa Zdravkovic wrote:
> > This patch fixes the checkpatch.pl warning:
[]
> > diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
[]
> > @@ -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.
> 
> 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.



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

* Re: [PATCH] staging: axis-fifo: Fix line over 80 characters error
  2018-10-25  6:18   ` Joe Perches
@ 2018-10-25 14:44     ` Aleksa Zdravkovic
  0 siblings, 0 replies; 4+ messages in thread
From: Aleksa Zdravkovic @ 2018-10-25 14:44 UTC (permalink / raw)
  To: Joe Perches, Dan Carpenter; +Cc: gregkh, devel, linux-kernel

On Wed, Oct 24, 2018 at 11:18:17PM -0700, Joe Perches wrote:
> On Thu, 2018-10-25 at 09:05 +0300, Dan Carpenter wrote:
> > On Wed, Oct 24, 2018 at 05:05:53PM +0200, Aleksa Zdravkovic wrote:
> > > This patch fixes the checkpatch.pl warning:
> []
> > > diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
> []
> > > @@ -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.
> > 
> > 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.
> 
> 

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.



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

end of thread, other threads:[~2018-10-25 14:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-24 15:05 [PATCH] staging: axis-fifo: Fix line over 80 characters error Aleksa Zdravkovic
2018-10-25  6:05 ` Dan Carpenter
2018-10-25  6:18   ` Joe Perches
2018-10-25 14:44     ` Aleksa Zdravkovic

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