Improve code, codestyle in xgifb.
v2 cover Improve code, codestyle in xgifb.
[Changes in v2]
In version v2, I remove a patch from the original patchset as it was not valid.
[original cover letter]
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 (4):
Staging: xgifb: Remove blank line before } and after {
Staging: xgifb: Remove extra blank lines.
Staging: xgifb: Fix comparison to NULL warning
Staging: xgifb: Remove space after cast
drivers/staging/xgifb/vb_init.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/4 Staging: xgifb: Remove blank line before } and after {
Remove blank line after { and before }.
Problem found using checkpatch.
---
Changes in v2:
-Include one more deletion of a blank line.
drivers/staging/xgifb/vb_init.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/staging/xgifb/vb_init.c +0 -6
@@ -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 ,1200 ); - } static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
@@ -597,7 +596,6 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,if ((HwDeviceExtension->ulVideoMemorySize -1 ) >0x1000000 ) { - pVBInfo->ram_bus =32 ;/* 32 bits */ /* 22bit + 2 rank + 32bit */ xgifb_reg_set (pVBInfo->P3c4,0x13 ,0xB1 );
@@ -1059,7 +1057,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 +1131,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 +1325,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
PATCH v2 2/4 Staging: xgifb: Remove extra blank lines.
In reply to Navya Sri NizamkariThis patch fixes the checkpatch.pl check:
CHECK: Please don't use multiple blank lines
---
Changes in v2:
-None in this patch
drivers/staging/xgifb/vb_init.c | 1 - 1 file changed, 1 deletion(-)
drivers/staging/xgifb/vb_init.c +0 -1
@@ -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
PATCH v2 3/4 Staging: xgifb: Fix comparison to NULL warning
In reply to Navya Sri NizamkariChange comparison to NULL to a ! operation.
Found using checkpatch.
---
Changes in v2:
-Include one other NULL to ! operation conversion.
drivers/staging/xgifb/vb_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/xgifb/vb_init.c +4 -4
@@ -850,11 +850,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 );
@@ -876,7 +876,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; }
@@ -1186,7 +1186,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
PATCH v2 4/4 Staging: xgifb: Remove space after cast
In reply to Navya Sri NizamkariThis patch fixes the checkpatch check:
CHECK: No space is necessary after a cast
---
Changes in v2:
-Remove space between one more cast.
drivers/staging/xgifb/vb_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/xgifb/vb_init.c +3 -3
@@ -814,7 +814,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 )
@@ -835,13 +835,13 @@ 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); data =xgifb_reg_get (pVBInfo->P3c4,0x21 );/* enable read cache */ -xgifb_reg_set (pVBInfo->P3c4,0x21 , (unsigned short ) (data |0x20 )); +xgifb_reg_set (pVBInfo->P3c4,0x21 , (unsigned short )(data |0x20 )); }static u8 *xgifb_copy_rom (struct pci_dev *dev,size_t *rom_size)
Signature · 1 line
1.9.1