linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: fbtft: fb_watterott: fix usleep_range is preferred over udelay
@ 2020-11-01  0:20 Hassan Shahbazi
  2020-11-01  6:39 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Hassan Shahbazi @ 2020-11-01  0:20 UTC (permalink / raw)
  To: linus.walleij
  Cc: dri-devel, linux-fbdev, devel, linux-kernel, Hassan Shahbazi

Fix the checkpath.pl issue on fb_watterott.c. write_vmem and
write_vmem_8bit functions are within non-atomic context and can
safely use usleep_range.
see Documentation/timers/timers-howto.txt

Signed-off-by: Hassan Shahbazi <hassan@ninchat.com>
---
 drivers/staging/fbtft/fb_watterott.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
index 76b25df376b8..afcc86a17995 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -84,7 +84,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
 			par->txbuf.buf, 10 + par->info->fix.line_length);
 		if (ret < 0)
 			return ret;
-		udelay(300);
+		usleep_range(300, 310);
 	}
 
 	return 0;
@@ -124,7 +124,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
 			par->txbuf.buf, 10 + par->info->var.xres);
 		if (ret < 0)
 			return ret;
-		udelay(700);
+		usleep_range(700, 710);
 	}
 
 	return 0;
-- 
2.25.1


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

* Re: [PATCH] staging: fbtft: fb_watterott: fix usleep_range is preferred over udelay
  2020-11-01  0:20 [PATCH] staging: fbtft: fb_watterott: fix usleep_range is preferred over udelay Hassan Shahbazi
@ 2020-11-01  6:39 ` Greg KH
  2020-11-01 10:32   ` Hassan Shahbazi
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2020-11-01  6:39 UTC (permalink / raw)
  To: Hassan Shahbazi
  Cc: linus.walleij, devel, Hassan Shahbazi, linux-fbdev, linux-kernel,
	dri-devel

On Sun, Nov 01, 2020 at 02:20:10AM +0200, Hassan Shahbazi wrote:
> Fix the checkpath.pl issue on fb_watterott.c. write_vmem and
> write_vmem_8bit functions are within non-atomic context and can
> safely use usleep_range.
> see Documentation/timers/timers-howto.txt
> 
> Signed-off-by: Hassan Shahbazi <hassan@ninchat.com>
> ---
>  drivers/staging/fbtft/fb_watterott.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
> index 76b25df376b8..afcc86a17995 100644
> --- a/drivers/staging/fbtft/fb_watterott.c
> +++ b/drivers/staging/fbtft/fb_watterott.c
> @@ -84,7 +84,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
>  			par->txbuf.buf, 10 + par->info->fix.line_length);
>  		if (ret < 0)
>  			return ret;
> -		udelay(300);
> +		usleep_range(300, 310);
>  	}
>  
>  	return 0;
> @@ -124,7 +124,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
>  			par->txbuf.buf, 10 + par->info->var.xres);
>  		if (ret < 0)
>  			return ret;
> -		udelay(700);
> +		usleep_range(700, 710);

How do you know that these ranges are ok?  Are you able to test these
changes with real hardware?

thanks,

greg k-h

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

* Re: [PATCH] staging: fbtft: fb_watterott: fix usleep_range is preferred over udelay
  2020-11-01  6:39 ` Greg KH
@ 2020-11-01 10:32   ` Hassan Shahbazi
  2020-11-06 10:01     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Hassan Shahbazi @ 2020-11-01 10:32 UTC (permalink / raw)
  To: Greg KH; +Cc: dri-devel, linux-fbdev, devel, linux-kernel

On Sun, Nov 01, 2020 at 07:39:48AM +0100, Greg KH wrote:
> On Sun, Nov 01, 2020 at 02:20:10AM +0200, Hassan Shahbazi wrote:
> > Fix the checkpath.pl issue on fb_watterott.c. write_vmem and
> > write_vmem_8bit functions are within non-atomic context and can
> > safely use usleep_range.
> > see Documentation/timers/timers-howto.txt
> > 
> > Signed-off-by: Hassan Shahbazi <hassan@ninchat.com>
> > ---
> >  drivers/staging/fbtft/fb_watterott.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
> > index 76b25df376b8..afcc86a17995 100644
> > --- a/drivers/staging/fbtft/fb_watterott.c
> > +++ b/drivers/staging/fbtft/fb_watterott.c
> > @@ -84,7 +84,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
> >  			par->txbuf.buf, 10 + par->info->fix.line_length);
> >  		if (ret < 0)
> >  			return ret;
> > -		udelay(300);
> > +		usleep_range(300, 310);
> >  	}
> >  
> >  	return 0;
> > @@ -124,7 +124,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
> >  			par->txbuf.buf, 10 + par->info->var.xres);
> >  		if (ret < 0)
> >  			return ret;
> > -		udelay(700);
> > +		usleep_range(700, 710);
> 
> How do you know that these ranges are ok?  Are you able to test these
> changes with real hardware?
> 
> thanks,
> 
> greg k-h

No, I don't have the hardware to test with. I just used the current
value as the minimum and added an epsilon to it for the maximum
param.

best, hassan shahbazi

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

* Re: [PATCH] staging: fbtft: fb_watterott: fix usleep_range is preferred over udelay
  2020-11-01 10:32   ` Hassan Shahbazi
@ 2020-11-06 10:01     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-11-06 10:01 UTC (permalink / raw)
  To: Hassan Shahbazi; +Cc: dri-devel, linux-fbdev, devel, linux-kernel

On Sun, Nov 01, 2020 at 12:32:44PM +0200, Hassan Shahbazi wrote:
> On Sun, Nov 01, 2020 at 07:39:48AM +0100, Greg KH wrote:
> > On Sun, Nov 01, 2020 at 02:20:10AM +0200, Hassan Shahbazi wrote:
> > > Fix the checkpath.pl issue on fb_watterott.c. write_vmem and
> > > write_vmem_8bit functions are within non-atomic context and can
> > > safely use usleep_range.
> > > see Documentation/timers/timers-howto.txt
> > > 
> > > Signed-off-by: Hassan Shahbazi <hassan@ninchat.com>
> > > ---
> > >  drivers/staging/fbtft/fb_watterott.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
> > > index 76b25df376b8..afcc86a17995 100644
> > > --- a/drivers/staging/fbtft/fb_watterott.c
> > > +++ b/drivers/staging/fbtft/fb_watterott.c
> > > @@ -84,7 +84,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
> > >  			par->txbuf.buf, 10 + par->info->fix.line_length);
> > >  		if (ret < 0)
> > >  			return ret;
> > > -		udelay(300);
> > > +		usleep_range(300, 310);
> > >  	}
> > >  
> > >  	return 0;
> > > @@ -124,7 +124,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
> > >  			par->txbuf.buf, 10 + par->info->var.xres);
> > >  		if (ret < 0)
> > >  			return ret;
> > > -		udelay(700);
> > > +		usleep_range(700, 710);
> > 
> > How do you know that these ranges are ok?  Are you able to test these
> > changes with real hardware?
> > 
> > thanks,
> > 
> > greg k-h
> 
> No, I don't have the hardware to test with. I just used the current
> value as the minimum and added an epsilon to it for the maximum
> param.

It's best not to guess about this, sorry, you should have the hardware
to test this type of change.

thanks,

greg k-h

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

end of thread, other threads:[~2020-11-06 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-01  0:20 [PATCH] staging: fbtft: fb_watterott: fix usleep_range is preferred over udelay Hassan Shahbazi
2020-11-01  6:39 ` Greg KH
2020-11-01 10:32   ` Hassan Shahbazi
2020-11-06 10:01     ` Greg KH

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