* [PATCH v2 0/9] staging: sm750: Fix most style errors
@ 2015-03-12 19:58 Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 1/9] staging: sm750: Place space before after control flow instructions Ioana Ciornei
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
This patchset cleans up multiple style errors found using checkpatch.pl
in order to improve readability and code quality.
Changes in v2:
- Make message commits include all the relevant information
- Fix typos
- Change commit subjects
- Change patch 9/9 to add space around '?' and ':' too
Ioana Ciornei (9):
staging: sm750: Place space before after control flow instructions
staging: sm750: Add space before open bracket '{'
staging: sm750: Place space before and after curly brackets
staging: sm750: Remove space before semicolon
staging: sm750: Place open bracket '{' on the next line
staging: sm750: Move open curly bracket on previous line
staging: sm750: Remove unnecessary spaces around ')'
staging: sm750: Place * next to identifier
staging: sm750: Add space before and after '=', ':' etc
drivers/staging/sm750fb/sm750.c | 260 +++++++++++++++++++---------------------
1 file changed, 124 insertions(+), 136 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/9] staging: sm750: Place space before after control flow instructions
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
2015-03-15 10:38 ` [Outreachy kernel] " Greg KH
2015-03-12 19:58 ` [PATCH v2 2/9] staging: sm750: Add space before open bracket '{' Ioana Ciornei
` (7 subsequent siblings)
8 siblings, 1 reply; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Place space between control flow instructions such as: if, switch,
while etc and '(' in order to improve readability.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 180 ++++++++++++++++++++--------------------
1 file changed, 90 insertions(+), 90 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 010b849..46c3aeb 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -64,7 +64,7 @@ static inline void myspin_lock(spinlock_t *sl){
struct lynx_share *share;
share = container_of(sl, struct lynx_share, slock);
- if(share->dual)
+ if (share->dual)
spin_lock(sl);
}
@@ -72,7 +72,7 @@ static inline void myspin_unlock(spinlock_t *sl){
struct lynx_share *share;
share = container_of(sl, struct lynx_share, slock);
- if(share->dual)
+ if (share->dual)
spin_unlock(sl);
}
static const struct fb_videomode lynx750_ext[] = {
@@ -142,22 +142,22 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor)
crtc = &par->crtc;
cursor = &crtc->cursor;
- if(fbcursor->image.width > cursor->maxW ||
+ if (fbcursor->image.width > cursor->maxW ||
fbcursor->image.height > cursor->maxH ||
fbcursor->image.depth > 1){
return -ENXIO;
}
cursor->disable(cursor);
- if(fbcursor->set & FB_CUR_SETSIZE)
+ if (fbcursor->set & FB_CUR_SETSIZE)
cursor->setSize(cursor, fbcursor->image.width, fbcursor->image.height);
- if(fbcursor->set & FB_CUR_SETPOS){
+ if (fbcursor->set & FB_CUR_SETPOS){
cursor->setPos(cursor, fbcursor->image.dx - info->var.xoffset,
fbcursor->image.dy - info->var.yoffset);
}
- if(fbcursor->set & FB_CUR_SETCMAP){
+ if (fbcursor->set & FB_CUR_SETCMAP){
/* get the 16bit color of kernel means */
u16 fg, bg;
@@ -173,7 +173,7 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor)
}
- if(fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE))
+ if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE))
{
cursor->setData(cursor,
fbcursor->rop,
@@ -181,7 +181,7 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor)
fbcursor->mask);
}
- if(fbcursor->enable)
+ if (fbcursor->enable)
cursor->enable(cursor);
return 0;
@@ -194,7 +194,7 @@ static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect*
unsigned int base, pitch, Bpp, rop;
u32 color;
- if(info->state != FBINFO_STATE_RUNNING)
+ if (info->state != FBINFO_STATE_RUNNING)
return;
par = info->par;
@@ -256,8 +256,8 @@ static void lynxfb_ops_imageblit(struct fb_info *info, const struct fb_image *im
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
- if(image->depth == 1){
- if(info->fix.visual == FB_VISUAL_TRUECOLOR ||
+ if (image->depth == 1){
+ if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
info->fix.visual == FB_VISUAL_DIRECTCOLOR)
{
fgcol = ((u32*)info->pseudo_palette)[image->fg_color];
@@ -290,7 +290,7 @@ static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var,
int ret;
- if(!info)
+ if (!info)
return -EINVAL;
ret = 0;
@@ -312,7 +312,7 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg)
int ret;
- if(mesg.event == pdev->dev.power.power_state.event)
+ if (mesg.event == pdev->dev.power.power_state.event)
return 0;
ret = 0;
@@ -327,26 +327,26 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg)
console_lock();
if (mesg.event & PM_EVENT_SLEEP) {
info = share->fbinfo[0];
- if(info)
+ if (info)
fb_set_suspend(info, 1);/* 1 means do suspend*/
info = share->fbinfo[1];
- if(info)
+ if (info)
fb_set_suspend(info, 1);/* 1 means do suspend*/
ret = pci_save_state(pdev);
- if(ret){
+ if (ret){
pr_err("error:%d occured in pci_save_state\n", ret);
return ret;
}
/* set chip to sleep mode */
- if(share->suspend)
+ if (share->suspend)
(*share->suspend)(share);
pci_disable_device(pdev);
ret = pci_set_power_state(pdev, pci_choose_state(pdev, mesg));
- if(ret){
+ if (ret){
pr_err("error:%d occured in pci_set_power_state\n", ret);
return ret;
}
@@ -369,7 +369,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
unsigned int line_length;
- if(!info)
+ if (!info)
return -EINVAL;
ret = 0;
@@ -390,7 +390,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
* and these data should be set before setcolreg routine
* */
- switch(var->bits_per_pixel){
+ switch (var->bits_per_pixel){
case 8:
fix->visual = FB_VISUAL_PSEUDOCOLOR;
var->red.offset = 0;
@@ -430,12 +430,12 @@ static int lynxfb_ops_set_par(struct fb_info *info)
var->height = var->width = -1;
var->accel_flags = 0;/*FB_ACCELF_TEXT;*/
- if(ret){
+ if (ret){
pr_err("pixel bpp format not satisfied\n.");
return ret;
}
ret = crtc->proc_setMode(crtc, var, fix);
- if(!ret)
+ if (!ret)
ret = output->proc_setMode(output, var, fix);
return ret;
}
@@ -464,13 +464,13 @@ static int lynxfb_resume(struct pci_dev *pdev)
console_lock();
- if((ret = pci_set_power_state(pdev, PCI_D0)) != 0){
+ if ((ret = pci_set_power_state(pdev, PCI_D0)) != 0){
pr_err("error:%d occured in pci_set_power_state\n", ret);
return ret;
}
- if(pdev->dev.power.power_state.event != PM_EVENT_FREEZE){
+ if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE){
pci_restore_state(pdev);
if ((ret = pci_enable_device(pdev)) != 0){
pr_err("error:%d occured in pci_enable_device\n", ret);
@@ -478,7 +478,7 @@ static int lynxfb_resume(struct pci_dev *pdev)
}
pci_set_master(pdev);
}
- if(share->resume)
+ if (share->resume)
(*share->resume)(share);
hw_sm750_inithw(share, pdev);
@@ -486,7 +486,7 @@ static int lynxfb_resume(struct pci_dev *pdev)
info = share->fbinfo[0];
- if(info){
+ if (info){
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
@@ -498,7 +498,7 @@ static int lynxfb_resume(struct pci_dev *pdev)
info = share->fbinfo[1];
- if(info){
+ if (info){
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
@@ -599,7 +599,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
var->bits_per_pixel);
- switch(var->bits_per_pixel){
+ switch (var->bits_per_pixel){
case 8:
case 16:
case 24: /* support 24 bpp for only lynx712/722/720 */
@@ -611,7 +611,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
goto exit;
}
- switch(var->bits_per_pixel){
+ switch (var->bits_per_pixel){
case 8:
info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
var->red.offset = 0;
@@ -657,13 +657,13 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
request = PADDING(crtc->line_pad, request);
request = request * var->yres_virtual;
- if(crtc->vidmem_size < request){
+ if (crtc->vidmem_size < request){
pr_err("not enough video memory for mode\n");
return -ENOMEM;
}
ret = output->proc_checkMode(output, var);
- if(!ret)
+ if (!ret)
ret = crtc->proc_checkMode(crtc, var);
exit:
return ret;
@@ -685,15 +685,15 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red,
ret = 0;
//pr_debug("regno=%d, red=%d, green=%d, blue=%d\n", regno, red, green, blue);
- if(regno > 256){
+ if (regno > 256){
pr_err("regno = %d\n", regno);
return -EINVAL;
}
- if(info->var.grayscale)
+ if (info->var.grayscale)
red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
- if(var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR)
+ if (var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR)
{
red >>= 8;
green >>= 8;
@@ -703,11 +703,11 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red,
}
- if(info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 )
+ if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 )
{
u32 val;
- if(var->bits_per_pixel == 16 ||
+ if (var->bits_per_pixel == 16 ||
var->bits_per_pixel == 32 ||
var->bits_per_pixel == 24)
{
@@ -788,7 +788,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->vScreen = share->pvMem;
break;
case sm750_dual_normal:
- if(par->index == 0){
+ if (par->index == 0){
output->paths = sm750_panel;
crtc->channel = sm750_primary;
crtc->oScreen = 0;
@@ -802,7 +802,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
}
break;
case sm750_dual_swap:
- if(par->index == 0){
+ if (par->index == 0){
output->paths = sm750_panel;
crtc->channel = sm750_secondary;
crtc->oScreen = 0;
@@ -900,14 +900,14 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
crtc->cursor.share = share;
memset(crtc->cursor.vstart, 0, crtc->cursor.size);
- if(!g_hwcursor) {
+ if (!g_hwcursor) {
lynxfb_ops.fb_cursor = NULL;
crtc->cursor.disable(&crtc->cursor);
}
/* set info->fbops, must be set before fb_find_mode */
- if(!share->accel_off){
+ if (!share->accel_off){
/* use 2d acceleration */
lynxfb_ops.fb_fillrect = lynxfb_ops_fillrect;
lynxfb_ops.fb_copyarea = lynxfb_ops_copyarea;
@@ -915,32 +915,32 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
}
info->fbops = &lynxfb_ops;
- if(!g_fbmode[index]) {
+ if (!g_fbmode[index]) {
g_fbmode[index] = g_def_fbmode;
- if(index)
+ if (index)
g_fbmode[index] = g_fbmode[0];
}
- for(i=0;i<3;i++){
+ for (i=0;i<3;i++){
ret = fb_find_mode(var, info, g_fbmode[index],
pdb[i], cdb[i], NULL, 8);
- if(ret == 1){
+ if (ret == 1){
pr_info("success! use specified mode:%s in %s\n",
g_fbmode[index],
mdb_desc[i]);
break;
- }else if(ret == 2){
+ }else if (ret == 2){
pr_warn("use specified mode:%s in %s, with an ignored refresh rate\n",
g_fbmode[index],
mdb_desc[i]);
break;
- }else if(ret == 3){
+ }else if (ret == 3){
pr_warn("wanna use default mode\n");
// break;
- }else if(ret == 4){
+ }else if (ret == 4){
pr_warn("fall back to any valid mode\n");
}else{
pr_warn("ret = %d, fb_find_mode failed, with %s\n", ret, mdb_desc[i]);
@@ -1000,7 +1000,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
pr_info("fix->mmio_start = %lx\n", fix->mmio_start);
fix->mmio_len = share->vidreg_size;
pr_info("fix->mmio_len = %x\n", fix->mmio_len);
- switch(var->bits_per_pixel) {
+ switch (var->bits_per_pixel) {
case 8:
fix->visual = FB_VISUAL_PSEUDOCOLOR;
break;
@@ -1020,7 +1020,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
info->cmap.red, info->cmap.green, info->cmap.blue,
info->cmap.transp);
- if((ret = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) {
+ if ((ret = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) {
pr_err("Could not allcate memory for cmap.\n");
goto exit;
}
@@ -1064,40 +1064,40 @@ static void sm750fb_setup(struct lynx_share *share, char *src)
/*defaultly turn g_hwcursor on for both view */
g_hwcursor = 3;
- if(!src || !*src){
+ if (!src || !*src){
pr_warn("no specific g_option.\n");
goto NO_PARAM;
}
- while((opt = strsep(&src, ":")) != NULL && *opt != NULL) {
+ while ((opt = strsep(&src, ":")) != NULL && *opt != NULL) {
pr_err("opt=%s\n", opt);
pr_err("src=%s\n", src);
- if(!strncmp(opt, "swap", strlen("swap")))
+ if (!strncmp(opt, "swap", strlen("swap")))
swap = 1;
- else if(!strncmp(opt, "nocrt", strlen("nocrt")))
+ else if (!strncmp(opt, "nocrt", strlen("nocrt")))
spec_share->state.nocrt = 1;
- else if(!strncmp(opt, "36bit", strlen("36bit")))
+ else if (!strncmp(opt, "36bit", strlen("36bit")))
spec_share->state.pnltype = sm750_doubleTFT;
- else if(!strncmp(opt, "18bit", strlen("18bit")))
+ else if (!strncmp(opt, "18bit", strlen("18bit")))
spec_share->state.pnltype = sm750_dualTFT;
- else if(!strncmp(opt, "24bit", strlen("24bit")))
+ else if (!strncmp(opt, "24bit", strlen("24bit")))
spec_share->state.pnltype = sm750_24TFT;
#ifdef CAP_EXPANSION
- else if(!strncmp(opt, "exp:", strlen("exp:")))
+ else if (!strncmp(opt, "exp:", strlen("exp:")))
exp_res = opt + strlen("exp:");
#endif
- else if(!strncmp(opt, "nohwc0", strlen("nohwc0")))
+ else if (!strncmp(opt, "nohwc0", strlen("nohwc0")))
g_hwcursor &= ~0x1;
- else if(!strncmp(opt, "nohwc1", strlen("nohwc1")))
+ else if (!strncmp(opt, "nohwc1", strlen("nohwc1")))
g_hwcursor &= ~0x2;
- else if(!strncmp(opt, "nohwc", strlen("nohwc")))
+ else if (!strncmp(opt, "nohwc", strlen("nohwc")))
g_hwcursor = 0;
else {
- if(!g_fbmode[0]){
+ if (!g_fbmode[0]){
g_fbmode[0] = opt;
pr_info("find fbmode0 : %s\n", g_fbmode[0]);
- }else if(!g_fbmode[1]){
+ }else if (!g_fbmode[1]){
g_fbmode[1] = opt;
pr_info("find fbmode1 : %s\n", g_fbmode[1]);
}else{
@@ -1106,21 +1106,21 @@ static void sm750fb_setup(struct lynx_share *share, char *src)
}
}
#ifdef CAP_EXPANSION
- if(getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) {
+ if (getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) {
/* seems exp_res is not valid*/
spec_share->state.xLCD = spec_share->state.yLCD = 0;
}
#endif
NO_PARAM:
- if(share->revid != SM750LE_REVISION_ID){
- if(share->dual) {
- if(swap)
+ if (share->revid != SM750LE_REVISION_ID){
+ if (share->dual) {
+ if (swap)
spec_share->state.dataflow = sm750_dual_swap;
else
spec_share->state.dataflow = sm750_dual_normal;
} else {
- if(swap)
+ if (swap)
spec_share->state.dataflow = sm750_simul_sec;
else
spec_share->state.dataflow = sm750_simul_pri;
@@ -1145,7 +1145,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
/* enable device */
- if(pci_enable_device(pdev)){
+ if (pci_enable_device(pdev)){
pr_err("can not enable device.\n");
goto err_enable;
}
@@ -1155,7 +1155,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
spec_offset = offsetof(struct sm750_share, share);
spec_share = kzalloc(sizeof(*spec_share), GFP_KERNEL);
- if(!spec_share){
+ if (!spec_share){
pr_err("Could not allocate memory for share.\n");
goto err_share;
}
@@ -1177,7 +1177,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
share->dual = g_dualview;
spin_lock_init(&share->slock);
- if(!share->accel_off){
+ if (!share->accel_off){
/* hook deInit and 2d routines, notes that below hw_xxx
* routine can work on most of lynx chips
* if some chip need specific function, please hook it in smXXX_set_drv
@@ -1195,19 +1195,19 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
sm750fb_setup(share, g_settings);
/* call chip specific mmap routine */
- if(hw_sm750_map(share, pdev)){
+ if (hw_sm750_map(share, pdev)){
pr_err("Memory map failed\n");
goto err_map;
}
#ifdef CONFIG_MTRR
- if(!share->mtrr_off){
+ if (!share->mtrr_off){
pr_info("enable mtrr\n");
share->mtrr.vram = mtrr_add(share->vidmem_start,
share->vidmem_size,
MTRR_TYPE_WRCOMB, 1);
- if(share->mtrr.vram < 0){
+ if (share->mtrr.vram < 0){
/* don't block driver with the failure of MTRR */
pr_err("Unable to setup MTRR.\n");
}else{
@@ -1230,10 +1230,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
fbidx = 0;
ALLOC_FB:
info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev);
- if(!info[fbidx])
+ if (!info[fbidx])
{
pr_err("Could not allocate framebuffer #%d.\n", fbidx);
- if(fbidx == 0)
+ if (fbidx == 0)
goto err_info0_alloc;
else
goto err_info1_alloc;
@@ -1248,9 +1248,9 @@ ALLOC_FB:
par->share = share;
/* set fb_info structure */
- if(lynxfb_set_fbinfo(info[fbidx], fbidx)){
+ if (lynxfb_set_fbinfo(info[fbidx], fbidx)){
pr_err("Failed to initial fb_info #%d.\n", fbidx);
- if(fbidx == 0)
+ if (fbidx == 0)
goto err_info0_set;
else
goto err_info1_set;
@@ -1262,7 +1262,7 @@ ALLOC_FB:
if (errno < 0) {
pr_err("Failed to register fb_info #%d. err %d\n", fbidx, errno);
- if(fbidx == 0)
+ if (fbidx == 0)
goto err_register0;
else
goto err_register1;
@@ -1272,7 +1272,7 @@ ALLOC_FB:
/* no dual view by far */
fbidx++;
- if(share->dual && fbidx < 2)
+ if (share->dual && fbidx < 2)
goto ALLOC_FB;
return 0;
@@ -1304,9 +1304,9 @@ static void __exit lynxfb_pci_remove(struct pci_dev *pdev)
cnt = 2;
share = pci_get_drvdata(pdev);
- while(cnt-- > 0){
+ while (cnt-- > 0){
info = share->fbinfo[cnt];
- if(!info)
+ if (!info)
continue;
par = info->par;
@@ -1318,7 +1318,7 @@ static void __exit lynxfb_pci_remove(struct pci_dev *pdev)
framebuffer_release(info);
}
#ifdef CONFIG_MTRR
- if(share->mtrr.vram_added)
+ if (share->mtrr.vram_added)
mtrr_del(share->mtrr.vram, share->vidmem_start, share->vidmem_size);
#endif
// pci_release_regions(pdev);
@@ -1337,7 +1337,7 @@ static int __init lynxfb_setup(char *options)
char *opt, *tmp;
- if(!options || !*options){
+ if (!options || !*options){
pr_warn("no options.\n");
return 0;
}
@@ -1346,7 +1346,7 @@ static int __init lynxfb_setup(char *options)
len = strlen(options) + 1;
g_settings = kmalloc(len, GFP_KERNEL);
- if(!g_settings)
+ if (!g_settings)
return -ENOMEM;
memset(g_settings, 0, len);
@@ -1360,22 +1360,22 @@ static int __init lynxfb_setup(char *options)
strsep() updates @options to pointer after the first found token
it also returns the pointer ahead the token.
*/
- while((opt = strsep(&options, ":"))!=NULL)
+ while ((opt = strsep(&options, ":"))!=NULL)
{
/* options that mean for any lynx chips are configured here */
- if(!strncmp(opt, "noaccel", strlen("noaccel")))
+ if (!strncmp(opt, "noaccel", strlen("noaccel")))
g_noaccel = 1;
#ifdef CONFIG_MTRR
- else if(!strncmp(opt, "nomtrr", strlen("nomtrr")))
+ else if (!strncmp(opt, "nomtrr", strlen("nomtrr")))
g_nomtrr = 1;
#endif
- else if(!strncmp(opt, "dual", strlen("dual")))
+ else if (!strncmp(opt, "dual", strlen("dual")))
g_dualview = 1;
else
{
strcat(tmp, opt);
tmp += strlen(opt);
- if(options != NULL)
+ if (options != NULL)
*tmp++ = ':';
else
*tmp++ = 0;
@@ -1414,7 +1414,7 @@ static int __init lynxfb_init(void)
#ifdef MODULE
option = g_option;
#else
- if(fb_get_options("sm750fb", &option))
+ if (fb_get_options("sm750fb", &option))
return -ENODEV;
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/9] staging: sm750: Add space before open bracket '{'
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 1/9] staging: sm750: Place space before after control flow instructions Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 3/9] staging: sm750: Place space before and after curly brackets Ioana Ciornei
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Add space before curly open bracket '{', to follow Linux coding style.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 80 ++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 40 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 46c3aeb..67c3751 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -60,7 +60,7 @@ static char *g_option = NULL;
/* if not use spin_lock, system will die if user load driver
* and immediatly unload driver frequently (dual)*/
-static inline void myspin_lock(spinlock_t *sl){
+static inline void myspin_lock(spinlock_t *sl) {
struct lynx_share *share;
share = container_of(sl, struct lynx_share, slock);
@@ -68,7 +68,7 @@ static inline void myspin_lock(spinlock_t *sl){
spin_lock(sl);
}
-static inline void myspin_unlock(spinlock_t *sl){
+static inline void myspin_unlock(spinlock_t *sl) {
struct lynx_share *share;
share = container_of(sl, struct lynx_share, slock);
@@ -144,7 +144,7 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor)
if (fbcursor->image.width > cursor->maxW ||
fbcursor->image.height > cursor->maxH ||
- fbcursor->image.depth > 1){
+ fbcursor->image.depth > 1) {
return -ENXIO;
}
@@ -152,12 +152,12 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor)
if (fbcursor->set & FB_CUR_SETSIZE)
cursor->setSize(cursor, fbcursor->image.width, fbcursor->image.height);
- if (fbcursor->set & FB_CUR_SETPOS){
+ if (fbcursor->set & FB_CUR_SETPOS) {
cursor->setPos(cursor, fbcursor->image.dx - info->var.xoffset,
fbcursor->image.dy - info->var.yoffset);
}
- if (fbcursor->set & FB_CUR_SETCMAP){
+ if (fbcursor->set & FB_CUR_SETCMAP) {
/* get the 16bit color of kernel means */
u16 fg, bg;
@@ -256,7 +256,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info, const struct fb_image *im
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
- if (image->depth == 1){
+ if (image->depth == 1) {
if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
info->fix.visual == FB_VISUAL_DIRECTCOLOR)
{
@@ -335,7 +335,7 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg)
fb_set_suspend(info, 1);/* 1 means do suspend*/
ret = pci_save_state(pdev);
- if (ret){
+ if (ret) {
pr_err("error:%d occured in pci_save_state\n", ret);
return ret;
}
@@ -346,7 +346,7 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg)
pci_disable_device(pdev);
ret = pci_set_power_state(pdev, pci_choose_state(pdev, mesg));
- if (ret){
+ if (ret) {
pr_err("error:%d occured in pci_set_power_state\n", ret);
return ret;
}
@@ -390,7 +390,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
* and these data should be set before setcolreg routine
* */
- switch (var->bits_per_pixel){
+ switch (var->bits_per_pixel) {
case 8:
fix->visual = FB_VISUAL_PSEUDOCOLOR;
var->red.offset = 0;
@@ -430,7 +430,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
var->height = var->width = -1;
var->accel_flags = 0;/*FB_ACCELF_TEXT;*/
- if (ret){
+ if (ret) {
pr_err("pixel bpp format not satisfied\n.");
return ret;
}
@@ -464,15 +464,15 @@ static int lynxfb_resume(struct pci_dev *pdev)
console_lock();
- if ((ret = pci_set_power_state(pdev, PCI_D0)) != 0){
+ if ((ret = pci_set_power_state(pdev, PCI_D0)) != 0) {
pr_err("error:%d occured in pci_set_power_state\n", ret);
return ret;
}
- if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE){
+ if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) {
pci_restore_state(pdev);
- if ((ret = pci_enable_device(pdev)) != 0){
+ if ((ret = pci_enable_device(pdev)) != 0) {
pr_err("error:%d occured in pci_enable_device\n", ret);
return ret;
}
@@ -486,7 +486,7 @@ static int lynxfb_resume(struct pci_dev *pdev)
info = share->fbinfo[0];
- if (info){
+ if (info) {
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
@@ -498,7 +498,7 @@ static int lynxfb_resume(struct pci_dev *pdev)
info = share->fbinfo[1];
- if (info){
+ if (info) {
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
@@ -599,7 +599,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
var->bits_per_pixel);
- switch (var->bits_per_pixel){
+ switch (var->bits_per_pixel) {
case 8:
case 16:
case 24: /* support 24 bpp for only lynx712/722/720 */
@@ -611,7 +611,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
goto exit;
}
- switch (var->bits_per_pixel){
+ switch (var->bits_per_pixel) {
case 8:
info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
var->red.offset = 0;
@@ -657,7 +657,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
request = PADDING(crtc->line_pad, request);
request = request * var->yres_virtual;
- if (crtc->vidmem_size < request){
+ if (crtc->vidmem_size < request) {
pr_err("not enough video memory for mode\n");
return -ENOMEM;
}
@@ -685,7 +685,7 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red,
ret = 0;
//pr_debug("regno=%d, red=%d, green=%d, blue=%d\n", regno, red, green, blue);
- if (regno > 256){
+ if (regno > 256) {
pr_err("regno = %d\n", regno);
return -EINVAL;
}
@@ -788,7 +788,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->vScreen = share->pvMem;
break;
case sm750_dual_normal:
- if (par->index == 0){
+ if (par->index == 0) {
output->paths = sm750_panel;
crtc->channel = sm750_primary;
crtc->oScreen = 0;
@@ -802,7 +802,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
}
break;
case sm750_dual_swap:
- if (par->index == 0){
+ if (par->index == 0) {
output->paths = sm750_panel;
crtc->channel = sm750_secondary;
crtc->oScreen = 0;
@@ -907,7 +907,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
/* set info->fbops, must be set before fb_find_mode */
- if (!share->accel_off){
+ if (!share->accel_off) {
/* use 2d acceleration */
lynxfb_ops.fb_fillrect = lynxfb_ops_fillrect;
lynxfb_ops.fb_copyarea = lynxfb_ops_copyarea;
@@ -922,25 +922,25 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
}
- for (i=0;i<3;i++){
+ for (i=0;i<3;i++) {
ret = fb_find_mode(var, info, g_fbmode[index],
pdb[i], cdb[i], NULL, 8);
- if (ret == 1){
+ if (ret == 1) {
pr_info("success! use specified mode:%s in %s\n",
g_fbmode[index],
mdb_desc[i]);
break;
- }else if (ret == 2){
+ }else if (ret == 2) {
pr_warn("use specified mode:%s in %s, with an ignored refresh rate\n",
g_fbmode[index],
mdb_desc[i]);
break;
- }else if (ret == 3){
+ }else if (ret == 3) {
pr_warn("wanna use default mode\n");
// break;
- }else if (ret == 4){
+ }else if (ret == 4) {
pr_warn("fall back to any valid mode\n");
}else{
pr_warn("ret = %d, fb_find_mode failed, with %s\n", ret, mdb_desc[i]);
@@ -1064,7 +1064,7 @@ static void sm750fb_setup(struct lynx_share *share, char *src)
/*defaultly turn g_hwcursor on for both view */
g_hwcursor = 3;
- if (!src || !*src){
+ if (!src || !*src) {
pr_warn("no specific g_option.\n");
goto NO_PARAM;
}
@@ -1094,10 +1094,10 @@ static void sm750fb_setup(struct lynx_share *share, char *src)
else if (!strncmp(opt, "nohwc", strlen("nohwc")))
g_hwcursor = 0;
else {
- if (!g_fbmode[0]){
+ if (!g_fbmode[0]) {
g_fbmode[0] = opt;
pr_info("find fbmode0 : %s\n", g_fbmode[0]);
- }else if (!g_fbmode[1]){
+ }else if (!g_fbmode[1]) {
g_fbmode[1] = opt;
pr_info("find fbmode1 : %s\n", g_fbmode[1]);
}else{
@@ -1113,7 +1113,7 @@ static void sm750fb_setup(struct lynx_share *share, char *src)
#endif
NO_PARAM:
- if (share->revid != SM750LE_REVISION_ID){
+ if (share->revid != SM750LE_REVISION_ID) {
if (share->dual) {
if (swap)
spec_share->state.dataflow = sm750_dual_swap;
@@ -1145,7 +1145,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
/* enable device */
- if (pci_enable_device(pdev)){
+ if (pci_enable_device(pdev)) {
pr_err("can not enable device.\n");
goto err_enable;
}
@@ -1155,7 +1155,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
spec_offset = offsetof(struct sm750_share, share);
spec_share = kzalloc(sizeof(*spec_share), GFP_KERNEL);
- if (!spec_share){
+ if (!spec_share) {
pr_err("Could not allocate memory for share.\n");
goto err_share;
}
@@ -1177,7 +1177,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
share->dual = g_dualview;
spin_lock_init(&share->slock);
- if (!share->accel_off){
+ if (!share->accel_off) {
/* hook deInit and 2d routines, notes that below hw_xxx
* routine can work on most of lynx chips
* if some chip need specific function, please hook it in smXXX_set_drv
@@ -1195,19 +1195,19 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
sm750fb_setup(share, g_settings);
/* call chip specific mmap routine */
- if (hw_sm750_map(share, pdev)){
+ if (hw_sm750_map(share, pdev)) {
pr_err("Memory map failed\n");
goto err_map;
}
#ifdef CONFIG_MTRR
- if (!share->mtrr_off){
+ if (!share->mtrr_off) {
pr_info("enable mtrr\n");
share->mtrr.vram = mtrr_add(share->vidmem_start,
share->vidmem_size,
MTRR_TYPE_WRCOMB, 1);
- if (share->mtrr.vram < 0){
+ if (share->mtrr.vram < 0) {
/* don't block driver with the failure of MTRR */
pr_err("Unable to setup MTRR.\n");
}else{
@@ -1248,7 +1248,7 @@ ALLOC_FB:
par->share = share;
/* set fb_info structure */
- if (lynxfb_set_fbinfo(info[fbidx], fbidx)){
+ if (lynxfb_set_fbinfo(info[fbidx], fbidx)) {
pr_err("Failed to initial fb_info #%d.\n", fbidx);
if (fbidx == 0)
goto err_info0_set;
@@ -1304,7 +1304,7 @@ static void __exit lynxfb_pci_remove(struct pci_dev *pdev)
cnt = 2;
share = pci_get_drvdata(pdev);
- while (cnt-- > 0){
+ while (cnt-- > 0) {
info = share->fbinfo[cnt];
if (!info)
continue;
@@ -1337,7 +1337,7 @@ static int __init lynxfb_setup(char *options)
char *opt, *tmp;
- if (!options || !*options){
+ if (!options || !*options) {
pr_warn("no options.\n");
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 3/9] staging: sm750: Place space before and after curly brackets
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 1/9] staging: sm750: Place space before after control flow instructions Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 2/9] staging: sm750: Add space before open bracket '{' Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 4/9] staging: sm750: Remove space before semicolon Ioana Ciornei
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Add space before and after curly brackets when is needed in order to
follow Linux coding style.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 67c3751..2eab4de 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -793,7 +793,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->channel = sm750_primary;
crtc->oScreen = 0;
crtc->vScreen = share->pvMem;
- }else{
+ } else {
output->paths = sm750_crt;
crtc->channel = sm750_secondary;
/* not consider of padding stuffs for oScreen, need fix*/
@@ -807,7 +807,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->channel = sm750_secondary;
crtc->oScreen = 0;
crtc->vScreen = share->pvMem;
- }else{
+ } else {
output->paths = sm750_crt;
crtc->channel = sm750_primary;
/* not consider of padding stuffs for oScreen, need fix*/
@@ -932,17 +932,17 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
g_fbmode[index],
mdb_desc[i]);
break;
- }else if (ret == 2) {
+ } else if (ret == 2) {
pr_warn("use specified mode:%s in %s, with an ignored refresh rate\n",
g_fbmode[index],
mdb_desc[i]);
break;
- }else if (ret == 3) {
+ } else if (ret == 3) {
pr_warn("wanna use default mode\n");
// break;
- }else if (ret == 4) {
+ } else if (ret == 4) {
pr_warn("fall back to any valid mode\n");
- }else{
+ } else {
pr_warn("ret = %d, fb_find_mode failed, with %s\n", ret, mdb_desc[i]);
}
}
@@ -1097,10 +1097,10 @@ static void sm750fb_setup(struct lynx_share *share, char *src)
if (!g_fbmode[0]) {
g_fbmode[0] = opt;
pr_info("find fbmode0 : %s\n", g_fbmode[0]);
- }else if (!g_fbmode[1]) {
+ } else if (!g_fbmode[1]) {
g_fbmode[1] = opt;
pr_info("find fbmode1 : %s\n", g_fbmode[1]);
- }else{
+ } else {
pr_warn("How many view you wann set?\n");
}
}
@@ -1187,7 +1187,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
share->accel.de_copyarea = hw_copyarea;
share->accel.de_imageblit = hw_imageblit;
pr_info("enable 2d acceleration\n");
- }else{
+ } else {
pr_info("disable 2d acceleration\n");
}
@@ -1210,7 +1210,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
if (share->mtrr.vram < 0) {
/* don't block driver with the failure of MTRR */
pr_err("Unable to setup MTRR.\n");
- }else{
+ } else {
share->mtrr.vram_added = 1;
pr_info("MTRR added succesfully\n");
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 4/9] staging: sm750: Remove space before semicolon
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
` (2 preceding siblings ...)
2015-03-12 19:58 ` [PATCH v2 3/9] staging: sm750: Place space before and after curly brackets Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 5/9] staging: sm750: Place open bracket '{' on the next line Ioana Ciornei
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Remove space before semicolon as it is prohibited by the Linux coding style.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
Changes in v2:
- Remove typo from the patch description
drivers/staging/sm750fb/sm750.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 2eab4de..6ac572c 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -419,7 +419,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0 ;
+ var->blue.offset = 0;
var->blue.length = 8;
fix->visual = FB_VISUAL_TRUECOLOR;
break;
@@ -640,7 +640,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0 ;
+ var->blue.offset = 0;
var->blue.length = 8;
info->fix.visual = FB_VISUAL_TRUECOLOR;
break;
@@ -1408,7 +1408,7 @@ static struct pci_driver lynxfb_driver = {
static int __init lynxfb_init(void)
{
- char *option ;
+ char *option;
int ret;
#ifdef MODULE
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 5/9] staging: sm750: Place open bracket '{' on the next line
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
` (3 preceding siblings ...)
2015-03-12 19:58 ` [PATCH v2 4/9] staging: sm750: Remove space before semicolon Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 6/9] staging: sm750: Move open curly bracket on previous line Ioana Ciornei
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Move open curly bracket on next line after the definition of a function, to follow
the Linux coding style. Also, remove the space before semicolon.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
Changes in v2:
- Add to the patch description relevant information
drivers/staging/sm750fb/sm750.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 6ac572c..f6083c4 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -60,7 +60,8 @@ static char *g_option = NULL;
/* if not use spin_lock, system will die if user load driver
* and immediatly unload driver frequently (dual)*/
-static inline void myspin_lock(spinlock_t *sl) {
+static inline void myspin_lock(spinlock_t *sl)
+{
struct lynx_share *share;
share = container_of(sl, struct lynx_share, slock);
@@ -68,7 +69,8 @@ static inline void myspin_lock(spinlock_t *sl) {
spin_lock(sl);
}
-static inline void myspin_unlock(spinlock_t *sl) {
+static inline void myspin_unlock(spinlock_t *sl)
+{
struct lynx_share *share;
share = container_of(sl, struct lynx_share, slock);
@@ -419,7 +421,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0;
+ var->blue.offset = 0 ;
var->blue.length = 8;
fix->visual = FB_VISUAL_TRUECOLOR;
break;
@@ -640,7 +642,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0;
+ var->blue.offset = 0 ;
var->blue.length = 8;
info->fix.visual = FB_VISUAL_TRUECOLOR;
break;
@@ -772,7 +774,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_setBLANK:hw_sm750_setBLANK;
output->clear = hw_sm750_output_clear;
/* chip specific phase */
- share->accel.de_wait = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_deWait: hw_sm750_deWait;
+ share->accel.de_wait = (share->revid == SM750LE_REVIvSION_ID)?hw_sm750le_deWait: hw_sm750_deWait;
switch (spec_share->state.dataflow) {
case sm750_simul_pri:
output->paths = sm750_pnc;
@@ -1408,7 +1410,7 @@ static struct pci_driver lynxfb_driver = {
static int __init lynxfb_init(void)
{
- char *option;
+ char *option ;
int ret;
#ifdef MODULE
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 6/9] staging: sm750: Move open curly bracket on previous line
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
` (4 preceding siblings ...)
2015-03-12 19:58 ` [PATCH v2 5/9] staging: sm750: Place open bracket '{' on the next line Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 7/9] staging: sm750: Remove unnecessary spaces around ')' Ioana Ciornei
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Place curly open bracket surrounding statements blocks on the same line
as the control flow instruction in order to follow with Linux coding style.
Also, remove unnecessary space before semicolon.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
Changes in v2:
- Make patch description include all relevant information
drivers/staging/sm750fb/sm750.c | 48 +++++++++++++++--------------------------
1 file changed, 17 insertions(+), 31 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index f6083c4..8f12370 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -175,8 +175,7 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor)
}
- if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE))
- {
+ if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) {
cursor->setData(cursor,
fbcursor->rop,
fbcursor->image.data,
@@ -260,13 +259,10 @@ static void lynxfb_ops_imageblit(struct fb_info *info, const struct fb_image *im
if (image->depth == 1) {
if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
- info->fix.visual == FB_VISUAL_DIRECTCOLOR)
- {
+ info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
fgcol = ((u32*)info->pseudo_palette)[image->fg_color];
bgcol = ((u32*)info->pseudo_palette)[image->bg_color];
- }
- else
- {
+ } else {
fgcol = image->fg_color;
bgcol = image->bg_color;
}
@@ -421,7 +417,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0 ;
+ var->blue.offset = 0;
var->blue.length = 8;
fix->visual = FB_VISUAL_TRUECOLOR;
break;
@@ -560,8 +556,7 @@ static int lynxfb_ops_mmap(struct fb_info *info, struct vm_area_struct *vma)
printk("lynxfb mmap vm end: %x\n", vma->vm_end);
printk("lynxfb mmap len: %x\n", len);
printk("lynxfb mmap off: %x\n", off);
- if ((vma->vm_end - vma->vm_start + off) > len)
- {
+ if ((vma->vm_end - vma->vm_start + off) > len) {
return -EINVAL;
}
off += start;
@@ -642,7 +637,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var, struct fb_info *i
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0 ;
+ var->blue.offset = 0;
var->blue.length = 8;
info->fix.visual = FB_VISUAL_TRUECOLOR;
break;
@@ -695,8 +690,7 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red,
if (info->var.grayscale)
red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
- if (var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR)
- {
+ if (var->bits_per_pixel == 8 && info->fix.visual == FB_VISUAL_PSEUDOCOLOR) {
red >>= 8;
green >>= 8;
blue >>= 8;
@@ -705,14 +699,12 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red,
}
- if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 )
- {
+ if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 ) {
u32 val;
if (var->bits_per_pixel == 16 ||
var->bits_per_pixel == 32 ||
- var->bits_per_pixel == 24)
- {
+ var->bits_per_pixel == 24) {
val = chan_to_field(red, &var->red);
val |= chan_to_field(green, &var->green);
val |= chan_to_field(blue, &var->blue);
@@ -861,9 +853,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
};
- static const char *fixId[2]=
- {
- "sm750_fb1", "sm750_fb2",
+ static const char *fixId[2] = {
+ "sm750_fb1", "sm750_fb2",
};
int ret, line_length;
@@ -924,7 +915,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
}
- for (i=0;i<3;i++) {
+ for (i = 0; i < 3; i++) {
ret = fb_find_mode(var, info, g_fbmode[index],
pdb[i], cdb[i], NULL, 8);
@@ -1232,16 +1223,13 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
fbidx = 0;
ALLOC_FB:
info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev);
- if (!info[fbidx])
- {
+ if (!info[fbidx]) {
pr_err("Could not allocate framebuffer #%d.\n", fbidx);
if (fbidx == 0)
goto err_info0_alloc;
else
goto err_info1_alloc;
- }
- else
- {
+ } else {
struct lynxfb_par *par;
pr_info("framebuffer #%d alloc okay\n", fbidx);
@@ -1362,8 +1350,7 @@ static int __init lynxfb_setup(char *options)
strsep() updates @options to pointer after the first found token
it also returns the pointer ahead the token.
*/
- while ((opt = strsep(&options, ":"))!=NULL)
- {
+ while ((opt = strsep(&options, ":"))!=NULL) {
/* options that mean for any lynx chips are configured here */
if (!strncmp(opt, "noaccel", strlen("noaccel")))
g_noaccel = 1;
@@ -1373,8 +1360,7 @@ static int __init lynxfb_setup(char *options)
#endif
else if (!strncmp(opt, "dual", strlen("dual")))
g_dualview = 1;
- else
- {
+ else {
strcat(tmp, opt);
tmp += strlen(opt);
if (options != NULL)
@@ -1410,7 +1396,7 @@ static struct pci_driver lynxfb_driver = {
static int __init lynxfb_init(void)
{
- char *option ;
+ char *option;
int ret;
#ifdef MODULE
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 7/9] staging: sm750: Remove unnecessary spaces around ')'
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
` (5 preceding siblings ...)
2015-03-12 19:58 ` [PATCH v2 6/9] staging: sm750: Move open curly bracket on previous line Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 8/9] staging: sm750: Place * next to identifier Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 9/9] staging: sm750: Add space before and after '=', ':' etc Ioana Ciornei
8 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Remove unnecessary space around ')' as it is prohibited by the Linux coding style.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
Changes in v2:
- Change patch description and subject to describe everything properly
drivers/staging/sm750fb/sm750.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 8f12370..f5b4dae 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -208,7 +208,7 @@ static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect*
Bpp = info->var.bits_per_pixel >> 3;
color = (Bpp == 1)?region->color:((u32*)info->pseudo_palette)[region->color];
- rop = ( region->rop != ROP_COPY ) ? HW_ROP2_XOR:HW_ROP2_COPY;
+ rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR:HW_ROP2_COPY;
myspin_lock(&share->slock);
share->accel.de_fillrect(&share->accel,
@@ -699,7 +699,7 @@ static int lynxfb_ops_setcolreg(unsigned regno, unsigned red,
}
- if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256 ) {
+ if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 256) {
u32 val;
if (var->bits_per_pixel == 16 ||
@@ -1154,7 +1154,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
}
/* setting share structure */
- share = (struct lynx_share * )(&(spec_share->share));
+ share = (struct lynx_share *)(&(spec_share->share));
share->fbinfo[0] = share->fbinfo[1] = NULL;
share->devid = pdev->device;
share->revid = pdev->revision;
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 8/9] staging: sm750: Place * next to identifier
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
` (6 preceding siblings ...)
2015-03-12 19:58 ` [PATCH v2 7/9] staging: sm750: Remove unnecessary spaces around ')' Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 9/9] staging: sm750: Add space before and after '=', ':' etc Ioana Ciornei
8 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Place * in pointer type next to the identifier, to follow Linux
coding style.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index f5b4dae..ffc977b 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -134,7 +134,7 @@ static const struct fb_videomode lynx750_ext[] = {
/* no hardware cursor supported under version 2.6.10, kernel bug */
-static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor)
+static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor)
{
struct lynxfb_par *par;
struct lynxfb_crtc *crtc;
@@ -188,7 +188,7 @@ static int lynxfb_ops_cursor(struct fb_info* info, struct fb_cursor* fbcursor)
return 0;
}
-static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect* region)
+static void lynxfb_ops_fillrect(struct fb_info *info, const struct fb_fillrect *region)
{
struct lynxfb_par *par;
struct lynx_share *share;
@@ -207,7 +207,7 @@ static void lynxfb_ops_fillrect(struct fb_info* info, const struct fb_fillrect*
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
- color = (Bpp == 1)?region->color:((u32*)info->pseudo_palette)[region->color];
+ color = (Bpp == 1)?region->color:((u32 *)info->pseudo_palette)[region->color];
rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR:HW_ROP2_COPY;
myspin_lock(&share->slock);
@@ -260,8 +260,8 @@ static void lynxfb_ops_imageblit(struct fb_info *info, const struct fb_image *im
if (image->depth == 1) {
if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
- fgcol = ((u32*)info->pseudo_palette)[image->fg_color];
- bgcol = ((u32*)info->pseudo_palette)[image->bg_color];
+ fgcol = ((u32 *)info->pseudo_palette)[image->fg_color];
+ bgcol = ((u32 *)info->pseudo_palette)[image->bg_color];
} else {
fgcol = image->fg_color;
bgcol = image->bg_color;
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 9/9] staging: sm750: Add space before and after '=', ':' etc
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
` (7 preceding siblings ...)
2015-03-12 19:58 ` [PATCH v2 8/9] staging: sm750: Place * next to identifier Ioana Ciornei
@ 2015-03-12 19:58 ` Ioana Ciornei
8 siblings, 0 replies; 11+ messages in thread
From: Ioana Ciornei @ 2015-03-12 19:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ioana Ciornei
Add space before and after '=', ':', '!=', '?' etc in order to improve readability
and to follow Linux coding style.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
Changes in v2:
- Add spaces around '?' and ':' in conditional assignments
- Change patch description
drivers/staging/sm750fb/sm750.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index ffc977b..4aa2401 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -207,8 +207,8 @@ static void lynxfb_ops_fillrect(struct fb_info *info, const struct fb_fillrect *
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
- color = (Bpp == 1)?region->color:((u32 *)info->pseudo_palette)[region->color];
- rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR:HW_ROP2_COPY;
+ color = (Bpp == 1) ? region->color : ((u32 *)info->pseudo_palette)[region->color];
+ rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR : HW_ROP2_COPY;
myspin_lock(&share->slock);
share->accel.de_fillrect(&share->accel,
@@ -745,7 +745,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
output = &par->output;
crtc = &par->crtc;
- crtc->vidmem_size = (share->dual)?share->vidmem_size>>1:share->vidmem_size;
+ crtc->vidmem_size = (share->dual) ? share->vidmem_size>>1 : share->vidmem_size;
/* setup crtc and output member */
spec_share->hwCursor = g_hwcursor;
@@ -763,10 +763,10 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
output->proc_setMode = hw_sm750_output_setMode;
output->proc_checkMode = hw_sm750_output_checkMode;
- output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID)?hw_sm750le_setBLANK:hw_sm750_setBLANK;
+ output->proc_setBLANK = (share->revid == SM750LE_REVISION_ID) ? hw_sm750le_setBLANK : hw_sm750_setBLANK;
output->clear = hw_sm750_output_clear;
/* chip specific phase */
- share->accel.de_wait = (share->revid == SM750LE_REVIvSION_ID)?hw_sm750le_deWait: hw_sm750_deWait;
+ share->accel.de_wait = (share->revid == SM750LE_REVIvSION_ID) ? hw_sm750le_deWait : hw_sm750_deWait;
switch (spec_share->state.dataflow) {
case sm750_simul_pri:
output->paths = sm750_pnc;
@@ -816,7 +816,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
return ret;
}
-static struct fb_ops lynxfb_ops={
+static struct fb_ops lynxfb_ops = {
.owner = THIS_MODULE,
.fb_check_var = lynxfb_ops_check_var,
.fb_set_par = lynxfb_ops_set_par,
@@ -1350,7 +1350,7 @@ static int __init lynxfb_setup(char *options)
strsep() updates @options to pointer after the first found token
it also returns the pointer ahead the token.
*/
- while ((opt = strsep(&options, ":"))!=NULL) {
+ while ((opt = strsep(&options, ":")) != NULL) {
/* options that mean for any lynx chips are configured here */
if (!strncmp(opt, "noaccel", strlen("noaccel")))
g_noaccel = 1;
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Outreachy kernel] [PATCH v2 1/9] staging: sm750: Place space before after control flow instructions
2015-03-12 19:58 ` [PATCH v2 1/9] staging: sm750: Place space before after control flow instructions Ioana Ciornei
@ 2015-03-15 10:38 ` Greg KH
0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2015-03-15 10:38 UTC (permalink / raw)
To: Ioana Ciornei; +Cc: outreachy-kernel
On Thu, Mar 12, 2015 at 09:58:45PM +0200, Ioana Ciornei wrote:
> Place space between control flow instructions such as: if, switch,
> while etc and '(' in order to improve readability.
>
> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
> ---
> drivers/staging/sm750fb/sm750.c | 180 ++++++++++++++++++++--------------------
> 1 file changed, 90 insertions(+), 90 deletions(-)
Also does not apply at all :(
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-03-15 10:38 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 19:58 [PATCH v2 0/9] staging: sm750: Fix most style errors Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 1/9] staging: sm750: Place space before after control flow instructions Ioana Ciornei
2015-03-15 10:38 ` [Outreachy kernel] " Greg KH
2015-03-12 19:58 ` [PATCH v2 2/9] staging: sm750: Add space before open bracket '{' Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 3/9] staging: sm750: Place space before and after curly brackets Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 4/9] staging: sm750: Remove space before semicolon Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 5/9] staging: sm750: Place open bracket '{' on the next line Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 6/9] staging: sm750: Move open curly bracket on previous line Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 7/9] staging: sm750: Remove unnecessary spaces around ')' Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 8/9] staging: sm750: Place * next to identifier Ioana Ciornei
2015-03-12 19:58 ` [PATCH v2 9/9] staging: sm750: Add space before and after '=', ':' etc Ioana Ciornei
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.