Skip to contentSkip to conversation

Improve code, codestyle in xgifb.

PATCH Superseded Navya Sri Nizamkari 3 participants 10 messages Oct 21, 2015 – Oct 22, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Improve code, codestyle in xgifb.

This patchset clears checkpatch warnings in vb_init such as:
space required after that ';', remove blank lines after {, remove blank lines before }, remove multiple balnk lines, comparison with NULL, space required after that ';'.

Navya Sri Nizamkari (5):
Staging: xgifb: Add space between ; and variable name
Staging: xgifb: Remove blank line before } and after {
Staging: xgifb: Remove extra blnk lines.
Staging: xgifb: Fix comparison to NULL warning
Staging: xgifb: Remove space after cast

 drivers/staging/xgifb/vb_init.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/5 Staging: xgifb: Add space between ; and variable name

This patch fixes the checkpatch.pl error:

ERROR: space required after that ';'

---
 drivers/staging/xgifb/vb_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/xgifb/vb_init.c +1 -1
index ea358a0..6204a98 100644
@@ -10,7 +10,7 @@ static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = {
 	{ 16, 0x45},
 	{  8, 0x35},
 	{  4, 0x31},
-	{  2, 0x21} };e
+	{  2, 0x21} }; e
 
 static const unsigned short XGINew_DDRDRAM_TYPE20[12][2] = {
 	{ 128, 0x5D},
Signature · 1 line
1.9.1
#6 lore raw

PATCH 2/5 Staging: xgifb: Remove blank line before } and after {

In reply to Navya Sri Nizamkari

Remove blank line after { and before }.
Problem found using checkpatch.

---
 drivers/staging/xgifb/vb_init.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/staging/xgifb/vb_init.c +0 -5
index 6204a98..2eee3ac 100644
@@ -195,7 +195,6 @@ static void XGINew_DDRII_Bootup_XG27(
 	/* Set SR1B refresh control 000:close; 010:open */
 	xgifb_reg_set(P3c4, 0x1B, 0x04);
 	usleep_range(200);
-
 }
 
 static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
@@ -1059,7 +1058,6 @@ static void XGINew_SetModeScratch(struct vb_device_info *pVBInfo)
 	CR38Data &= ~SetYPbPr;
 	CR38Data |= tempch;
 	xgifb_reg_set(pVBInfo->P3d4, 0x38, CR38Data);
-
 }
 
 static unsigned short XGINew_SenseLCD(struct xgi_hw_device_info
@@ -1134,7 +1132,6 @@ static void XGINew_GetXG27Sense(struct vb_device_info *pVBInfo)
 		xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xA0);
 	}
 	xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense);
-
 }
 
 static unsigned char GetXG21FPBits(struct vb_device_info *pVBInfo)
@@ -1329,14 +1326,12 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	XGI_SenseCRT1(pVBInfo);
 
 	if (HwDeviceExtension->jChipType == XG21) {
-
 		xgifb_reg_and_or(pVBInfo->P3d4,
 				 0x32,
 				 ~Monitor1Sense,
 				 Monitor1Sense); /* Z9 default has CRT */
 		temp = GetXG21FPBits(pVBInfo);
 		xgifb_reg_and_or(pVBInfo->P3d4, 0x37, ~0x01, temp);
-
 	}
 	if (HwDeviceExtension->jChipType == XG27) {
 		xgifb_reg_and_or(pVBInfo->P3d4,
Signature · 1 line
1.9.1
#7 lore raw

PATCH 3/5 Staging: xgifb: Remove extra blank lines.

In reply to Navya Sri Nizamkari

This patch fixes the checkpatch.pl check:

CHECK: Please don't use multiple blank lines

---
 drivers/staging/xgifb/vb_init.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/xgifb/vb_init.c +0 -1
index 2eee3ac..1aa8600 100644
@@ -498,7 +498,6 @@ static void XGINew_SetDRAMDefaultRegister340(
 	xgifb_reg_set(P3c4, 0x1B, 0x03); /* SR1B */
 }
 
-
 static unsigned short XGINew_SetDRAMSize20Reg(
 		unsigned short dram_size,
 		struct vb_device_info *pVBInfo)
Signature · 1 line
1.9.1
#8 lore raw

PATCH 4/5 Staging: xgifb: Fix comparison to NULL warning

In reply to Navya Sri Nizamkari

Change comparison to NULL to a ! operation.
Found using checkpatch.

---
 drivers/staging/xgifb/vb_init.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/xgifb/vb_init.c +4 -4
index 1aa8600..0615f1c 100644
@@ -851,11 +851,11 @@ static u8 *xgifb_copy_rom(struct pci_dev *dev, size_t *rom_size)
 	u8 *rom_copy;
 
 	rom_address = pci_map_rom(dev, rom_size);
-	if (rom_address == NULL)
+	if (!rom_address)
 		return NULL;
 
 	rom_copy = vzalloc(XGIFB_ROM_SIZE);
-	if (rom_copy == NULL)
+	if (!rom_copy)
 		goto done;
 
 	*rom_size = min_t(size_t, *rom_size, XGIFB_ROM_SIZE);
@@ -877,7 +877,7 @@ static bool xgifb_read_vbios(struct pci_dev *pdev)
 	int entry;
 
 	vbios = xgifb_copy_rom(pdev, &vbios_size);
-	if (vbios == NULL) {
+	if (!vbios) {
 		dev_err(&pdev->dev, "Video BIOS not available\n");
 		return false;
 	}
@@ -1187,7 +1187,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
 
-	if (pVBInfo->FBAddr == NULL) {
+	if (!pVBInfo->FBAddr) {
 		dev_dbg(&pdev->dev, "pVBInfo->FBAddr == 0\n");
 		return 0;
 	}
Signature · 1 line
1.9.1
#9 lore raw

PATCH 5/5 Staging: xgifb: Remove space after cast

In reply to Navya Sri Nizamkari

This patch fixes the checkpatch check:

CHECK: No space is necessary after a cast

---
 drivers/staging/xgifb/vb_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/xgifb/vb_init.c +2 -2
index 0615f1c..cef24b3 100644
@@ -815,7 +815,7 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension,
 
 		memsize += (pVBInfo->ram_channel - 2) + 20;
 		if ((HwDeviceExtension->ulVideoMemorySize - 1) <
-			(unsigned long) (1 << memsize))
+			(unsigned long)(1 << memsize))
 			continue;
 
 		if (XGINew_ReadWriteRest(memsize, start_addr, pVBInfo) == 1)
@@ -836,7 +836,7 @@ static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info,
 
 	data = xgifb_reg_get(pVBInfo->P3c4, 0x21);
 	/* disable read cache */
-	xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF));
+	xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short)(data & 0xDF));
 	XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo);
 
 	XGINew_DDRSizing340(HwDeviceExtension, pVBInfo);
Signature · 1 line
1.9.1
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/5] Staging: xgifb: Add space between ; and variable name

In reply to Navya Sri Nizamkari
Quoted 14 lines · Navya Sri Nizamkari

This patch fixes the checkpatch.pl error:

ERROR: space required after that ';'

---
 drivers/staging/xgifb/vb_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/xgifb/vb_init.c +0 -0
index ea358a0..6204a98 100644

drivers/staging/xgifb/vb_init.c static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = { · line 13

Quoted 5 lines
drivers/staging/xgifb/vb_init.c +1 -1
@@ -10,7 +10,7 @@ static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = {
        { 16, 0x45},
        {  8, 0x35},
        {  4, 0x31},
-       {  2, 0x21} };e
+       {  2, 0x21} }; e

Hmm, something went wrong here :)

Please edit the file and remove 'e' after ';'. Otherwise, your code wouldn't even compile.

thanks,
Daniel.

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/5] Staging: xgifb: Add space between ; and variable name

Quoted 24 lines · Daniel Baluta
Quoted 14 lines · Navya Sri Nizamkari

This patch fixes the checkpatch.pl error:

ERROR: space required after that ';'

---
 drivers/staging/xgifb/vb_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/xgifb/vb_init.c +0 -0
index ea358a0..6204a98 100644

drivers/staging/xgifb/vb_init.c static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = { · line 13

Quoted 5 lines
drivers/staging/xgifb/vb_init.c +1 -1
@@ -10,7 +10,7 @@ static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = {
        { 16, 0x45},
        {  8, 0x35},
        {  4, 0x31},
-       {  2, 0x21} };e
+       {  2, 0x21} }; e

Hmm, something went wrong here :)

Quoted 2 lines

Please edit the file and remove 'e' after ';'. Otherwise, your code wouldn't even compile.

Also, this seems to be a patch on top of your previous patch, whereas your corrected patches should be on top of the current state of Greg's tree.

julia

Quoted 11 lines

thanks,
Daniel.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAEnQRZBqVWVHtc_pRUemU-6qZMmbD90TzuGsWe-5Xuh63mXG2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#5 lore raw

Re: [Outreachy kernel] [PATCH 1/5] Staging: xgifb: Add space between ; and variable name

In reply to Daniel Baluta
Quoted 25 lines · Daniel Baluta

Review

Quoted 10 lines · On Wed, Oct 21, 2015 at 7:48 PM, Navya Sri Nizamkari <[email protected]…

This patch fixes the checkpatch.pl error:

ERROR: space required after that ';'

Signed-off-by Navya Sri Nizamkari <[email protected] <javascript:>>

---

 drivers/staging/xgifb/vb_init.c | 2 +- 
 1 file changed, 1 insertion(+), 1 deletion(-) 
(quoted diff) +0 -0

b/drivers/staging/xgifb/vb_init.c

drivers/staging/xgifb/vb_init.c static const unsigned short

Quoted 4 lines

index ea358a0..6204a98 100644

drivers/staging/xgifb/vb_init.c +0 -0
@@ -10,7 +10,7 @@ static const unsigned short 

XGINew_DDRDRAM_TYPE340[4][2] = {

drivers/staging/xgifb/vb_init.c static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = { · line 13

Quoted 5 lines
drivers/staging/xgifb/vb_init.c +1 -1
        { 16, 0x45}, 
        {  8, 0x35}, 
        {  4, 0x31}, 
-       {  2, 0x21} };e 
+       {  2, 0x21} }; e 
Quoted 8 lines

Hmm, something went wrong here :)

Please edit the file and remove 'e' after ';'. Otherwise, your code wouldn't even compile.

thanks,
Daniel.

This 'e' seems the typo introduced by me. Sorry. Thanks for the correction.

#4 lore raw

Re: [Outreachy kernel] [PATCH 1/5] Staging: xgifb: Add space between ; and variable name

In reply to Julia Lawall
Quoted 30 lines · Julia Lawall
Quoted 6 lines · Daniel Baluta
Quoted 4 lines · On Wed, Oct 21, 2015 at 7:48 PM, Navya Sri Nizamkari <[email protected]…

This patch fixes the checkpatch.pl error:

ERROR: space required after that ';'

Quoted 7 lines

Review

Quoted 7 lines
Signed-off-by Navya Sri Nizamkari <[email protected] <javascript:>>

---

 drivers/staging/xgifb/vb_init.c | 2 +- 
 1 file changed, 1 insertion(+), 1 deletion(-) 
(quoted diff) +0 -0

b/drivers/staging/xgifb/vb_init.c

Quoted 4 lines

drivers/staging/xgifb/vb_init.c static const unsigned short

Quoted 4 lines

index ea358a0..6204a98 100644

drivers/staging/xgifb/vb_init.c +0 -0
@@ -10,7 +10,7 @@ static const unsigned short 

XGINew_DDRDRAM_TYPE340[4][2] = {

Quoted 8 lines

drivers/staging/xgifb/vb_init.c static const unsigned short XGINew_DDRDRAM_TYPE340[4][2] = { · line 13

Quoted 5 lines
drivers/staging/xgifb/vb_init.c +1 -1
        { 16, 0x45}, 
        {  8, 0x35}, 
        {  4, 0x31}, 
-       {  2, 0x21} };e 
+       {  2, 0x21} }; e 

Hmm, something went wrong here :)

Quoted 9 lines
Quoted 2 lines

Please edit the file and remove 'e' after ';'. Otherwise, your code wouldn't even compile.

Also, this seems to be a patch on top of your previous patch, whereas your corrected patches should be on top of the current state of Greg's tree.

julia

I introduced the 'e' as a typo. I'll revert and send the patchset without this patch. Thanks.

Quoted 17 lines
Quoted 6 lines

thanks,
Daniel.

Signature · 1 line
You received this message because you are subscribed to the Google 

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected] <javascript:>.

Quoted 1 line

To post to this group, send email to [email protected]

<javascript:>.

Quoted 1 line

To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/CAEnQRZBqVWVHtc_pRUemU-6qZMmbD90TzuGsWe-5Xuh63mXG2A%40mail.gmail.com.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.