From 68ecfe2fe2e6c636bb7e2cf616e658e342e05362 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Fri, 8 Aug 2014 12:07:55 +0200 Subject: video: of: display_timing: delete unneeded test before of_node_put MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Of_node_put supports NULL as its argument, so the initial test is not necessary. Furthermore, native_mode cannot be NULL at this point. Suggested by Uwe Kleine-König. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e; @@ -if (e) of_node_put(e); // Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/of_display_timing.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 987edf110038..339f831c8412 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -233,8 +233,7 @@ struct display_timings *of_get_display_timings(struct device_node *np) return disp; timingfail: - if (native_mode) - of_node_put(native_mode); + of_node_put(native_mode); display_timings_release(disp); entryfail: kfree(disp); -- cgit v1.2.3-70-g09d2 From 1287c5bf214b906d64a71c481545010dbe1b5b66 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 23 Aug 2014 13:20:24 +0200 Subject: video: fbdev: matrox: use c99 initializers in structures Use c99 initializers for structures. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; ...}; @bad@ identifier decl.i1,i2; expression e; initializer list[decl.n] is; @@ struct i1 i2 = { is, + .fld = e - e ,...}; // Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/matrox/matroxfb_base.c | 52 +++++++++++++++++++++++++---- drivers/video/fbdev/matrox/matroxfb_maven.c | 20 ++++++----- 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c index 7116c5309c7d..62539ca1cfa9 100644 --- a/drivers/video/fbdev/matrox/matroxfb_base.c +++ b/drivers/video/fbdev/matrox/matroxfb_base.c @@ -1341,19 +1341,57 @@ struct video_board { struct matrox_switch* lowlevel; }; #ifdef CONFIG_FB_MATROX_MILLENIUM -static struct video_board vbMillennium = {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGA2064W, &matrox_millennium}; -static struct video_board vbMillennium2 = {0x1000000, 0x0800000, FB_ACCEL_MATROX_MGA2164W, &matrox_millennium}; -static struct video_board vbMillennium2A = {0x1000000, 0x0800000, FB_ACCEL_MATROX_MGA2164W_AGP, &matrox_millennium}; +static struct video_board vbMillennium = { + .maxvram = 0x0800000, + .maxdisplayable = 0x0800000, + .accelID = FB_ACCEL_MATROX_MGA2064W, + .lowlevel = &matrox_millennium +}; + +static struct video_board vbMillennium2 = { + .maxvram = 0x1000000, + .maxdisplayable = 0x0800000, + .accelID = FB_ACCEL_MATROX_MGA2164W, + .lowlevel = &matrox_millennium +}; + +static struct video_board vbMillennium2A = { + .maxvram = 0x1000000, + .maxdisplayable = 0x0800000, + .accelID = FB_ACCEL_MATROX_MGA2164W_AGP, + .lowlevel = &matrox_millennium +}; #endif /* CONFIG_FB_MATROX_MILLENIUM */ #ifdef CONFIG_FB_MATROX_MYSTIQUE -static struct video_board vbMystique = {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGA1064SG, &matrox_mystique}; +static struct video_board vbMystique = { + .maxvram = 0x0800000, + .maxdisplayable = 0x0800000, + .accelID = FB_ACCEL_MATROX_MGA1064SG, + .lowlevel = &matrox_mystique +}; #endif /* CONFIG_FB_MATROX_MYSTIQUE */ #ifdef CONFIG_FB_MATROX_G -static struct video_board vbG100 = {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGAG100, &matrox_G100}; -static struct video_board vbG200 = {0x1000000, 0x1000000, FB_ACCEL_MATROX_MGAG200, &matrox_G100}; +static struct video_board vbG100 = { + .maxvram = 0x0800000, + .maxdisplayable = 0x0800000, + .accelID = FB_ACCEL_MATROX_MGAG100, + .lowlevel = &matrox_G100 +}; + +static struct video_board vbG200 = { + .maxvram = 0x1000000, + .maxdisplayable = 0x1000000, + .accelID = FB_ACCEL_MATROX_MGAG200, + .lowlevel = &matrox_G100 +}; /* from doc it looks like that accelerator can draw only to low 16MB :-( Direct accesses & displaying are OK for whole 32MB */ -static struct video_board vbG400 = {0x2000000, 0x1000000, FB_ACCEL_MATROX_MGAG400, &matrox_G100}; +static struct video_board vbG400 = { + .maxvram = 0x2000000, + .maxdisplayable = 0x1000000, + .accelID = FB_ACCEL_MATROX_MGAG400, + .lowlevel = &matrox_G100 +}; #endif #define DEVF_VIDEO64BIT 0x0001 diff --git a/drivers/video/fbdev/matrox/matroxfb_maven.c b/drivers/video/fbdev/matrox/matroxfb_maven.c index ee41a0f276b2..bf5ce04f9aea 100644 --- a/drivers/video/fbdev/matrox/matroxfb_maven.c +++ b/drivers/video/fbdev/matrox/matroxfb_maven.c @@ -201,21 +201,23 @@ struct matrox_pll_ctl { }; static const struct matrox_pll_features2 maven1000_pll = { - 50000000, - 300000000, - 5, 128, - 3, 32, - 3 + .vco_freq_min = 50000000, + .vco_freq_max = 300000000, + .feed_div_min = 5, + .feed_div_max = 128, + .in_div_min = 3, + .in_div_max = 32, + .post_shift_max = 3 }; static const struct matrox_pll_ctl maven_PAL = { - 540000, - 50 + .ref_freq = 540000, + .den = 50 }; static const struct matrox_pll_ctl maven_NTSC = { - 450450, /* 27027000/60 == 27000000/59.94005994 */ - 60 + .ref_freq = 450450, /* 27027000/60 == 27000000/59.94005994 */ + .den = 60 }; static int matroxfb_PLL_mavenclock(const struct matrox_pll_features2* pll, -- cgit v1.2.3-70-g09d2 From 39917f08721b2f04d06407777ce7ae5913533674 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 23 Aug 2014 13:20:29 +0200 Subject: OMAPDSS: DSI: use c99 initializers in structures Use c99 initializers for structures. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; ...}; @bad@ identifier decl.i1,i2; expression e; initializer list[decl.n] is; @@ struct i1 i2 = { is, + .fld = e - e ,...}; // Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/dsi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c index 56b92444c54f..b6f6ae1d4664 100644 --- a/drivers/video/fbdev/omap2/dss/dsi.c +++ b/drivers/video/fbdev/omap2/dss/dsi.c @@ -2571,7 +2571,10 @@ static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel) { struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); DECLARE_COMPLETION_ONSTACK(completion); - struct dsi_packet_sent_handler_data vp_data = { dsidev, &completion }; + struct dsi_packet_sent_handler_data vp_data = { + .dsidev = dsidev, + .completion = &completion + }; int r = 0; u8 bit; @@ -2617,7 +2620,10 @@ static void dsi_packet_sent_handler_l4(void *data, u32 mask) static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel) { DECLARE_COMPLETION_ONSTACK(completion); - struct dsi_packet_sent_handler_data l4_data = { dsidev, &completion }; + struct dsi_packet_sent_handler_data l4_data = { + .dsidev = dsidev, + .completion = &completion + }; int r = 0; r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4, -- cgit v1.2.3-70-g09d2 From 084244646217ec83970facaf7baf200c02a8183e Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 23 Aug 2014 17:50:28 +0200 Subject: video: fbdev: aty: use c99 initializers in structures Use c99 initializers for structures. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; ...}; @bad@ identifier decl.i1,i2; expression e; initializer list[decl.n] is; @@ struct i1 i2 = { is, + .fld = e - e ,...}; // Signed-off-by: Julia Lawall Reviewed-by: Josh Triplett Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/aty/aty128fb.c | 63 +++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index ff6070170d01..aedf2fbf9bf6 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -324,14 +324,61 @@ struct aty128_meminfo { }; /* various memory configurations */ -static const struct aty128_meminfo sdr_128 = - { 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" }; -static const struct aty128_meminfo sdr_64 = - { 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" }; -static const struct aty128_meminfo sdr_sgram = - { 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" }; -static const struct aty128_meminfo ddr_sgram = - { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" }; +static const struct aty128_meminfo sdr_128 = { + .ML = 4, + .MB = 4, + .Trcd = 3, + .Trp = 3, + .Twr = 1, + .CL = 3, + .Tr2w = 1, + .LoopLatency = 16, + .DspOn = 30, + .Rloop = 16, + .name = "128-bit SDR SGRAM (1:1)", +}; + +static const struct aty128_meminfo sdr_64 = { + .ML = 4, + .MB = 8, + .Trcd = 3, + .Trp = 3, + .Twr = 1, + .CL = 3, + .Tr2w = 1, + .LoopLatency = 17, + .DspOn = 46, + .Rloop = 17, + .name = "64-bit SDR SGRAM (1:1)", +}; + +static const struct aty128_meminfo sdr_sgram = { + .ML = 4, + .MB = 4, + .Trcd = 1, + .Trp = 2, + .Twr = 1, + .CL = 2, + .Tr2w = 1, + .LoopLatency = 16, + .DspOn = 24, + .Rloop = 16, + .name = "64-bit SDR SGRAM (2:1)", +}; + +static const struct aty128_meminfo ddr_sgram = { + .ML = 4, + .MB = 4, + .Trcd = 3, + .Trp = 3, + .Twr = 2, + .CL = 3, + .Tr2w = 1, + .LoopLatency = 16, + .DspOn = 31, + .Rloop = 16, + .name = "64-bit DDR SGRAM", +}; static struct fb_fix_screeninfo aty128fb_fix = { .id = "ATY Rage128", -- cgit v1.2.3-70-g09d2 From c76031f3ece10939d87cc96857b9e045133064e6 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Tue, 8 Jul 2014 18:27:18 +0200 Subject: video: vermilion: remove unnecessary break after goto Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: Jingoo Han Cc: linux-fbdev@vger.kernel.org Signed-off-by: Fabian Frederick Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/vermilion/vermilion.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c index 048a66640b03..5f930aeccf1f 100644 --- a/drivers/video/fbdev/vermilion/vermilion.c +++ b/drivers/video/fbdev/vermilion/vermilion.c @@ -481,7 +481,6 @@ static int vml_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) default: err = -ENODEV; goto out_err_1; - break; } info = &vinfo->info; -- cgit v1.2.3-70-g09d2 From 87306c1d09c8dd7ed291a6b5d6c31323cd81f2ae Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Fri, 11 Jul 2014 18:13:27 +0200 Subject: video: mx3fb: Update comment for dmaengine_prep_slave_sg() API Commit 16052827d98fbc13c31ebad560af4bd53e2b4dd5 ("dmaengine/dma_slave: introduce inline wrappers") changed the code to use the new API, but forgot to update a comment. Signed-off-by: Geert Uytterhoeven Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: Jiri Kosina Cc: linux-fbdev@vger.kernel.org -- v2: - New Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/mx3fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c index c645a0a0c341..5e97baf92721 100644 --- a/drivers/video/fbdev/mx3fb.c +++ b/drivers/video/fbdev/mx3fb.c @@ -1179,7 +1179,7 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var, /* * We enable the End of Frame interrupt, which will free a tx-descriptor, - * which we will need for the next device_prep_slave_sg(). The + * which we will need for the next dmaengine_prep_slave_sg(). The * IRQ-handler will disable the IRQ again. */ init_completion(&mx3_fbi->flip_cmpl); -- cgit v1.2.3-70-g09d2 From 0c46575f7c7dea4068924f2c0d938232f68a5cda Mon Sep 17 00:00:00 2001 From: Pramod Gurav Date: Tue, 26 Aug 2014 17:40:37 +0530 Subject: msm: msm_fb: Add remove function for platform driver for clean unloading This adds a remove function to platform driver structure so that resources are released when driver is unloaded. Signed-off-by: Pramod Gurav CC: Jean-Christophe Plagniol-Villard CC: Tomi Valkeinen CC: Stephen Boyd CC: Jingoo Han CC: Rob Clark Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/msm/msm_fb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/video/fbdev/msm/msm_fb.c b/drivers/video/fbdev/msm/msm_fb.c index 1374803fbcd9..4640188ffd6e 100644 --- a/drivers/video/fbdev/msm/msm_fb.c +++ b/drivers/video/fbdev/msm/msm_fb.c @@ -589,6 +589,8 @@ static int msmfb_probe(struct platform_device *pdev) msmfb->sleeping = WAKING; + platform_set_drvdata(pdev, msmfb); + return 0; error_register_framebuffer: @@ -598,9 +600,23 @@ error_setup_fbmem: return ret; } +static int msmfb_remove(struct platform_device *pdev) +{ + struct msmfb_info *msmfb; + + msmfb = platform_get_drvdata(pdev); + + unregister_framebuffer(msmfb->fb); + iounmap(msmfb->fb->screen_base); + framebuffer_release(msmfb->fb); + + return 0; +} + static struct platform_driver msm_panel_driver = { /* need to write remove */ .probe = msmfb_probe, + .remove = msmfb_remove, .driver = {.name = "msm_panel"}, }; -- cgit v1.2.3-70-g09d2 From fbaa19df03f87c2aa6a3a0a14dd7d4c098d45643 Mon Sep 17 00:00:00 2001 From: Pramod Gurav Date: Tue, 26 Aug 2014 18:22:58 +0530 Subject: msm: msm_fb: Move to using managed resources of kzalloc Move to managed verion of kzalloc. Also checks return for failure case which was missing. Signed-off-by: Pramod Gurav CC: Jean-Christophe Plagniol-Villard CC: Tomi Valkeinen CC: Stephen Boyd CC: Jingoo Han CC: Rob Clark Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/msm/msm_fb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/msm/msm_fb.c b/drivers/video/fbdev/msm/msm_fb.c index 4640188ffd6e..2979d7e72126 100644 --- a/drivers/video/fbdev/msm/msm_fb.c +++ b/drivers/video/fbdev/msm/msm_fb.c @@ -569,8 +569,13 @@ static int msmfb_probe(struct platform_device *pdev) mutex_init(&msmfb->panel_init_lock); init_waitqueue_head(&msmfb->frame_wq); INIT_WORK(&msmfb->resume_work, power_on_panel); - msmfb->black = kzalloc(msmfb->fb->var.bits_per_pixel*msmfb->xres, - GFP_KERNEL); + msmfb->black = devm_kzalloc(&pdev->dev, + msmfb->fb->var.bits_per_pixel*msmfb->xres, + GFP_KERNEL); + if (!msmfb->black) { + ret = -ENOMEM; + goto error_register_framebuffer; + } printk(KERN_INFO "msmfb_probe() installing %d x %d panel\n", msmfb->xres, msmfb->yres); -- cgit v1.2.3-70-g09d2 From f57eda296dc327fc3f5d21099cf232bcd004237f Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 23 Aug 2014 20:33:22 +0200 Subject: video: fbdev: riva: delete double assignment Delete successive assignments to the same location. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = ...; i = ...; // Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/riva/riva_hw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/fbdev/riva/riva_hw.c b/drivers/video/fbdev/riva/riva_hw.c index 78fdbf5178d7..8bdf37f3013b 100644 --- a/drivers/video/fbdev/riva/riva_hw.c +++ b/drivers/video/fbdev/riva/riva_hw.c @@ -430,7 +430,6 @@ static char nv3_arb(nv3_fifo_info * res_info, nv3_sim_state * state, nv3_arb_in int mmisses, gmisses, vmisses, eburst_size, mburst_size; int refresh_cycle; - refresh_cycle = 0; refresh_cycle = 2*(state->mclk_khz/state->pclk_khz) + 5; mmisses = 2; if (state->mem_aligned) gmisses = 2; -- cgit v1.2.3-70-g09d2 From 2079a513b0f03c8872322070944720d2c174b005 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 23 Aug 2014 20:33:23 +0200 Subject: video: fbdev: intelfb: delete double assignment Delete successive assignments to the same location. In the second case, = is converted to |=, which looks appropriate based on the values involved. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = ...; i = ...; // Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/intelfb/intelfbhw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/fbdev/intelfb/intelfbhw.c b/drivers/video/fbdev/intelfb/intelfbhw.c index fbad61da359f..d31ed4e2c46f 100644 --- a/drivers/video/fbdev/intelfb/intelfbhw.c +++ b/drivers/video/fbdev/intelfb/intelfbhw.c @@ -1191,7 +1191,6 @@ int intelfbhw_mode_to_hw(struct intelfb_info *dinfo, vsync_end = vsync_start + var->vsync_len; vtotal = vsync_end + var->upper_margin; vblank_start = vactive; - vblank_end = vtotal; vblank_end = vsync_end + 1; DBG_MSG("V: act %d, ss %d, se %d, tot %d bs %d, be %d\n", @@ -1859,7 +1858,7 @@ void intelfbhw_cursor_init(struct intelfb_info *dinfo) tmp = INREG(CURSOR_CONTROL); tmp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE | CURSOR_ENABLE | CURSOR_STRIDE_MASK); - tmp = CURSOR_FORMAT_3C; + tmp |= CURSOR_FORMAT_3C; OUTREG(CURSOR_CONTROL, tmp); OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.offset << 12); tmp = (64 << CURSOR_SIZE_H_SHIFT) | -- cgit v1.2.3-70-g09d2 From a9a3cac6908a86ada51ab12f7eb39d0313814d23 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 23 Aug 2014 20:33:27 +0200 Subject: video: fbdev: sis: delete double assignment Delete successive assignments to the same location. The second assignment is changed to update a different field, as done in other nearby code. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = ...; i = ...; // Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/sis/init301.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/sis/init301.c b/drivers/video/fbdev/sis/init301.c index a89e3cafd5ad..295e0dedaf1f 100644 --- a/drivers/video/fbdev/sis/init301.c +++ b/drivers/video/fbdev/sis/init301.c @@ -1714,7 +1714,7 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh SiS_Pr->PanelVCLKIdx315 = VCLK81_315; /* ? */ } else { SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 802; - SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRS = 112; + SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112; SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6; SiS_Pr->PanelVCLKIdx300 = VCLK81_300; SiS_Pr->PanelVCLKIdx315 = VCLK81_315; -- cgit v1.2.3-70-g09d2 From 58678a77029bc1f78f80f6f93da3d302d587f951 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 23 Aug 2014 20:33:28 +0200 Subject: video: fbdev: au1200fb: delete double assignment Delete successive assignments to the same location. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = ...; i = ...; // Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/au1200fb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index 40494dbdf519..18600d4e1b3f 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c @@ -1254,7 +1254,6 @@ static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) pdata->brightness = 30; } divider = (lcd->pwmdiv & 0x3FFFF) + 1; - hi1 = (lcd->pwmhi >> 16) + 1; hi1 = (((pdata->brightness & 0xFF)+1) * divider >> 8); lcd->pwmhi &= 0xFFFF; lcd->pwmhi |= (hi1 << 16); -- cgit v1.2.3-70-g09d2 From 9c8ee3c7341393811d5be5eb61b815e76f92c799 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 8 Sep 2014 17:17:13 +0200 Subject: video: mx3fb: always enable BACKLIGHT_LCD_SUPPORT Commit 7edaa761ee81b ("video: mx3fb: Add backlight control support") changed the mx3fb driver so it always selects the BACKLIGHT_CLASS_DEVICE symbol, but that is hidden behind BACKLIGHT_LCD_SUPPORT in Kconfig, so we get a Kconfig warning for multi_v5_defconfig, which doesn't have that: Warning: (DRM_RADEON && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 && DRM_SHMOBILE && DRM_TILCDC && FB_BACKLIGHT && FB_MX3 && USB_APPLEDISPLAY && FB_OLPC_DCON && ASUS_LAPTOP && SONY_LAPTOP && THINKPAD_ACPI && EEEPC_LAPTOP && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT) This makes sure we always enable both symbols together for mx3fb, like we do for the other drivers that can't be built without backlight support. Note that a better solution would be to ensure the driver can work with or without backlight support. Signed-off-by: Arnd Bergmann Cc: Alexander Stein Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index e911b9c96e19..7b01cd75973c 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2352,10 +2352,11 @@ config FB_MSM config FB_MX3 tristate "MX3 Framebuffer support" depends on FB && MX3_IPU + select BACKLIGHT_CLASS_DEVICE + select BACKLIGHT_LCD_SUPPORT select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT - select BACKLIGHT_CLASS_DEVICE default y help This is a framebuffer device for the i.MX31 LCD Controller. So -- cgit v1.2.3-70-g09d2 From 30296f61159e803ba4c35b4bd1a2fef4cdd3a1d4 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 5 Sep 2014 17:47:35 +0300 Subject: video: fbdev: use %*ph specifier to dump small buffers Instead of dereference each byte let's use %*ph specifier in the printk() calls. Signed-off-by: Andy Shevchenko Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/core/fbsysfs.c | 12 ++---------- drivers/video/fbdev/udlfb.c | 7 ++----- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 53444ac19fe0..60c3f0a16341 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -485,16 +485,8 @@ static ssize_t show_bl_curve(struct device *device, mutex_lock(&fb_info->bl_curve_mutex); for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8) - len += snprintf(&buf[len], PAGE_SIZE, - "%02x %02x %02x %02x %02x %02x %02x %02x\n", - fb_info->bl_curve[i + 0], - fb_info->bl_curve[i + 1], - fb_info->bl_curve[i + 2], - fb_info->bl_curve[i + 3], - fb_info->bl_curve[i + 4], - fb_info->bl_curve[i + 5], - fb_info->bl_curve[i + 6], - fb_info->bl_curve[i + 7]); + len += snprintf(&buf[len], PAGE_SIZE, "%8ph\n", + fb_info->bl_curve + i); mutex_unlock(&fb_info->bl_curve_mutex); return len; diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index 77b890e4d296..046d51d83d74 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1528,11 +1528,8 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dev, } if (total_len > 5) { - pr_info("vendor descriptor length:%x data:%02x %02x %02x %02x" \ - "%02x %02x %02x %02x %02x %02x %02x\n", - total_len, desc[0], - desc[1], desc[2], desc[3], desc[4], desc[5], desc[6], - desc[7], desc[8], desc[9], desc[10]); + pr_info("vendor descriptor length:%x data:%11ph\n", total_len, + desc); if ((desc[0] != total_len) || /* descriptor length */ (desc[1] != 0x5f) || /* vendor descriptor type */ -- cgit v1.2.3-70-g09d2 From 66b330992c088a3eecbb61eb568095a3919d5aba Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 14 Sep 2014 11:48:30 +0200 Subject: video: valkyriefb: Fix unused variable warning in set_valkyrie_clock() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If CONFIG_ADB_CUDA=n: drivers/video/fbdev/valkyriefb.c: In function ‘set_valkyrie_clock’: drivers/video/fbdev/valkyriefb.c:267: warning: unused variable ‘i’ drivers/video/fbdev/valkyriefb.c:266: warning: unused variable ‘req’ Move the variable declarations inside the existing #ifdef section to fix this. Signed-off-by: Geert Uytterhoeven Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/valkyriefb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c index 97cb9bd1d1dd..b6ed09f16355 100644 --- a/drivers/video/fbdev/valkyriefb.c +++ b/drivers/video/fbdev/valkyriefb.c @@ -263,10 +263,10 @@ static inline int valkyrie_vram_reqd(int video_mode, int color_mode) static void set_valkyrie_clock(unsigned char *params) { +#ifdef CONFIG_ADB_CUDA struct adb_request req; int i; -#ifdef CONFIG_ADB_CUDA for (i = 0; i < 3; ++i) { cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x50, i + 1, params[i]); -- cgit v1.2.3-70-g09d2 From b232e94d2842abb893ccb0a870a8d7a920f87df4 Mon Sep 17 00:00:00 2001 From: Rickard Strandqvist Date: Sun, 14 Sep 2014 19:35:48 +0200 Subject: video: fbdev: sis: sis_main.c: Cleaning up missing null-terminate in conjunction with strncpy Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/sis/sis_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index 3f12a2dd959a..1f4c216327f6 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -5830,7 +5830,7 @@ static int sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ivideo->cardnumber++; } - strncpy(ivideo->myid, chipinfo->chip_name, 30); + strlcpy(ivideo->myid, chipinfo->chip_name, sizeof(ivideo->myid)); ivideo->warncount = 0; ivideo->chip_id = pdev->device; -- cgit v1.2.3-70-g09d2 From 1f17a0fa681326f726505f5a662caf07f0d098e2 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 17 Sep 2014 21:00:14 +0200 Subject: video: fbdev: stifb.c: use container_of to resolve stifb_info from fb_info Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/stifb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c index cfe8a2f905c5..86621fabbb8b 100644 --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -918,7 +918,7 @@ static int stifb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) { - struct stifb_info *fb = (struct stifb_info *) info; + struct stifb_info *fb = container_of(info, struct stifb_info, info); u32 color; if (regno >= NR_PALETTE) @@ -978,7 +978,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, static int stifb_blank(int blank_mode, struct fb_info *info) { - struct stifb_info *fb = (struct stifb_info *) info; + struct stifb_info *fb = container_of(info, struct stifb_info, info); int enable = (blank_mode == 0) ? ENABLE : DISABLE; switch (fb->id) { -- cgit v1.2.3-70-g09d2 From 21f7c247035e17950f0edda2de767434f82a8886 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 17 Sep 2014 21:00:15 +0200 Subject: video: fbdev: sa1100fb.c: use container_of to resolve sa1100fb_info from fb_info Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/sa1100fb.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index 580c444ec301..9690216d38ff 100644 --- a/drivers/video/fbdev/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c @@ -268,7 +268,8 @@ static int sa1100fb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue, u_int trans, struct fb_info *info) { - struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; + struct sa1100fb_info *fbi = + container_of(info, struct sa1100fb_info, fb); u_int val, ret = 1; if (regno < fbi->palette_size) { @@ -289,7 +290,8 @@ static int sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int trans, struct fb_info *info) { - struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; + struct sa1100fb_info *fbi = + container_of(info, struct sa1100fb_info, fb); unsigned int val; int ret = 1; @@ -366,7 +368,8 @@ static inline unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo static int sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { - struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; + struct sa1100fb_info *fbi = + container_of(info, struct sa1100fb_info, fb); int rgbidx; if (var->xres < MIN_XRES) @@ -433,7 +436,8 @@ static void sa1100fb_set_visual(struct sa1100fb_info *fbi, u32 visual) */ static int sa1100fb_set_par(struct fb_info *info) { - struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; + struct sa1100fb_info *fbi = + container_of(info, struct sa1100fb_info, fb); struct fb_var_screeninfo *var = &info->var; unsigned long palette_mem_size; @@ -526,7 +530,8 @@ sa1100fb_set_cmap(struct fb_cmap *cmap, int kspc, int con, */ static int sa1100fb_blank(int blank, struct fb_info *info) { - struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; + struct sa1100fb_info *fbi = + container_of(info, struct sa1100fb_info, fb); int i; dev_dbg(fbi->dev, "sa1100fb_blank: blank=%d\n", blank); @@ -555,7 +560,8 @@ static int sa1100fb_blank(int blank, struct fb_info *info) static int sa1100fb_mmap(struct fb_info *info, struct vm_area_struct *vma) { - struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; + struct sa1100fb_info *fbi = + container_of(info, struct sa1100fb_info, fb); unsigned long off = vma->vm_pgoff << PAGE_SHIFT; if (off < info->fix.smem_len) { -- cgit v1.2.3-70-g09d2 From c4e423239ca7cbc3133e600b61b19fb8669eec57 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 17 Sep 2014 21:00:16 +0200 Subject: video: fbdev: controlfb.c: use container_of to resolve fb_info_control from fb_info Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/controlfb.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index fdadef979238..080fdd2a70f3 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -218,7 +218,8 @@ static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *i */ static int controlfb_set_par (struct fb_info *info) { - struct fb_info_control *p = (struct fb_info_control *) info; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); struct fb_par_control par; int err; @@ -258,7 +259,8 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { unsigned int xoffset, hstep; - struct fb_info_control *p = (struct fb_info_control *)info; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); struct fb_par_control *par = &p->par; /* @@ -309,7 +311,8 @@ static int controlfb_mmap(struct fb_info *info, static int controlfb_blank(int blank_mode, struct fb_info *info) { - struct fb_info_control *p = (struct fb_info_control *) info; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); unsigned ctrl; ctrl = ld_le32(CNTRL_REG(p,ctrl)); @@ -342,7 +345,8 @@ static int controlfb_blank(int blank_mode, struct fb_info *info) static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) { - struct fb_info_control *p = (struct fb_info_control *) info; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); __u8 r, g, b; if (regno > 255) @@ -833,7 +837,8 @@ static int control_var_to_par(struct fb_var_screeninfo *var, unsigned hperiod, hssync, hsblank, hesync, heblank, piped, heq, hlfln, hserr, vperiod, vssync, vesync, veblank, vsblank, vswin, vewin; unsigned long pixclock; - struct fb_info_control *p = (struct fb_info_control *) fb_info; + struct fb_info_control *p = + container_of(fb_info, struct fb_info_control, info); struct control_regvals *r = &par->regvals; switch (var->bits_per_pixel) { -- cgit v1.2.3-70-g09d2 From 46ffbe20d299bc80a0d4f5c2229c8eaf250a85f3 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 17 Sep 2014 21:00:17 +0200 Subject: video: fbdev: cyber2000fb.c: use container_of to resolve cfb_info from fb_info Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/cyber2000fb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c index b0a950f36970..99acf538a8b8 100644 --- a/drivers/video/fbdev/cyber2000fb.c +++ b/drivers/video/fbdev/cyber2000fb.c @@ -159,7 +159,7 @@ cyber2000_seqw(unsigned int reg, unsigned int val, struct cfb_info *cfb) static void cyber2000fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) { - struct cfb_info *cfb = (struct cfb_info *)info; + struct cfb_info *cfb = container_of(info, struct cfb_info, fb); unsigned long dst, col; if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) { @@ -191,7 +191,7 @@ cyber2000fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) static void cyber2000fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) { - struct cfb_info *cfb = (struct cfb_info *)info; + struct cfb_info *cfb = container_of(info, struct cfb_info, fb); unsigned int cmd = CO_CMD_L_PATTERN_FGCOL; unsigned long src, dst; @@ -241,7 +241,7 @@ cyber2000fb_imageblit(struct fb_info *info, const struct fb_image *image) static int cyber2000fb_sync(struct fb_info *info) { - struct cfb_info *cfb = (struct cfb_info *)info; + struct cfb_info *cfb = container_of(info, struct cfb_info, fb); int count = 100000; if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) @@ -276,7 +276,7 @@ static int cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) { - struct cfb_info *cfb = (struct cfb_info *)info; + struct cfb_info *cfb = container_of(info, struct cfb_info, fb); struct fb_var_screeninfo *var = &cfb->fb.var; u32 pseudo_val; int ret = 1; @@ -758,7 +758,7 @@ cyber2000fb_decode_clock(struct par_info *hw, struct cfb_info *cfb, static int cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { - struct cfb_info *cfb = (struct cfb_info *)info; + struct cfb_info *cfb = container_of(info, struct cfb_info, fb); struct par_info hw; unsigned int mem; int err; @@ -861,7 +861,7 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) static int cyber2000fb_set_par(struct fb_info *info) { - struct cfb_info *cfb = (struct cfb_info *)info; + struct cfb_info *cfb = container_of(info, struct cfb_info, fb); struct fb_var_screeninfo *var = &cfb->fb.var; struct par_info hw; unsigned int mem; @@ -971,7 +971,7 @@ static int cyber2000fb_set_par(struct fb_info *info) static int cyber2000fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { - struct cfb_info *cfb = (struct cfb_info *)info; + struct cfb_info *cfb = container_of(info, struct cfb_info, fb); if (cyber2000fb_update_start(cfb, var)) return -EINVAL; @@ -1007,7 +1007,7 @@ cyber2000fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) */ static int cyber2000fb_blank(int blank, struct fb_info *info) { - struct cfb_info *cfb = (struct cfb_info *)info; + struct cfb_info *cfb = container_of(info, struct cfb_info, fb); unsigned int sync = 0; int i; -- cgit v1.2.3-70-g09d2 From 29ebebb4b525ca080e0758e7445c416927dd4eeb Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 17 Sep 2014 21:00:18 +0200 Subject: video: fbdev: pxafb.c: use container_of to resolve pxafb_info/layer from fb_info Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/pxafb.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index 1ecd9cec2921..a5acca88fa63 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -138,7 +138,7 @@ static int pxafb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue, u_int trans, struct fb_info *info) { - struct pxafb_info *fbi = (struct pxafb_info *)info; + struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb); u_int val; if (regno >= fbi->palette_size) @@ -183,7 +183,7 @@ static int pxafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int trans, struct fb_info *info) { - struct pxafb_info *fbi = (struct pxafb_info *)info; + struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb); unsigned int val; int ret = 1; @@ -456,7 +456,7 @@ static int pxafb_adjust_timing(struct pxafb_info *fbi, */ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { - struct pxafb_info *fbi = (struct pxafb_info *)info; + struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb); struct pxafb_mach_info *inf = dev_get_platdata(fbi->dev); int err; @@ -494,7 +494,7 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) */ static int pxafb_set_par(struct fb_info *info) { - struct pxafb_info *fbi = (struct pxafb_info *)info; + struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb); struct fb_var_screeninfo *var = &info->var; if (var->bits_per_pixel >= 16) @@ -533,7 +533,7 @@ static int pxafb_set_par(struct fb_info *info) static int pxafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { - struct pxafb_info *fbi = (struct pxafb_info *)info; + struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb); struct fb_var_screeninfo newvar; int dma = DMA_MAX + DMA_BASE; @@ -566,7 +566,7 @@ static int pxafb_pan_display(struct fb_var_screeninfo *var, */ static int pxafb_blank(int blank, struct fb_info *info) { - struct pxafb_info *fbi = (struct pxafb_info *)info; + struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb); int i; switch (blank) { @@ -725,7 +725,7 @@ static struct pxafb_layer_ops ofb_ops[] = { static int overlayfb_open(struct fb_info *info, int user) { - struct pxafb_layer *ofb = (struct pxafb_layer *)info; + struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb); /* no support for framebuffer console on overlay */ if (user == 0) @@ -743,7 +743,7 @@ static int overlayfb_open(struct fb_info *info, int user) static int overlayfb_release(struct fb_info *info, int user) { - struct pxafb_layer *ofb = (struct pxafb_layer*) info; + struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb); if (ofb->usage == 1) { ofb->ops->disable(ofb); @@ -760,7 +760,7 @@ static int overlayfb_release(struct fb_info *info, int user) static int overlayfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { - struct pxafb_layer *ofb = (struct pxafb_layer *)info; + struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb); struct fb_var_screeninfo *base_var = &ofb->fbi->fb.var; int xpos, ypos, pfor, bpp; @@ -836,7 +836,7 @@ static int overlayfb_check_video_memory(struct pxafb_layer *ofb) static int overlayfb_set_par(struct fb_info *info) { - struct pxafb_layer *ofb = (struct pxafb_layer *)info; + struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb); struct fb_var_screeninfo *var = &info->var; int xpos, ypos, pfor, bpp, ret; -- cgit v1.2.3-70-g09d2 From 8251434bb489f4bf7fbc1825fb212051d0a030ea Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 17 Sep 2014 21:00:19 +0200 Subject: video: fbdev: valkyriefb.c: use container_of to resolve fb_info_valkyrie from fb_info Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/valkyriefb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c index b6ed09f16355..275fb98236d3 100644 --- a/drivers/video/fbdev/valkyriefb.c +++ b/drivers/video/fbdev/valkyriefb.c @@ -136,7 +136,8 @@ static struct fb_ops valkyriefb_ops = { /* Sets the video mode according to info->var */ static int valkyriefb_set_par(struct fb_info *info) { - struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) info; + struct fb_info_valkyrie *p = + container_of(info, struct fb_info_valkyrie, info); volatile struct valkyrie_regs __iomem *valkyrie_regs = p->valkyrie_regs; struct fb_par_valkyrie *par = info->par; struct valkyrie_regvals *init; @@ -194,7 +195,8 @@ valkyriefb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) */ static int valkyriefb_blank(int blank_mode, struct fb_info *info) { - struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) info; + struct fb_info_valkyrie *p = + container_of(info, struct fb_info_valkyrie, info); struct fb_par_valkyrie *par = info->par; struct valkyrie_regvals *init = par->init; @@ -226,7 +228,8 @@ static int valkyriefb_blank(int blank_mode, struct fb_info *info) static int valkyriefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) { - struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) info; + struct fb_info_valkyrie *p = + container_of(info, struct fb_info_valkyrie, info); volatile struct cmap_regs __iomem *cmap_regs = p->cmap_regs; struct fb_par_valkyrie *par = info->par; @@ -465,7 +468,8 @@ static int valkyrie_var_to_par(struct fb_var_screeninfo *var, { int vmode, cmode; struct valkyrie_regvals *init; - struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) fb_info; + struct fb_info_valkyrie *p = + container_of(fb_info, struct fb_info_valkyrie, info); if (mac_var_to_vmode(var, &vmode, &cmode) != 0) { printk(KERN_ERR "valkyriefb: can't do %dx%dx%d.\n", -- cgit v1.2.3-70-g09d2 From 032e57f01b7524ad9aec39788b38f523583ab58e Mon Sep 17 00:00:00 2001 From: Behan Webster Date: Fri, 26 Sep 2014 18:10:52 -0700 Subject: arm, fbdev, omap2, LLVMLinux: Remove nested function from omap2 dss Replace the use of nested functions where a normal function will suffice. Nested functions are not liked by upstream kernel developers in general. Their use breaks the use of clang as a compiler, and doesn't make the code any better. This code now works for both gcc and clang. Signed-off-by: Behan Webster Suggested-by: Arnd Bergmann Cc: Arnd Bergmann Reviewed-by: Felipe Balbi Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/dispc-compat.c | 9 +++++---- drivers/video/fbdev/omap2/dss/manager-sysfs.c | 16 +++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/dispc-compat.c b/drivers/video/fbdev/omap2/dss/dispc-compat.c index 83779c2b292a..633c461fbc6e 100644 --- a/drivers/video/fbdev/omap2/dss/dispc-compat.c +++ b/drivers/video/fbdev/omap2/dss/dispc-compat.c @@ -634,13 +634,14 @@ void dispc_mgr_disable_sync(enum omap_channel channel) WARN_ON(1); } +static inline void dispc_irq_wait_handler(void *data, u32 mask) +{ + complete((struct completion *)data); +} + int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask, unsigned long timeout) { - void dispc_irq_wait_handler(void *data, u32 mask) - { - complete((struct completion *)data); - } int r; DECLARE_COMPLETION_ONSTACK(completion); diff --git a/drivers/video/fbdev/omap2/dss/manager-sysfs.c b/drivers/video/fbdev/omap2/dss/manager-sysfs.c index 37b59fe28dc8..a7414fb12830 100644 --- a/drivers/video/fbdev/omap2/dss/manager-sysfs.c +++ b/drivers/video/fbdev/omap2/dss/manager-sysfs.c @@ -44,6 +44,13 @@ static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf) dssdev->name : ""); } +static int manager_display_match(struct omap_dss_device *dssdev, void *data) +{ + const char *str = data; + + return sysfs_streq(dssdev->name, str); +} + static ssize_t manager_display_store(struct omap_overlay_manager *mgr, const char *buf, size_t size) { @@ -52,17 +59,12 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr, struct omap_dss_device *dssdev = NULL; struct omap_dss_device *old_dssdev; - int match(struct omap_dss_device *dssdev, void *data) - { - const char *str = data; - return sysfs_streq(dssdev->name, str); - } - if (buf[size-1] == '\n') --len; if (len > 0) - dssdev = omap_dss_find_device((void *)buf, match); + dssdev = omap_dss_find_device((void *)buf, + manager_display_match); if (len > 0 && dssdev == NULL) return -EINVAL; -- cgit v1.2.3-70-g09d2 From c8b8888f097c7df260cf5beaf2e3a325660a16a4 Mon Sep 17 00:00:00 2001 From: Behan Webster Date: Fri, 26 Sep 2014 18:10:53 -0700 Subject: arm, fbdev, omap2, LLVMLinux: Remove nested function from omapfb Replace the use of nested functions where a normal function will suffice. Nested functions are not liked by upstream kernel developers in general. Their use breaks the use of clang as a compiler, and doesn't make the code any better. This code now works for both gcc and clang. Signed-off-by: Behan Webster Suggested-by: Arnd Bergmann Cc: Arnd Bergmann Reviewed-by: Felipe Balbi Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c index ec2d132c782d..15872433e0c6 100644 --- a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c @@ -273,16 +273,16 @@ static struct omapfb_colormode omapfb_colormodes[] = { }, }; +static bool cmp_component(struct fb_bitfield *f1, struct fb_bitfield *f2) +{ + return f1->length == f2->length && + f1->offset == f2->offset && + f1->msb_right == f2->msb_right; +} + static bool cmp_var_to_colormode(struct fb_var_screeninfo *var, struct omapfb_colormode *color) { - bool cmp_component(struct fb_bitfield *f1, struct fb_bitfield *f2) - { - return f1->length == f2->length && - f1->offset == f2->offset && - f1->msb_right == f2->msb_right; - } - if (var->bits_per_pixel == 0 || var->red.length == 0 || var->blue.length == 0 || -- cgit v1.2.3-70-g09d2 From f74a289b9480648a654e5afd8458c2263c03a1e1 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Tue, 16 Sep 2014 12:40:26 -0400 Subject: framebuffer: fix border color The framebuffer code uses the current background color to fill the border when switching consoles, however, this results in inconsistent behavior. For example: - start Midnigh Commander - the border is black - switch to another console and switch back - the border is cyan - type something into the command line in mc - the border is cyan - switch to another console and switch back - the border is black - press F9 to go to menu - the border is black - switch to another console and switch back - the border is dark blue When switching to a console with Midnight Commander, the border is random color that was left selected by the slang subsystem. This patch fixes this inconsistency by always using black as the background color when switching consoles. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: Tomi Valkeinen --- drivers/video/console/bitblit.c | 3 +-- drivers/video/console/fbcon_ccw.c | 3 +-- drivers/video/console/fbcon_cw.c | 3 +-- drivers/video/console/fbcon_ud.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c index 61b182bf32a2..dbfe4eecf12e 100644 --- a/drivers/video/console/bitblit.c +++ b/drivers/video/console/bitblit.c @@ -205,7 +205,6 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info, static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) { - int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; unsigned int cw = vc->vc_font.width; unsigned int ch = vc->vc_font.height; unsigned int rw = info->var.xres - (vc->vc_cols*cw); @@ -214,7 +213,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, unsigned int bs = info->var.yres - bh; struct fb_fillrect region; - region.color = attr_bgcol_ec(bgshift, vc, info); + region.color = 0; region.rop = ROP_COPY; if (rw && !bottom_only) { diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c index 41b32ae23dac..5a3cbf6dff4d 100644 --- a/drivers/video/console/fbcon_ccw.c +++ b/drivers/video/console/fbcon_ccw.c @@ -197,9 +197,8 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, unsigned int bh = info->var.xres - (vc->vc_rows*ch); unsigned int bs = vc->vc_rows*ch; struct fb_fillrect region; - int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; - region.color = attr_bgcol_ec(bgshift,vc,info); + region.color = 0; region.rop = ROP_COPY; if (rw && !bottom_only) { diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c index a93670ef7f89..e7ee44db4e98 100644 --- a/drivers/video/console/fbcon_cw.c +++ b/drivers/video/console/fbcon_cw.c @@ -180,9 +180,8 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, unsigned int bh = info->var.xres - (vc->vc_rows*ch); unsigned int rs = info->var.yres - rw; struct fb_fillrect region; - int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; - region.color = attr_bgcol_ec(bgshift,vc,info); + region.color = 0; region.rop = ROP_COPY; if (rw && !bottom_only) { diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c index ff0872c0498b..19e3714abfe8 100644 --- a/drivers/video/console/fbcon_ud.c +++ b/drivers/video/console/fbcon_ud.c @@ -227,9 +227,8 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, unsigned int rw = info->var.xres - (vc->vc_cols*cw); unsigned int bh = info->var.yres - (vc->vc_rows*ch); struct fb_fillrect region; - int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; - region.color = attr_bgcol_ec(bgshift,vc,info); + region.color = 0; region.rop = ROP_COPY; if (rw && !bottom_only) { -- cgit v1.2.3-70-g09d2 From 5b789da8a7fc357661fc61faaf853e9161cc9700 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Tue, 16 Sep 2014 12:38:53 -0400 Subject: framebuffer: fix screen corruption when copying The function bitcpy_rev has a bug that may result in screen corruption. The bug happens under these conditions: * the end of the destination area of a copy operation is aligned on a long word boundary * the end of the source area is not aligned on a long word boundary * we are copying more than one long word In this case, the variable shift is non-zero and the variable first is zero. The statements FB_WRITEL(comp(d0, FB_READL(dst), first), dst) reads the last long word of the destination and writes it back unchanged (because first is zero). Correctly, we should write the variable d0 to the last word of the destination in this case. This patch fixes the bug by introducing and extra test if first is zero. The patch also removes the references to fb_memmove in the code that is commented out because fb_memmove was removed from framebuffer subsystem. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/core/cfbcopyarea.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/core/cfbcopyarea.c b/drivers/video/fbdev/core/cfbcopyarea.c index bcb57235fcc7..6d4bfeecee35 100644 --- a/drivers/video/fbdev/core/cfbcopyarea.c +++ b/drivers/video/fbdev/core/cfbcopyarea.c @@ -55,8 +55,8 @@ bitcpy(struct fb_info *p, unsigned long __iomem *dst, unsigned dst_idx, * If you suspect bug in this function, compare it with this simple * memmove implementation. */ - fb_memmove((char *)dst + ((dst_idx & (bits - 1))) / 8, - (char *)src + ((src_idx & (bits - 1))) / 8, n / 8); + memmove((char *)dst + ((dst_idx & (bits - 1))) / 8, + (char *)src + ((src_idx & (bits - 1))) / 8, n / 8); return; #endif @@ -221,8 +221,8 @@ bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, unsigned dst_idx, * If you suspect bug in this function, compare it with this simple * memmove implementation. */ - fb_memmove((char *)dst + ((dst_idx & (bits - 1))) / 8, - (char *)src + ((src_idx & (bits - 1))) / 8, n / 8); + memmove((char *)dst + ((dst_idx & (bits - 1))) / 8, + (char *)src + ((src_idx & (bits - 1))) / 8, n / 8); return; #endif @@ -324,7 +324,10 @@ bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, unsigned dst_idx, d0 = d0 << left | d1 >> right; } d0 = fb_rev_pixels_in_long(d0, bswapmask); - FB_WRITEL(comp(d0, FB_READL(dst), first), dst); + if (!first) + FB_WRITEL(d0, dst); + else + FB_WRITEL(comp(d0, FB_READL(dst), first), dst); d0 = d1; dst--; n -= dst_idx+1; -- cgit v1.2.3-70-g09d2 From a00d91ea264f974b3d57babce143ba157921629a Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 23 Sep 2014 14:21:58 +0200 Subject: fbdev: sh_mobile_hdmi: Re-init regs before irq re-enable on resume When the PM domain containing the HDMI hardware block is powered down, the HDMI register values (incl. interrupt polarity settings) are lost. During resume, after powering up the PM domain, interrupts are re-enabled, and an interrupt storm happens due to incorrect interrupt polarity settings: irq 163: nobody cared (try booting with the "irqpoll" option) ... Disabling IRQ #163 To fix this, re-initialize the interrupt polarity settings, and the htop1 register block (if present), during resume. As the .suspend_noirq() and .resume_noirq() callbacks are not called when using the generic PM domain, the normal .resume() callback is used, and the device interrupt needs to be disabled/enabled manually. This fixes resume from s2ram with power down of the A4MP PM domain on r8a7740/Armadillo. Signed-off-by: Geert Uytterhoeven Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/sh_mobile_hdmi.c | 44 ++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_hdmi.c b/drivers/video/fbdev/sh_mobile_hdmi.c index 9a33ee0413fb..7c72a3f02056 100644 --- a/drivers/video/fbdev/sh_mobile_hdmi.c +++ b/drivers/video/fbdev/sh_mobile_hdmi.c @@ -281,6 +281,7 @@ struct sh_hdmi { u8 edid_block_addr; u8 edid_segment_nr; u8 edid_blocks; + int irq; struct clk *hdmi_clk; struct device *dev; struct delayed_work edid_work; @@ -1299,6 +1300,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) hdmi->dev = &pdev->dev; hdmi->entity.owner = THIS_MODULE; hdmi->entity.ops = &sh_hdmi_ops; + hdmi->irq = irq; hdmi->hdmi_clk = clk_get(&pdev->dev, "ick"); if (IS_ERR(hdmi->hdmi_clk)) { @@ -1415,12 +1417,11 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev) { struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev)); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - int irq = platform_get_irq(pdev, 0); snd_soc_unregister_codec(&pdev->dev); /* No new work will be scheduled, wait for running ISR */ - free_irq(irq, hdmi); + free_irq(hdmi->irq, hdmi); /* Wait for already scheduled work */ cancel_delayed_work_sync(&hdmi->edid_work); pm_runtime_put(&pdev->dev); @@ -1435,10 +1436,49 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev) return 0; } +static int sh_hdmi_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev)); + + disable_irq(hdmi->irq); + /* Wait for already scheduled work */ + cancel_delayed_work_sync(&hdmi->edid_work); + return 0; +} + +static int sh_hdmi_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct sh_mobile_hdmi_info *pdata = dev_get_platdata(dev); + struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev)); + + /* Re-init interrupt polarity */ + if (pdata->flags & HDMI_OUTPUT_PUSH_PULL) + hdmi_bit_set(hdmi, 0x02, 0x02, HDMI_SYSTEM_CTRL); + + if (pdata->flags & HDMI_OUTPUT_POLARITY_HI) + hdmi_bit_set(hdmi, 0x01, 0x01, HDMI_SYSTEM_CTRL); + + /* Re-init htop1 */ + if (hdmi->htop1) + sh_hdmi_htop1_init(hdmi); + + /* Now it's safe to enable interrupts again */ + enable_irq(hdmi->irq); + return 0; +} + +static const struct dev_pm_ops sh_hdmi_pm_ops = { + .suspend = sh_hdmi_suspend, + .resume = sh_hdmi_resume, +}; + static struct platform_driver sh_hdmi_driver = { .remove = __exit_p(sh_hdmi_remove), .driver = { .name = "sh-mobile-hdmi", + .pm = &sh_hdmi_pm_ops, }, }; -- cgit v1.2.3-70-g09d2 From 2d605456431343886bc073ea126aeb7c64e07a57 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Tue, 15 Jul 2014 14:33:25 +0200 Subject: video/atmel_lcdfb: Introduce regulator support This adds regulator support to enable/disable the LCD voltage, using 'lcd-supply' as regulator name. Signed-off-by: Alexander Stein Signed-off-by: Tomi Valkeinen --- .../devicetree/bindings/video/atmel,lcdc.txt | 3 +++ drivers/video/fbdev/atmel_lcdfb.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Documentation/devicetree/bindings/video/atmel,lcdc.txt b/Documentation/devicetree/bindings/video/atmel,lcdc.txt index b75af94a5e52..b37be4fc14e7 100644 --- a/Documentation/devicetree/bindings/video/atmel,lcdc.txt +++ b/Documentation/devicetree/bindings/video/atmel,lcdc.txt @@ -20,6 +20,9 @@ Required nodes: - default-mode: a videomode within the display with timing parameters as specified below. +Optional properties: +- lcd-supply: Regulator for LCD supply voltage. + Example: fb0: fb@0x00500000 { diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index 92640d46770a..10d038029d67 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c @@ -24,6 +24,7 @@ #include #include #include