All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: xgifb: Replace udelay function with usleep_range
@ 2015-10-21 15:38 Navya Sri Nizamkari
  2015-10-21 16:07 ` [Outreachy kernel] " Greg KH
  2015-10-21 19:22 ` Amitoj Kaur Chawla
  0 siblings, 2 replies; 5+ messages in thread
From: Navya Sri Nizamkari @ 2015-10-21 15:38 UTC (permalink / raw)
  To: outreachy-kernel

This patch fixes the checkpatch.pl check:

CHECK: usleep_range is preferred over udelay

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
 drivers/staging/xgifb/vb_init.c | 78 ++++++++++++++++++++---------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 2b233af..ea358a0 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -10,7 +10,7 @@ static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = {
 	{ 16, 0x45},
 	{  8, 0x35},
 	{  4, 0x31},
-	{  2, 0x21} };
+	{  2, 0x21} };e
 
 static const unsigned short XGINew_DDRDRAM_TYPE20[12][2] = {
 	{ 128, 0x5D},
@@ -51,7 +51,7 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension,
 	} else if (HwDeviceExtension->jChipType == XG21) {
 		/* Independent GPIO control */
 		xgifb_reg_and(pVBInfo->P3d4, 0xB4, ~0x02);
-		udelay(800);
+		usleep_range(800);
 		xgifb_reg_or(pVBInfo->P3d4, 0x4A, 0x80); /* Enable GPIOH read */
 		/* GPIOF 0:DVI 1:DVO */
 		data = xgifb_reg_get(pVBInfo->P3d4, 0x48);
@@ -86,14 +86,14 @@ static void XGINew_DDR1x_MRS_340(unsigned long P3c4,
 	xgifb_reg_set(P3c4, 0x16, 0x00);
 	xgifb_reg_set(P3c4, 0x16, 0x80);
 
-	udelay(60);
+	usleep_range(60);
 	xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */
 	xgifb_reg_set(P3c4, 0x19, 0x01);
 	xgifb_reg_set(P3c4, 0x16, 0x03);
 	xgifb_reg_set(P3c4, 0x16, 0x83);
 	mdelay(1);
 	xgifb_reg_set(P3c4, 0x1B, 0x03);
-	udelay(500);
+	usleep_range(500);
 	xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */
 	xgifb_reg_set(P3c4, 0x19, 0x00);
 	xgifb_reg_set(P3c4, 0x16, 0x03);
@@ -136,65 +136,65 @@ static void XGINew_DDRII_Bootup_XG27(
 	/* Set Double Frequency */
 	xgifb_reg_set(P3d4, 0x97, pVBInfo->XGINew_CR97); /* CR97 */
 
-	udelay(200);
+	usleep_range(200);
 
 	xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS2 */
 	xgifb_reg_set(P3c4, 0x19, 0x80); /* Set SR19 */
 	xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
-	udelay(15);
+	usleep_range(15);
 	xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
-	udelay(15);
+	usleep_range(15);
 
 	xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS3 */
 	xgifb_reg_set(P3c4, 0x19, 0xC0); /* Set SR19 */
 	xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
-	udelay(15);
+	usleep_range(15);
 	xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
-	udelay(15);
+	usleep_range(15);
 
 	xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS1 */
 	xgifb_reg_set(P3c4, 0x19, 0x40); /* Set SR19 */
 	xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
-	udelay(30);
+	usleep_range(30);
 	xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
-	udelay(15);
+	usleep_range(15);
 
 	xgifb_reg_set(P3c4, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Enable */
 	xgifb_reg_set(P3c4, 0x19, 0x0A); /* Set SR19 */
 	xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */
-	udelay(30);
+	usleep_range(30);
 	xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */
 	xgifb_reg_set(P3c4, 0x16, 0x80); /* Set SR16 */
 
 	xgifb_reg_set(P3c4, 0x1B, 0x04); /* Set SR1B */
-	udelay(60);
+	usleep_range(60);
 	xgifb_reg_set(P3c4, 0x1B, 0x00); /* Set SR1B */
 
 	xgifb_reg_set(P3c4, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Reset */
 	xgifb_reg_set(P3c4, 0x19, 0x08); /* Set SR19 */
 	xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */
 
-	udelay(30);
+	usleep_range(30);
 	xgifb_reg_set(P3c4, 0x16, 0x83); /* Set SR16 */
-	udelay(15);
+	usleep_range(15);
 
 	xgifb_reg_set(P3c4, 0x18, 0x80); /* Set SR18 */ /* MRS, ODT */
 	xgifb_reg_set(P3c4, 0x19, 0x46); /* Set SR19 */
 	xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
-	udelay(30);
+	usleep_range(30);
 	xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
-	udelay(15);
+	usleep_range(15);
 
 	xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS */
 	xgifb_reg_set(P3c4, 0x19, 0x40); /* Set SR19 */
 	xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
-	udelay(30);
+	usleep_range(30);
 	xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
-	udelay(15);
+	usleep_range(15);
 
 	/* Set SR1B refresh control 000:close; 010:open */
 	xgifb_reg_set(P3c4, 0x1B, 0x04);
-	udelay(200);
+	usleep_range(200);
 
 }
 
@@ -208,7 +208,7 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
 
 	xgifb_reg_set(P3d4, 0x97, 0x11); /* CR97 */
 
-	udelay(200);
+	usleep_range(200);
 	xgifb_reg_set(P3c4, 0x18, 0x00); /* EMRS2 */
 	xgifb_reg_set(P3c4, 0x19, 0x80);
 	xgifb_reg_set(P3c4, 0x16, 0x05);
@@ -229,18 +229,18 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
 	xgifb_reg_set(P3c4, 0x16, 0x05);
 	xgifb_reg_set(P3c4, 0x16, 0x85);
 
-	udelay(15);
+	usleep_range(15);
 	xgifb_reg_set(P3c4, 0x1B, 0x04); /* SR1B */
-	udelay(30);
+	usleep_range(30);
 	xgifb_reg_set(P3c4, 0x1B, 0x00); /* SR1B */
-	udelay(100);
+	usleep_range(100);
 
 	xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */
 	xgifb_reg_set(P3c4, 0x19, 0x00);
 	xgifb_reg_set(P3c4, 0x16, 0x05);
 	xgifb_reg_set(P3c4, 0x16, 0x85);
 
-	udelay(200);
+	usleep_range(200);
 }
 
 static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4,
@@ -250,20 +250,20 @@ static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4,
 	xgifb_reg_set(P3c4, 0x19, 0x40);
 	xgifb_reg_set(P3c4, 0x16, 0x00);
 	xgifb_reg_set(P3c4, 0x16, 0x80);
-	udelay(60);
+	usleep_range(60);
 
 	xgifb_reg_set(P3c4, 0x18, 0x00);
 	xgifb_reg_set(P3c4, 0x19, 0x40);
 	xgifb_reg_set(P3c4, 0x16, 0x00);
 	xgifb_reg_set(P3c4, 0x16, 0x80);
-	udelay(60);
+	usleep_range(60);
 	xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */
 	xgifb_reg_set(P3c4, 0x19, 0x01);
 	xgifb_reg_set(P3c4, 0x16, 0x03);
 	xgifb_reg_set(P3c4, 0x16, 0x83);
 	mdelay(1);
 	xgifb_reg_set(P3c4, 0x1B, 0x03);
-	udelay(500);
+	usleep_range(500);
 	xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */
 	xgifb_reg_set(P3c4, 0x19, 0x00);
 	xgifb_reg_set(P3c4, 0x16, 0x03);
@@ -533,7 +533,7 @@ static unsigned short XGINew_SetDRAMSize20Reg(
 			      0x14,
 			      (xgifb_reg_get(pVBInfo->P3c4, 0x14) & 0x0F) |
 				(data & 0xF0));
-		udelay(15);
+		usleep_range(15);
 	}
 	return memsize;
 }
@@ -552,7 +552,7 @@ static int XGINew_ReadWriteRest(unsigned short StopAddr,
 		writel(Position, fbaddr + Position);
 	}
 
-	udelay(500); /* Fix #1759 Memory Size error in Multi-Adapter. */
+	usleep_range(500); /* Fix #1759 Memory Size error in Multi-Adapter. */
 
 	Position = 0;
 
@@ -602,7 +602,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
 				/* 22bit + 2 rank + 32bit */
 				xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1);
 				xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x52);
-				udelay(15);
+				usleep_range(15);
 
 				if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
 					return;
@@ -616,7 +616,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
 					xgifb_reg_set(pVBInfo->P3c4,
 						      0x14,
 						      0x42);
-					udelay(15);
+					usleep_range(15);
 
 					if (XGINew_ReadWriteRest(23,
 								 23,
@@ -631,14 +631,14 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
 				/* 22bit + 2 rank + 16bit */
 				xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1);
 				xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x41);
-				udelay(15);
+				usleep_range(15);
 
 				if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1)
 					return;
 				xgifb_reg_set(pVBInfo->P3c4,
 					      0x13,
 					      0x31);
-				udelay(15);
+				usleep_range(15);
 			}
 
 		} else { /* Dual_16_8 */
@@ -649,7 +649,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
 				xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1);
 				/* 0x41:16Mx16 bit*/
 				xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x41);
-				udelay(15);
+				usleep_range(15);
 
 				if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1)
 					return;
@@ -664,7 +664,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
 					xgifb_reg_set(pVBInfo->P3c4,
 						      0x14,
 						      0x31);
-					udelay(15);
+					usleep_range(15);
 
 					if (XGINew_ReadWriteRest(22,
 								 22,
@@ -680,7 +680,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
 				xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1);
 				/* 0x30:8Mx8 bit*/
 				xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x30);
-				udelay(15);
+				usleep_range(15);
 
 				if (XGINew_ReadWriteRest(22, 21, pVBInfo) == 1)
 					return;
@@ -689,7 +689,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
 				xgifb_reg_set(pVBInfo->P3c4,
 					      0x13,
 					      0x31);
-				udelay(15);
+				usleep_range(15);
 			}
 		}
 		break;
@@ -808,7 +808,7 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension,
 	for (i = 0; i < size; i++) {
 		/* SetDRAMSizingType */
 		xgifb_reg_and_or(pVBInfo->P3c4, 0x13, 0x80, dram_table[i][1]);
-		udelay(15); /* should delay 50 ns */
+		usleep_range(15); /* should delay 50 ns */
 
 		memsize = XGINew_SetDRAMSize20Reg(dram_table[i][0], pVBInfo);
 
-- 
1.9.1



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

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: Replace udelay function with usleep_range
  2015-10-21 15:38 [PATCH] Staging: xgifb: Replace udelay function with usleep_range Navya Sri Nizamkari
@ 2015-10-21 16:07 ` Greg KH
  2015-10-21 17:00   ` Navya Sri Nizamkari
  2015-10-21 17:00   ` Navya Sri Nizamkari
  2015-10-21 19:22 ` Amitoj Kaur Chawla
  1 sibling, 2 replies; 5+ messages in thread
From: Greg KH @ 2015-10-21 16:07 UTC (permalink / raw)
  To: Navya Sri Nizamkari; +Cc: outreachy-kernel

On Wed, Oct 21, 2015 at 09:08:00PM +0530, Navya Sri Nizamkari wrote:
> This patch fixes the checkpatch.pl check:
> 
> CHECK: usleep_range is preferred over udelay
> 
> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
> ---
>  drivers/staging/xgifb/vb_init.c | 78 ++++++++++++++++++++---------------------
>  1 file changed, 39 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
> index 2b233af..ea358a0 100644
> --- a/drivers/staging/xgifb/vb_init.c
> +++ b/drivers/staging/xgifb/vb_init.c
> @@ -10,7 +10,7 @@ static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = {
>  	{ 16, 0x45},
>  	{  8, 0x35},
>  	{  4, 0x31},
> -	{  2, 0x21} };
> +	{  2, 0x21} };e

I don't think you build this patch :(



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

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: Replace udelay function with usleep_range
  2015-10-21 16:07 ` [Outreachy kernel] " Greg KH
@ 2015-10-21 17:00   ` Navya Sri Nizamkari
  2015-10-21 17:00   ` Navya Sri Nizamkari
  1 sibling, 0 replies; 5+ messages in thread
From: Navya Sri Nizamkari @ 2015-10-21 17:00 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: navyasri.tech


[-- Attachment #1.1: Type: text/plain, Size: 1073 bytes --]



On Wednesday, October 21, 2015 at 9:37:55 PM UTC+5:30, gregkh wrote:
>
> On Wed, Oct 21, 2015 at 09:08:00PM +0530, Navya Sri Nizamkari wrote: 
> > This patch fixes the checkpatch.pl check: 
> > 
> > CHECK: usleep_range is preferred over udelay 
> > 
> > Signed-off-by: Navya Sri Nizamkari <navyas...@gmail.com <javascript:>> 
> > --- 
> >  drivers/staging/xgifb/vb_init.c | 78 
> ++++++++++++++++++++--------------------- 
> >  1 file changed, 39 insertions(+), 39 deletions(-) 
> > 
> > diff --git a/drivers/staging/xgifb/vb_init.c 
> b/drivers/staging/xgifb/vb_init.c 
> > index 2b233af..ea358a0 100644 
> > --- a/drivers/staging/xgifb/vb_init.c 
> > +++ b/drivers/staging/xgifb/vb_init.c 
> > @@ -10,7 +10,7 @@ static const unsigned short 
> XGINew_DDRDRAM_TYPE340[4][2] = { 
> >          { 16, 0x45}, 
> >          {  8, 0x35}, 
> >          {  4, 0x31}, 
> > -        {  2, 0x21} }; 
> > +        {  2, 0x21} };e 
>
> I don't think you build this patch :( 
>

I'm sorry about that. I'll update and send in a new version of the patch 
which doesn't break the build. 

[-- Attachment #1.2: Type: text/html, Size: 1563 bytes --]

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

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: Replace udelay function with usleep_range
  2015-10-21 16:07 ` [Outreachy kernel] " Greg KH
  2015-10-21 17:00   ` Navya Sri Nizamkari
@ 2015-10-21 17:00   ` Navya Sri Nizamkari
  1 sibling, 0 replies; 5+ messages in thread
From: Navya Sri Nizamkari @ 2015-10-21 17:00 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: navyasri.tech


[-- Attachment #1.1: Type: text/plain, Size: 1073 bytes --]



On Wednesday, October 21, 2015 at 9:37:55 PM UTC+5:30, gregkh wrote:
>
> On Wed, Oct 21, 2015 at 09:08:00PM +0530, Navya Sri Nizamkari wrote: 
> > This patch fixes the checkpatch.pl check: 
> > 
> > CHECK: usleep_range is preferred over udelay 
> > 
> > Signed-off-by: Navya Sri Nizamkari <navyas...@gmail.com <javascript:>> 
> > --- 
> >  drivers/staging/xgifb/vb_init.c | 78 
> ++++++++++++++++++++--------------------- 
> >  1 file changed, 39 insertions(+), 39 deletions(-) 
> > 
> > diff --git a/drivers/staging/xgifb/vb_init.c 
> b/drivers/staging/xgifb/vb_init.c 
> > index 2b233af..ea358a0 100644 
> > --- a/drivers/staging/xgifb/vb_init.c 
> > +++ b/drivers/staging/xgifb/vb_init.c 
> > @@ -10,7 +10,7 @@ static const unsigned short 
> XGINew_DDRDRAM_TYPE340[4][2] = { 
> >          { 16, 0x45}, 
> >          {  8, 0x35}, 
> >          {  4, 0x31}, 
> > -        {  2, 0x21} }; 
> > +        {  2, 0x21} };e 
>
> I don't think you build this patch :( 
>

I'm sorry about that. I'll update and send in a new version of the patch 
which doesn't break the build. 

[-- Attachment #1.2: Type: text/html, Size: 1563 bytes --]

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

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: Replace udelay function with usleep_range
  2015-10-21 15:38 [PATCH] Staging: xgifb: Replace udelay function with usleep_range Navya Sri Nizamkari
  2015-10-21 16:07 ` [Outreachy kernel] " Greg KH
@ 2015-10-21 19:22 ` Amitoj Kaur Chawla
  1 sibling, 0 replies; 5+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-21 19:22 UTC (permalink / raw)
  To: Navya Sri Nizamkari; +Cc: outreachy-kernel

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

On Wed, Oct 21, 2015 at 9:08 PM, Navya Sri Nizamkari <
navyasri.tech@gmail.com> wrote:

>  static const unsigned short XGINew_DDRDRAM_TYPE20[12][2] = {
>         { 128, 0x5D},
> @@ -51,7 +51,7 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info
*HwDeviceExtension,
>         } else if (HwDeviceExtension->jChipType == XG21) {
>                 /* Independent GPIO control */
>                 xgifb_reg_and(pVBInfo->P3d4, 0xB4, ~0x02);
> -               udelay(800);
> +               usleep_range(800);

Hi Navya,

usleep_range() as the name suggests, has to have 2 arguments: you can see
this
<https://www.kernel.org/doc/htmldocs/device-drivers/API-usleep-range.html> for
reference.


-- 
Amitoj

[-- Attachment #2: Type: text/html, Size: 911 bytes --]

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

end of thread, other threads:[~2015-10-21 19:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21 15:38 [PATCH] Staging: xgifb: Replace udelay function with usleep_range Navya Sri Nizamkari
2015-10-21 16:07 ` [Outreachy kernel] " Greg KH
2015-10-21 17:00   ` Navya Sri Nizamkari
2015-10-21 17:00   ` Navya Sri Nizamkari
2015-10-21 19:22 ` Amitoj Kaur Chawla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.