[PATCH 1/2] Coding style changes to align with linux

From: anish kumar
Date: Wed May 11 2011 - 13:42:53 EST


Signed-off-by: anish<anish198519851985@xxxxxxxxx>
---
drivers/staging/sm7xx/smtcfb.c | 43 +++++++++++++++++++--------------------
drivers/staging/sm7xx/smtcfb.h | 7 +-----
2 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c
index 3e2230f..d220f1f 100644
--- a/drivers/staging/sm7xx/smtcfb.c
+++ b/drivers/staging/sm7xx/smtcfb.c
@@ -39,10 +39,10 @@
#include <linux/pm.h>
#endif

-struct screen_info smtc_screen_info;
-
#include "smtcfb.h"

+struct screen_info smtc_screen_info;
+
#ifdef DEBUG
#define smdbg(format, arg...) printk(KERN_DEBUG format , ## arg)
#else
@@ -99,17 +99,17 @@ struct vesa_mode_table {
static struct vesa_mode_table vesa_mode[] = {
{"0x301", 640, 480, 8},
{"0x303", 800, 600, 8},
- {"0x305", 1024, 768, 8},
+ {"0x305", 1024, 768, 8},
{"0x307", 1280, 1024, 8},

{"0x311", 640, 480, 16},
{"0x314", 800, 600, 16},
- {"0x317", 1024, 768, 16},
+ {"0x317", 1024, 768, 16},
{"0x31A", 1280, 1024, 16},

{"0x312", 640, 480, 24},
{"0x315", 800, 600, 24},
- {"0x318", 1024, 768, 24},
+ {"0x318", 1024, 768, 24},
{"0x31B", 1280, 1024, 24},
};

@@ -125,7 +125,7 @@ u16 smtc_ChipIDs[] = {
0x720
};

-#define numSMTCchipIDs (sizeof(smtc_ChipIDs) / sizeof(u16))
+#define numSMTCchipIDs ARRAY_SIZE(smtc_ChipIDs)

static void sm712_set_timing(struct smtcfb_info *sfb,
struct par_info *ppar_info)
@@ -684,7 +684,7 @@ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *dev,
{
struct smtcfb_info *sfb;

- sfb = kzalloc(sizeof(struct smtcfb_info), GFP_KERNEL);
+ sfb = kzalloc(sizeof(*sfb), GFP_KERNEL);

if (!sfb)
return NULL;
@@ -812,7 +812,7 @@ static int __init __maybe_unused sm712vga_setup(char *options)
smdbg("\nsm712vga_setup = %s\n", options);

for (index = 0;
- index < (sizeof(vesa_mode) / sizeof(struct vesa_mode_table));
+ index < ARRAY_SIZE(vesa_mode);
index++) {
if (strstr(options, vesa_mode[index].mode_index)) {
smtc_screen_info.lfb_width = vesa_mode[index].lfb_width;
@@ -840,13 +840,12 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
int err;
unsigned long pFramebufferPhysical;

- printk(KERN_INFO
+ dev_info(&pdev->dev,
"Silicon Motion display driver " SMTC_LINUX_FB_VERSION "\n");

err = pci_enable_device(pdev); /* enable SMTC chip */
if (err)
- return err;
- err = -ENOMEM;
+ goto out;

hw.chipID = ent->device;
sprintf(name, "sm%Xfb", hw.chipID);
@@ -903,13 +902,13 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
if (sfb->fb.var.bits_per_pixel == 32) {
smtc_VRAMBaseAddress += 0x800000;
hw.m_pLFB += 0x800000;
- printk(KERN_INFO
+ dev_info(&pdev->dev,
"\nsmtc_VRAMBaseAddress=%p hw.m_pLFB=%p\n",
smtc_VRAMBaseAddress, hw.m_pLFB);
}
#endif
if (!smtc_RegBaseAddress) {
- printk(KERN_INFO
+ dev_info(&pdev->dev,
"%s: unable to map memory mapped IO\n",
sfb->fb.fix.id);
err = -ENOMEM;
@@ -944,7 +943,7 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
smtc_seqw(0x6b, 0x02);
break;
default:
- printk(KERN_INFO
+ dev_info(&pdev->dev,
"No valid Silicon Motion display chip was detected!\n");

goto failed_fb;
@@ -969,15 +968,14 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
if (err < 0)
goto failed;

- printk(KERN_INFO "Silicon Motion SM%X Rev%X primary display mode"
- "%dx%d-%d Init Complete.\n", hw.chipID, hw.chipRevID,
- sfb->fb.var.xres, sfb->fb.var.yres,
- sfb->fb.var.bits_per_pixel);
+ dev_info(&pdev->dev, "Silicon Motion SM%X Rev%X primary display mode"
+ "%dx%d-%d Init Complete.\n", hw.chipID, hw.chipRevID,
+ sfb->fb.var.xres, sfb->fb.var.yres, sfb->fb.var.bits_per_pixel);

return 0;

- failed:
- printk(KERN_INFO "Silicon Motion, Inc. primary display init fail\n");
+failed:
+ dev_info(&pdev->dev, "Silicon Motion,Inc. primary display init fail\n");

smtc_unmap_smem(sfb);
smtc_unmap_mmio(sfb);
@@ -986,7 +984,8 @@ failed_fb:

failed_free:
pci_disable_device(pdev);
-
+out:
+ dev_err(&pdev->dev, "pci_enable_device failed\n");
return err;
}

@@ -1139,6 +1138,6 @@ static void __exit smtcfb_exit(void)
module_init(smtcfb_init);
module_exit(smtcfb_exit);

-MODULE_AUTHOR("Siliconmotion ");
+MODULE_AUTHOR("Siliconmotion");
MODULE_DESCRIPTION("Framebuffer driver for SMI Graphic Cards");
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/sm7xx/smtcfb.h b/drivers/staging/sm7xx/smtcfb.h
index 0c11383..c5e6989 100644
--- a/drivers/staging/sm7xx/smtcfb.h
+++ b/drivers/staging/sm7xx/smtcfb.h
@@ -30,11 +30,6 @@
#define SCREEN_Y_RES 600
#define SCREEN_BPP 16

-#ifndef FIELD_OFFSET
-#define FIELD_OFSFET(type, field) \
- ((unsigned long) (PUCHAR) & (((type *)0)->field))
-#endif
-
/*Assume SM712 graphics chip has 4MB VRAM */
#define SM712_VIDEOMEMORYSIZE 0x00400000
/*Assume SM722 graphics chip has 8MB VRAM */
@@ -790,4 +785,4 @@ struct ModeInit VGAMode[] = {
},
};

-#define numVGAModes (sizeof(VGAMode) / sizeof(struct ModeInit))
+#define numVGAModes ARRAY_SIZE(VGAMode)
--
1.7.0.4


--=-K77a9MDhsXjqzzpozMuM--

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/