History

Merge tag 'for-5.18/fbdev-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev

Pull fbdev updates from Helge Deller: "Lots of small fixes and code cleanups across most of the fbdev drivers. This includes conversions to use helper functions, const conversions, spelling fixes, help text updates, adding return value checks, small build fixes, and much more" * tag 'for-5.18/fbdev-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: (59 commits) video: fbdev: kyro: make read-only array ODValues static const video: fbdev: offb: fix warning comparing pointer to 0 video: fbdev: omapfb: Add missing of_node_put() in dvic_probe_of video: fbdev: sm712fb: Fix crash in smtcfb_write() video: fbdev: s3c-fb: fix platform_get_irq.cocci warning video: fbdev: sm712fb: Fix crash in smtcfb_read() video: fbdev: via: check the return value of kstrdup() video: fbdev: au1100fb: Spelling s/palette/palette/ video: fbdev: atari: Atari 2 bpp (STe) palette bugfix video: fbdev: atari: Remove unused atafb_setcolreg() video: fbdev: atari: Convert to standard round_up() helper video: fbdev: atari: Fix TT High video mode video: fbdev: udlfb: replace snprintf in show functions with sysfs_emit video: fbdev: omapfb: panel-tpo-td043mtea1: Use sysfs_emit() instead of snprintf() video: fbdev: omapfb: panel-dsi-cm: Use sysfs_emit() instead of snprintf() video: fbdev: omapfb: Use sysfs_emit() instead of snprintf() video: fbdev: s3c-fb: Use platform_get_irq() to get the interrupt video: fbdev: Fix wrong file path for pvr2fb.c in Kconfig help text video: fbdev: pxa3xx-gcu: Remove unnecessary print function dev_err() video: fbdev: pxa168fb: Remove unnecessary print function dev_err() ...

Linus Torvalds committed 4 years ago

Commit 9c4b86e2 parents 5bebe2c e445c8b54 files · +189 −233Browse files

Unified · Split

54 files
  1. Documentation/devicetree/bindings/display/simple-framebuffer.yaml +7 −5
  2. arch/parisc/include/asm/agp.h +2 −2
  3. arch/powerpc/include/asm/agp.h +2 −2
  4. arch/sparc/include/asm/agp.h +3 −3
  5. drivers/video/backlight/lm3630a_bl.c +0 −1
  6. drivers/video/backlight/qcom-wled.c +1 −0
  7. drivers/video/fbdev/Kconfig +1 −1
  8. drivers/video/fbdev/asiliantfb.c +1 −1
  9. drivers/video/fbdev/atafb.c +11 −24
  10. drivers/video/fbdev/atmel_lcdfb.c +6 −5
  11. drivers/video/fbdev/aty/aty128fb.c +6 −4
  12. drivers/video/fbdev/aty/mach64_ct.c +1 −3
  13. drivers/video/fbdev/aty/mach64_gx.c +0 −2
  14. drivers/video/fbdev/au1100fb.c +1 −1
  15. drivers/video/fbdev/au1100fb.h +1 −1
  16. drivers/video/fbdev/au1200fb.c +2 −2
  17. drivers/video/fbdev/cirrusfb.c +8 −8
  18. drivers/video/fbdev/controlfb.c +2 −0
  19. drivers/video/fbdev/core/fbcvt.c +21 −32
  20. drivers/video/fbdev/core/fbmem.c +2 −6
  21. drivers/video/fbdev/da8xx-fb.c +3 −4
  22. drivers/video/fbdev/imxfb.c +2 −0
  23. drivers/video/fbdev/kyro/STG4000InitDevice.c +1 −1
  24. drivers/video/fbdev/matrox/matroxfb_base.c +1 −1
  25. drivers/video/fbdev/mb862xx/mb862xxfb_accel.c +1 −1
  26. drivers/video/fbdev/mmp/hw/mmp_ctrl.c +2 −1
  27. drivers/video/fbdev/nvidia/nv_i2c.c +1 −1
  28. drivers/video/fbdev/ocfb.c +1 −1
  29. drivers/video/fbdev/offb.c +1 −1
  30. drivers/video/fbdev/omap/lcd_ams_delta.c +6 −10
  31. drivers/video/fbdev/omap/omapfb_main.c +7 −6
  32. drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c +1 −0
  33. drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +4 −4
  34. drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c +3 −4
  35. drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c +3 −4
  36. drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c +1 −1
  37. drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c +3 −4
  38. drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c +2 −1
  39. drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c +2 −1
  40. drivers/video/fbdev/omap2/omapfb/dss/overlay-sysfs.c +2 −1
  41. drivers/video/fbdev/omap2/omapfb/omapfb-main.c +0 −1
  42. drivers/video/fbdev/pxa168fb.c +6 −9
  43. drivers/video/fbdev/pxa3xx-gcu.c +3 −7
  44. drivers/video/fbdev/s3c-fb.c +8 −12
  45. drivers/video/fbdev/savage/savagefb.h +0 −1
  46. drivers/video/fbdev/savage/savagefb_driver.c +4 −3
  47. drivers/video/fbdev/sis/sis_main.c +1 −1
  48. drivers/video/fbdev/sm712fb.c +11 −35
  49. drivers/video/fbdev/smscufx.c +1 −2
  50. drivers/video/fbdev/ssd1307fb.c +3 −4
  51. drivers/video/fbdev/udlfb.c +4 −4
  52. drivers/video/fbdev/via/lcd.c +1 −1
  53. drivers/video/fbdev/via/viafbdev.c +10 −0
  54. drivers/video/fbdev/w100fb.c +12 −3
Documentation/devicetree/bindings/display/simple-framebuffer.yaml+7−5
@@ -52,11 +52,13 @@ description: |+ · 51 unmodified lines
5252
5353 properties:
5454 compatible:
55− items:
56− - enum:
57− - apple,simple-framebuffer
58− - allwinner,simple-framebuffer
59− - amlogic,simple-framebuffer
55+ oneOf:
56+ - items:
57+ - enum:
58+ - apple,simple-framebuffer
59+ - allwinner,simple-framebuffer
60+ - amlogic,simple-framebuffer
61+ - const: simple-framebuffer
6062 - const: simple-framebuffer
6163
6264 reg:
arch/parisc/include/asm/agp.h+2−2
@@ -8,8 +8,8 @@ · 7 unmodified lines
88 *
99 */
1010
11−#define map_page_into_agp(page) /* nothing */
12−#define unmap_page_from_agp(page) /* nothing */
11+#define map_page_into_agp(page) do { } while (0)
12+#define unmap_page_from_agp(page) do { } while (0)
1313 #define flush_agp_cache() mb()
1414
1515 /* GATT allocation. Returns/accepts GATT kernel virtual address. */
arch/powerpc/include/asm/agp.h+2−2
@@ -5,8 +5,8 @@ · 4 unmodified lines
55
66 #include <asm/io.h>
77
8−#define map_page_into_agp(page)
9−#define unmap_page_from_agp(page)
8+#define map_page_into_agp(page) do {} while (0)
9+#define unmap_page_from_agp(page) do {} while (0)
1010 #define flush_agp_cache() mb()
1111
1212 /* GATT allocation. Returns/accepts GATT kernel virtual address. */
arch/sparc/include/asm/agp.h+3−3
@@ -4,9 +4,9 @@ · 3 unmodified lines
44
55 /* dummy for now */
66
7−#define map_page_into_agp(page)
8−#define unmap_page_from_agp(page)
9−#define flush_agp_cache() mb()
7+#define map_page_into_agp(page) do { } while (0)
8+#define unmap_page_from_agp(page) do { } while (0)
9+#define flush_agp_cache() mb()
1010
1111 /* GATT allocation. Returns/accepts GATT kernel virtual address. */
1212 #define alloc_gatt_pages(order) \
drivers/video/backlight/lm3630a_bl.c+0−1
@@ -594,7 +594,6 @@ static int lm3630a_remove(struct i2c_client *client) · 593 unmodified lines
594594
595595 if (pchip->irq) {
596596 free_irq(pchip->irq, pchip);
597− flush_workqueue(pchip->irqthread);
598597 destroy_workqueue(pchip->irqthread);
599598 }
600599 return 0;
drivers/video/backlight/qcom-wled.c+1−0
@@ -1734,6 +1734,7 @@ static const struct of_device_id wled_match_table[] = { · 1733 unmodified lines
17341734 { .compatible = "qcom,pmi8994-wled", .data = (void *)4 },
17351735 { .compatible = "qcom,pmi8998-wled", .data = (void *)4 },
17361736 { .compatible = "qcom,pm660l-wled", .data = (void *)4 },
1737+ { .compatible = "qcom,pm6150l-wled", .data = (void *)5 },
17371738 { .compatible = "qcom,pm8150l-wled", .data = (void *)5 },
17381739 {}
17391740 };
drivers/video/fbdev/Kconfig+1−1
@@ -829,7 +829,7 @@ config FB_PVR2 · 828 unmodified lines
829829 You can pass several parameters to the driver at boot time or at
830830 module load time. The parameters look like "video=pvr2:XXX", where
831831 the meaning of XXX can be found at the end of the main source file
832− (<file:drivers/video/pvr2fb.c>). Please see the file
832+ (<file:drivers/video/fbdev/pvr2fb.c>). Please see the file
833833 <file:Documentation/fb/pvr2fb.rst>.
834834
835835 config FB_OPENCORES
drivers/video/fbdev/asiliantfb.c+1−1
@@ -110,7 +110,7 @@ static const struct fb_ops asiliantfb_ops = { · 109 unmodified lines
110110 static void asiliant_calc_dclk2(u32 *ppixclock, u8 *dclk2_m, u8 *dclk2_n, u8 *dclk2_div)
111111 {
112112 unsigned pixclock = *ppixclock;
113− unsigned Ftarget = 1000000 * (1000000 / pixclock);
113+ unsigned Ftarget;
114114 unsigned n;
115115 unsigned best_error = 0xffffffff;
116116 unsigned best_m = 0xffffffff,
drivers/video/fbdev/atafb.c+11−24
@@ -76,8 +76,6 @@ · 75 unmodified lines
7676 #define SWITCH_SND7 0x80
7777 #define SWITCH_NONE 0x00
7878
79−#define up(x, r) (((x) + (r) - 1) & ~((r)-1))
80−
8179
8280 static int default_par; /* default resolution (0=none) */
8381
@@ -487,8 +485,8 @@ static struct fb_videomode atafb_modedb[] __initdata = { · 403 unmodified lines
487485 "tt-mid", 60, 640, 480, 31041, 120, 100, 8, 16, 140, 30,
488486 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
489487 }, {
490− /* 1280x960, 29 kHz, 60 Hz (TT high) */
491− "tt-high", 57, 640, 960, 31041, 120, 100, 8, 16, 140, 30,
488+ /* 1280x960, 72 kHz, 72 Hz (TT high) */
489+ "tt-high", 57, 1280, 960, 7760, 260, 60, 36, 4, 192, 4,
492490 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
493491 },
494492
@@ -1649,12 +1647,12 @@ static int falcon_pan_display(struct fb_var_screeninfo *var, · 1154 unmodified lines
16491647 int bpp = info->var.bits_per_pixel;
16501648
16511649 if (bpp == 1)
1652− var->xoffset = up(var->xoffset, 32);
1650+ var->xoffset = round_up(var->xoffset, 32);
16531651 if (bpp != 16)
16541652 par->hw.falcon.xoffset = var->xoffset & 15;
16551653 else {
16561654 par->hw.falcon.xoffset = 0;
1657− var->xoffset = up(var->xoffset, 2);
1655+ var->xoffset = round_up(var->xoffset, 2);
16581656 }
16591657 par->hw.falcon.line_offset = bpp *
16601658 (info->var.xres_virtual - info->var.xres) / 16;
@@ -1683,9 +1681,9 @@ static int falcon_setcolreg(unsigned int regno, unsigned int red, · 22 unmodified lines
16831681 ((blue & 0xfc00) >> 8));
16841682 if (regno < 16) {
16851683 shifter_tt.color_reg[regno] =
1686− (((red & 0xe000) >> 13) | ((red & 0x1000) >> 12) << 8) |
1687− (((green & 0xe000) >> 13) | ((green & 0x1000) >> 12) << 4) |
1688− ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12);
1684+ ((((red & 0xe000) >> 13) | ((red & 0x1000) >> 12)) << 8) |
1685+ ((((green & 0xe000) >> 13) | ((green & 0x1000) >> 12)) << 4) |
1686+ ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12);
16891687 ((u32 *)info->pseudo_palette)[regno] = ((red & 0xf800) |
16901688 ((green & 0xfc00) >> 5) |
16911689 ((blue & 0xf800) >> 11));
@@ -1971,9 +1969,9 @@ static int stste_setcolreg(unsigned int regno, unsigned int red, · 279 unmodified lines
19711969 green >>= 12;
19721970 if (ATARIHW_PRESENT(EXTD_SHIFTER))
19731971 shifter_tt.color_reg[regno] =
1974− (((red & 0xe) >> 1) | ((red & 1) << 3) << 8) |
1975− (((green & 0xe) >> 1) | ((green & 1) << 3) << 4) |
1976− ((blue & 0xe) >> 1) | ((blue & 1) << 3);
1972+ ((((red & 0xe) >> 1) | ((red & 1) << 3)) << 8) |
1973+ ((((green & 0xe) >> 1) | ((green & 1) << 3)) << 4) |
1974+ ((blue & 0xe) >> 1) | ((blue & 1) << 3);
19771975 else
19781976 shifter_tt.color_reg[regno] =
19791977 ((red & 0xe) << 7) |
@@ -2268,7 +2266,7 @@ static int pan_display(struct fb_var_screeninfo *var, struct fb_info *info) · 288 unmodified lines
22682266 if (!fbhw->set_screen_base ||
22692267 (!ATARIHW_PRESENT(EXTD_SHIFTER) && var->xoffset))
22702268 return -EINVAL;
2271− var->xoffset = up(var->xoffset, 16);
2269+ var->xoffset = round_up(var->xoffset, 16);
22722270 par->screen_base = screen_base +
22732271 (var->yoffset * info->var.xres_virtual + var->xoffset)
22742272 * info->var.bits_per_pixel / 8;
@@ -2406,16 +2404,6 @@ static void atafb_set_disp(struct fb_info *info) · 131 unmodified lines
24062404 atari_stram_to_virt(info->fix.smem_start));
24072405 }
24082406
2409−static int atafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
2410− u_int transp, struct fb_info *info)
2411−{
2412− red >>= 8;
2413− green >>= 8;
2414− blue >>= 8;
2415−
2416− return info->fbops->fb_setcolreg(regno, red, green, blue, transp, info);
2417−}
2418−
24192407 static int
24202408 atafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
24212409 {
@@ -2726,7 +2714,6 @@ static struct fb_ops atafb_ops = { · 304 unmodified lines
27262714 .owner = THIS_MODULE,
27272715 .fb_check_var = atafb_check_var,
27282716 .fb_set_par = atafb_set_par,
2729− .fb_setcolreg = atafb_setcolreg,
27302717 .fb_blank = atafb_blank,
27312718 .fb_pan_display = atafb_pan_display,
27322719 .fb_fillrect = atafb_fillrect,
drivers/video/fbdev/atmel_lcdfb.c+6−5
@@ -1062,15 +1062,16 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) · 1061 unmodified lines
10621062
10631063 INIT_LIST_HEAD(&info->modelist);
10641064
1065− if (pdev->dev.of_node) {
1066− ret = atmel_lcdfb_of_init(sinfo);
1067− if (ret)
1068− goto free_info;
1069− } else {
1065+ if (!pdev->dev.of_node) {
10701066 dev_err(dev, "cannot get default configuration\n");
10711067 goto free_info;
10721068 }
10731069
1070+ ret = atmel_lcdfb_of_init(sinfo);
1071+ if (ret)
1072+ goto free_info;
1073+
1074+ ret = -ENODEV;
10741075 if (!sinfo->config)
10751076 goto free_info;
10761077
drivers/video/fbdev/aty/aty128fb.c+6−4
@@ -952,7 +952,7 @@ static void aty128_timings(struct aty128fb_par *par) · 951 unmodified lines
952952 u32 x_mpll_ref_fb_div;
953953 u32 xclk_cntl;
954954 u32 Nx, M;
955− unsigned PostDivSet[] = { 0, 1, 2, 4, 8, 3, 6, 12 };
955+ static const unsigned int PostDivSet[] = { 0, 1, 2, 4, 8, 3, 6, 12 };
956956 #endif
957957
958958 if (!par->constants.ref_clk)
@@ -1321,8 +1321,10 @@ static void aty128_set_pll(struct aty128_pll *pll, · 362 unmodified lines
13211321 {
13221322 u32 div3;
13231323
1324− unsigned char post_conv[] = /* register values for post dividers */
1325− { 2, 0, 1, 4, 2, 2, 6, 2, 3, 2, 2, 2, 7 };
1324+ /* register values for post dividers */
1325+ static const unsigned char post_conv[] = {
1326+ 2, 0, 1, 4, 2, 2, 6, 2, 3, 2, 2, 2, 7
1327+ };
13261328
13271329 /* select PPLL_DIV_3 */
13281330 aty_st_le32(CLOCK_CNTL_INDEX, aty_ld_le32(CLOCK_CNTL_INDEX) | (3 << 8));
@@ -1360,7 +1362,7 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll, · 31 unmodified lines
13601362 const struct aty128fb_par *par)
13611363 {
13621364 const struct aty128_constants c = par->constants;
1363− unsigned char post_dividers[] = {1,2,4,8,3,6,12};
1365+ static const unsigned char post_dividers[] = { 1, 2, 4, 8, 3, 6, 12 };
13641366 u32 output_freq;
13651367 u32 vclk; /* in .01 MHz */
13661368 int i = 0;
drivers/video/fbdev/aty/mach64_ct.c+1−3
@@ -22,13 +22,11 @@ static u32 aty_pll_to_var_ct(const struct fb_info *info, const union aty_pll *pl · 21 unmodified lines
2222
2323 u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par)
2424 {
25− u8 res;
2625
2726 /* write addr byte */
2827 aty_st_8(CLOCK_CNTL_ADDR, (offset << 2) & PLL_ADDR, par);
2928 /* read the register value */
30− res = aty_ld_8(CLOCK_CNTL_DATA, par);
31− return res;
29+ return aty_ld_8(CLOCK_CNTL_DATA, par);
3230 }
3331
3432 static void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par)
drivers/video/fbdev/aty/mach64_gx.c+0−2
@@ -352,10 +352,8 @@ static int aty_var_to_pll_18818(const struct fb_info *info, u32 vclk_per, · 351 unmodified lines
352352 post_divider = 1;
353353
354354 if (MHz100 > MAX_FREQ_2595) {
355− MHz100 = MAX_FREQ_2595;
356355 return -EINVAL;
357356 } else if (MHz100 < ABS_MIN_FREQ_2595) {
358− program_bits = 0; /* MHz100 = 257 */
359357 return -EINVAL;
360358 } else {
361359 while (MHz100 < MIN_FREQ_2595) {
drivers/video/fbdev/au1100fb.c+1−1
@@ -239,7 +239,7 @@ int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned · 238 unmodified lines
239239 u32 value;
240240
241241 fbdev = to_au1100fb_device(fbi);
242− palette = fbdev->regs->lcd_pallettebase;
242+ palette = fbdev->regs->lcd_palettebase;
243243
244244 if (regno > (AU1100_LCD_NBR_PALETTE_ENTRIES - 1))
245245 return -EINVAL;
drivers/video/fbdev/au1100fb.h+1−1
@@ -92,7 +92,7 @@ struct au1100fb_regs · 91 unmodified lines
9292 u32 lcd_pwmdiv;
9393 u32 lcd_pwmhi;
9494 u32 reserved[(0x0400-0x002C)/4];
95− u32 lcd_pallettebase[256];
95+ u32 lcd_palettebase[256];
9696 };
9797
9898 struct au1100fb_device {
drivers/video/fbdev/au1200fb.c+2−2
@@ -1233,8 +1233,8 @@ static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) · 1232 unmodified lines
12331233 {
12341234 struct au1200fb_device *fbdev = info->par;
12351235
1236− return dma_mmap_attrs(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys,
1237− fbdev->fb_len, 0);
1236+ return dma_mmap_coherent(fbdev->dev, vma,
1237+ fbdev->fb_mem, fbdev->fb_phys, fbdev->fb_len);
12381238 }
12391239
12401240 static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)
drivers/video/fbdev/cirrusfb.c+8−8
@@ -469,7 +469,7 @@ static int cirrusfb_check_mclk(struct fb_info *info, long freq) · 468 unmodified lines
469469 return 0;
470470 }
471471
472−static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var,
472+static int cirrusfb_check_pixclock(struct fb_var_screeninfo *var,
473473 struct fb_info *info)
474474 {
475475 long freq;
@@ -478,9 +478,7 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, · 2 unmodified lines
478478 unsigned maxclockidx = var->bits_per_pixel >> 3;
479479
480480 /* convert from ps to kHz */
481− freq = PICOS2KHZ(var->pixclock);
482−
483− dev_dbg(info->device, "desired pixclock: %ld kHz\n", freq);
481+ freq = PICOS2KHZ(var->pixclock ? : 1);
484482
485483 maxclock = cirrusfb_board_info[cinfo->btype].maxclock[maxclockidx];
486484 cinfo->multiplexing = 0;
@@ -488,11 +486,13 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, · 1 unmodified line
488486 /* If the frequency is greater than we can support, we might be able
489487 * to use multiplexing for the video mode */
490488 if (freq > maxclock) {
491− dev_err(info->device,
492− "Frequency greater than maxclock (%ld kHz)\n",
493− maxclock);
494− return -EINVAL;
489+ var->pixclock = KHZ2PICOS(maxclock);
490+
491+ while ((freq = PICOS2KHZ(var->pixclock)) > maxclock)
492+ var->pixclock++;
495493 }
494+ dev_dbg(info->device, "desired pixclock: %ld kHz\n", freq);
495+
496496 /*
497497 * Additional constraint: 8bpp uses DAC clock doubling to allow maximum
498498 * pixel clock
drivers/video/fbdev/controlfb.c+2−0
@@ -67,7 +67,9 @@ · 66 unmodified lines
6767 #define out_8(addr, val) (void)(val)
6868 #define in_le32(addr) 0
6969 #define out_le32(addr, val) (void)(val)
70+#ifndef pgprot_cached_wthru
7071 #define pgprot_cached_wthru(prot) (prot)
72+#endif
7173 #else
7274 static void invalid_vram_cache(void __force *addr)
7375 {
drivers/video/fbdev/core/fbcvt.c+21−32
@@ -214,9 +214,11 @@ static u32 fb_cvt_aspect_ratio(struct fb_cvt_data *cvt) · 213 unmodified lines
214214 static void fb_cvt_print_name(struct fb_cvt_data *cvt)
215215 {
216216 u32 pixcount, pixcount_mod;
217− int cnt = 255, offset = 0, read = 0;
218− u8 *buf = kzalloc(256, GFP_KERNEL);
217+ int size = 256;
218+ int off = 0;
219+ u8 *buf;
219220
221+ buf = kzalloc(size, GFP_KERNEL);
220222 if (!buf)
221223 return;
222224
@@ -224,43 +226,30 @@ static void fb_cvt_print_name(struct fb_cvt_data *cvt) · 1 unmodified line
224226 pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000;
225227 pixcount_mod /= 1000;
226228
227− read = snprintf(buf+offset, cnt, "fbcvt: %dx%d@%d: CVT Name - ",
228− cvt->xres, cvt->yres, cvt->refresh);
229− offset += read;
230− cnt -= read;
229+ off += scnprintf(buf + off, size - off, "fbcvt: %dx%d@%d: CVT Name - ",
230+ cvt->xres, cvt->yres, cvt->refresh);
231231
232− if (cvt->status)
233− snprintf(buf+offset, cnt, "Not a CVT standard - %d.%03d Mega "
234− "Pixel Image\n", pixcount, pixcount_mod);
235− else {
236− if (pixcount) {
237− read = snprintf(buf+offset, cnt, "%d", pixcount);
238− cnt -= read;
239− offset += read;
240− }
232+ if (cvt->status) {
233+ off += scnprintf(buf + off, size - off,
234+ "Not a CVT standard - %d.%03d Mega Pixel Image\n",
235+ pixcount, pixcount_mod);
236+ } else {
237+ if (pixcount)
238+ off += scnprintf(buf + off, size - off, "%d", pixcount);
241239
242− read = snprintf(buf+offset, cnt, ".%03dM", pixcount_mod);
243− cnt -= read;
244− offset += read;
240+ off += scnprintf(buf + off, size - off, ".%03dM", pixcount_mod);
245241
246242 if (cvt->aspect_ratio == 0)
247− read = snprintf(buf+offset, cnt, "3");
243+ off += scnprintf(buf + off, size - off, "3");
248244 else if (cvt->aspect_ratio == 3)
249− read = snprintf(buf+offset, cnt, "4");
245+ off += scnprintf(buf + off, size - off, "4");
250246 else if (cvt->aspect_ratio == 1 || cvt->aspect_ratio == 4)
251− read = snprintf(buf+offset, cnt, "9");
247+ off += scnprintf(buf + off, size - off, "9");
252248 else if (cvt->aspect_ratio == 2)
253− read = snprintf(buf+offset, cnt, "A");
254− else
255− read = 0;
256− cnt -= read;
257− offset += read;
258−
259− if (cvt->flags & FB_CVT_FLAG_REDUCED_BLANK) {
260− read = snprintf(buf+offset, cnt, "-R");
261− cnt -= read;
262− offset += read;
263− }
249+ off += scnprintf(buf + off, size - off, "A");
250+
251+ if (cvt->flags & FB_CVT_FLAG_REDUCED_BLANK)
252+ off += scnprintf(buf + off, size - off, "-R");
264253 }
265254
266255 printk(KERN_INFO "%s\n", buf);
drivers/video/fbdev/core/fbmem.c+2−6
@@ -396,18 +396,14 @@ static void fb_rotate_logo(struct fb_info *info, u8 *dst, · 395 unmodified lines
396396 } else if (rotate == FB_ROTATE_CW) {
397397 fb_rotate_logo_cw(image->data, dst, image->width,
398398 image->height);
399− tmp = image->width;
400− image->width = image->height;
401− image->height = tmp;
399+ swap(image->width, image->height);
402400 tmp = image->dy;
403401 image->dy = image->dx;
404402 image->dx = info->var.xres - image->width - tmp;
405403 } else if (rotate == FB_ROTATE_CCW) {
406404 fb_rotate_logo_ccw(image->data, dst, image->width,
407405 image->height);
408− tmp = image->width;
409− image->width = image->height;
410− image->height = tmp;
406+ swap(image->width, image->height);
411407 tmp = image->dx;
412408 image->dx = image->dy;
413409 image->dy = info->var.yres - image->height - tmp;
drivers/video/fbdev/da8xx-fb.c+3−4
@@ -1354,10 +1354,9 @@ static int fb_probe(struct platform_device *device) · 1353 unmodified lines
13541354 return PTR_ERR(da8xx_fb_reg_base);
13551355
13561356 tmp_lcdc_clk = devm_clk_get(&device->dev, "fck");
1357− if (IS_ERR(tmp_lcdc_clk)) {
1358− dev_err(&device->dev, "Can not get device clock\n");
1359− return PTR_ERR(tmp_lcdc_clk);
1360− }
1357+ if (IS_ERR(tmp_lcdc_clk))
1358+ return dev_err_probe(&device->dev, PTR_ERR(tmp_lcdc_clk),
1359+ "Can not get device clock\n");
13611360
13621361 pm_runtime_enable(&device->dev);
13631362 pm_runtime_get_sync(&device->dev);
drivers/video/fbdev/imxfb.c+2−0
@@ -1083,6 +1083,8 @@ static int imxfb_remove(struct platform_device *pdev) · 1082 unmodified lines
10831083 struct resource *res;
10841084
10851085 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1086+ if (!res)
1087+ return -EINVAL;
10861088
10871089 imxfb_disable_controller(fbi);
10881090
drivers/video/fbdev/kyro/STG4000InitDevice.c+1−1
@@ -124,7 +124,7 @@ u32 ProgramClock(u32 refClock, · 123 unmodified lines
124124 u32 ulScore, ulPhaseScore, ulVcoScore;
125125 u32 ulTmp = 0, ulVCO;
126126 u32 ulScaleClockReq, ulMinClock, ulMaxClock;
127− u32 ODValues[] = { 1, 2, 0 };
127+ static const unsigned char ODValues[] = { 1, 2, 0 };
128128
129129 /* Translate clock in Hz */
130130 coreClock *= 100; /* in Hz */
drivers/video/fbdev/matrox/matroxfb_base.c+1−1
@@ -1377,7 +1377,7 @@ static struct video_board vbG200 = { · 1376 unmodified lines
13771377 .lowlevel = &matrox_G100
13781378 };
13791379 static struct video_board vbG200eW = {
1380− .maxvram = 0x800000,
1380+ .maxvram = 0x100000,
13811381 .maxdisplayable = 0x800000,
13821382 .accelID = FB_ACCEL_MATROX_MGAG200,
13831383 .lowlevel = &matrox_G100
drivers/video/fbdev/mb862xx/mb862xxfb_accel.c+1−1
@@ -132,7 +132,7 @@ static void mb86290fb_imageblit8(u32 *cmd, u16 step, u16 dx, u16 dy, · 131 unmodified lines
132132 cmd[2] = (height << 16) | width;
133133
134134 i = 0;
135− line = ptr = image->data;
135+ line = image->data;
136136 bytes = image->width;
137137
138138 while (i < height) {
drivers/video/fbdev/mmp/hw/mmp_ctrl.c+2−1
@@ -514,7 +514,8 @@ static int mmphw_probe(struct platform_device *pdev) · 513 unmodified lines
514514 /* get clock */
515515 ctrl->clk = devm_clk_get(ctrl->dev, mi->clk_name);
516516 if (IS_ERR(ctrl->clk)) {
517− dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name);
517+ dev_err_probe(ctrl->dev, ret,
518+ "unable to get clk %s\n", mi->clk_name);
518519 ret = -ENOENT;
519520 goto failed;
520521 }
drivers/video/fbdev/nvidia/nv_i2c.c+1−1
@@ -86,7 +86,7 @@ static int nvidia_setup_i2c_bus(struct nvidia_i2c_chan *chan, const char *name, · 85 unmodified lines
8686 {
8787 int rc;
8888
89− strcpy(chan->adapter.name, name);
89+ strscpy(chan->adapter.name, name, sizeof(chan->adapter.name));
9090 chan->adapter.owner = THIS_MODULE;
9191 chan->adapter.class = i2c_class;
9292 chan->adapter.algo_data = &chan->algo;
drivers/video/fbdev/ocfb.c+1−1
@@ -387,7 +387,7 @@ static int ocfb_remove(struct platform_device *pdev) · 386 unmodified lines
387387 return 0;
388388 }
389389
390−static struct of_device_id ocfb_match[] = {
390+static const struct of_device_id ocfb_match[] = {
391391 { .compatible = "opencores,ocfb", },
392392 {},
393393 };
drivers/video/fbdev/offb.c+1−1
@@ -412,7 +412,7 @@ static void __init offb_init_fb(const char *name, · 411 unmodified lines
412412
413413 info = framebuffer_alloc(sizeof(u32) * 16, NULL);
414414
415− if (info == 0) {
415+ if (!info) {
416416 release_mem_region(res_start, res_size);
417417 return;
418418 }
drivers/video/fbdev/omap/lcd_ams_delta.c+6−10
@@ -131,18 +131,14 @@ static int ams_delta_panel_probe(struct platform_device *pdev) · 130 unmodified lines
131131 int ret;
132132
133133 gpiod_vblen = devm_gpiod_get(&pdev->dev, "vblen", GPIOD_OUT_LOW);
134− if (IS_ERR(gpiod_vblen)) {
135− ret = PTR_ERR(gpiod_vblen);
136− dev_err(&pdev->dev, "VBLEN GPIO request failed (%d)\n", ret);
137− return ret;
138− }
134+ if (IS_ERR(gpiod_vblen))
135+ return dev_err_probe(&pdev->dev, PTR_ERR(gpiod_vblen),
136+ "VBLEN GPIO request failed\n");
139137
140138 gpiod_ndisp = devm_gpiod_get(&pdev->dev, "ndisp", GPIOD_OUT_LOW);
141− if (IS_ERR(gpiod_ndisp)) {
142− ret = PTR_ERR(gpiod_ndisp);
143− dev_err(&pdev->dev, "NDISP GPIO request failed (%d)\n", ret);
144− return ret;
145− }
139+ if (IS_ERR(gpiod_ndisp))
140+ return dev_err_probe(&pdev->dev, PTR_ERR(gpiod_ndisp),
141+ "NDISP GPIO request failed\n");
146142
147143 #ifdef CONFIG_LCD_CLASS_DEVICE
148144 lcd_device = lcd_device_register("omapfb", &pdev->dev, NULL,
drivers/video/fbdev/omap/omapfb_main.c+7−6
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/slab.h>
1717 #include <linux/uaccess.h>
1818 #include <linux/module.h>
19+#include <linux/sysfs.h>
1920
2021 #include <linux/omap-dma.h>
2122
@@ -1303,7 +1304,7 @@ static ssize_t omapfb_show_panel_name(struct device *dev, · 1281 unmodified lines
13031304 {
13041305 struct omapfb_device *fbdev = dev_get_drvdata(dev);
13051306
1306− return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name);
1307+ return sysfs_emit(buf, "%s\n", fbdev->panel->name);
13071308 }
13081309
13091310 static ssize_t omapfb_show_bklight_level(struct device *dev,
@@ -1314,8 +1315,8 @@ static ssize_t omapfb_show_bklight_level(struct device *dev, · 4 unmodified lines
13141315 int r;
13151316
13161317 if (fbdev->panel->get_bklight_level) {
1317− r = snprintf(buf, PAGE_SIZE, "%d\n",
1318− fbdev->panel->get_bklight_level(fbdev->panel));
1318+ r = sysfs_emit(buf, "%d\n",
1319+ fbdev->panel->get_bklight_level(fbdev->panel));
13191320 } else
13201321 r = -ENODEV;
13211322 return r;
@@ -1348,8 +1349,8 @@ static ssize_t omapfb_show_bklight_max(struct device *dev, · 26 unmodified lines
13481349 int r;
13491350
13501351 if (fbdev->panel->get_bklight_level) {
1351− r = snprintf(buf, PAGE_SIZE, "%d\n",
1352− fbdev->panel->get_bklight_max(fbdev->panel));
1352+ r = sysfs_emit(buf, "%d\n",
1353+ fbdev->panel->get_bklight_max(fbdev->panel));
13531354 } else
13541355 r = -ENODEV;
13551356 return r;
@@ -1379,7 +1380,7 @@ static ssize_t omapfb_show_ctrl_name(struct device *dev, · 23 unmodified lines
13791380 {
13801381 struct omapfb_device *fbdev = dev_get_drvdata(dev);
13811382
1382− return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name);
1383+ return sysfs_emit(buf, "%s\n", fbdev->ctrl->name);
13831384 }
13841385
13851386 static struct device_attribute dev_attr_ctrl_name =
drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c+1−0
@@ -246,6 +246,7 @@ static int dvic_probe_of(struct platform_device *pdev) · 245 unmodified lines
246246 adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0);
247247 if (adapter_node) {
248248 adapter = of_get_i2c_adapter_by_node(adapter_node);
249+ of_node_put(adapter_node);
249250 if (adapter == NULL) {
250251 dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n");
251252 omap_dss_put_device(ddata->in);
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c+4−4
@@ -409,7 +409,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev, · 408 unmodified lines
409409 if (r)
410410 return r;
411411
412− return snprintf(buf, PAGE_SIZE, "%d\n", errors);
412+ return sysfs_emit(buf, "%d\n", errors);
413413 }
414414
415415 static ssize_t dsicm_hw_revision_show(struct device *dev,
@@ -439,7 +439,7 @@ static ssize_t dsicm_hw_revision_show(struct device *dev, · 23 unmodified lines
439439 if (r)
440440 return r;
441441
442− return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
442+ return sysfs_emit(buf, "%02x.%02x.%02x\n", id1, id2, id3);
443443 }
444444
445445 static ssize_t dsicm_store_ulps(struct device *dev,
@@ -487,7 +487,7 @@ static ssize_t dsicm_show_ulps(struct device *dev, · 41 unmodified lines
487487 t = ddata->ulps_enabled;
488488 mutex_unlock(&ddata->lock);
489489
490− return snprintf(buf, PAGE_SIZE, "%u\n", t);
490+ return sysfs_emit(buf, "%u\n", t);
491491 }
492492
493493 static ssize_t dsicm_store_ulps_timeout(struct device *dev,
@@ -532,7 +532,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev, · 38 unmodified lines
532532 t = ddata->ulps_timeout;
533533 mutex_unlock(&ddata->lock);
534534
535− return snprintf(buf, PAGE_SIZE, "%u\n", t);
535+ return sysfs_emit(buf, "%u\n", t);
536536 }
537537
538538 static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c+3−4
@@ -244,10 +244,9 @@ static int lb035q02_probe_of(struct spi_device *spi) · 243 unmodified lines
244244 struct gpio_desc *gpio;
245245
246246 gpio = devm_gpiod_get(&spi->dev, "enable", GPIOD_OUT_LOW);
247− if (IS_ERR(gpio)) {
248− dev_err(&spi->dev, "failed to parse enable gpio\n");
249− return PTR_ERR(gpio);
250− }
247+ if (IS_ERR(gpio))
248+ return dev_err_probe(&spi->dev, PTR_ERR(gpio),
249+ "failed to parse enable gpio\n");
251250
252251 ddata->enable_gpio = gpio;
253252
drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c+3−4
@@ -211,10 +211,9 @@ static int sharp_ls_probe_of(struct platform_device *pdev) · 210 unmodified lines
211211 int r;
212212
213213 ddata->vcc = devm_regulator_get(&pdev->dev, "envdd");
214− if (IS_ERR(ddata->vcc)) {
215− dev_err(&pdev->dev, "failed to get regulator\n");
216− return PTR_ERR(ddata->vcc);
217− }
214+ if (IS_ERR(ddata->vcc))
215+ return dev_err_probe(&pdev->dev, PTR_ERR(ddata->vcc),
216+ "failed to get regulator\n");
218217
219218 /* lcd INI */
220219 r = sharp_ls_get_gpio_of(&pdev->dev, 0, 0, "enable", &ddata->ini_gpio);
drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c+1−1
@@ -476,7 +476,7 @@ static ssize_t show_cabc_available_modes(struct device *dev, · 475 unmodified lines
476476 int i;
477477
478478 if (!ddata->has_cabc)
479− return snprintf(buf, PAGE_SIZE, "%s\n", cabc_modes[0]);
479+ return sysfs_emit(buf, "%s\n", cabc_modes[0]);
480480
481481 for (i = 0, len = 0;
482482 len < PAGE_SIZE && i < ARRAY_SIZE(cabc_modes); i++)
drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c+3−4
@@ -169,7 +169,7 @@ static ssize_t tpo_td043_vmirror_show(struct device *dev, · 168 unmodified lines
169169 {
170170 struct panel_drv_data *ddata = dev_get_drvdata(dev);
171171
172− return snprintf(buf, PAGE_SIZE, "%d\n", ddata->vmirror);
172+ return sysfs_emit(buf, "%d\n", ddata->vmirror);
173173 }
174174
175175 static ssize_t tpo_td043_vmirror_store(struct device *dev,
@@ -199,7 +199,7 @@ static ssize_t tpo_td043_mode_show(struct device *dev, · 23 unmodified lines
199199 {
200200 struct panel_drv_data *ddata = dev_get_drvdata(dev);
201201
202− return snprintf(buf, PAGE_SIZE, "%d\n", ddata->mode);
202+ return sysfs_emit(buf, "%d\n", ddata->mode);
203203 }
204204
205205 static ssize_t tpo_td043_mode_store(struct device *dev,
@@ -517,8 +517,7 @@ static int tpo_td043_probe(struct spi_device *spi) · 311 unmodified lines
517517
518518 ddata->vcc_reg = devm_regulator_get(&spi->dev, "vcc");
519519 if (IS_ERR(ddata->vcc_reg)) {
520− dev_err(&spi->dev, "failed to get LCD VCC regulator\n");
521− r = PTR_ERR(ddata->vcc_reg);
520+ r = dev_err_probe(&spi->dev, r, "failed to get LCD VCC regulator\n");
522521 goto err_regulator;
523522 }
524523
drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c+2−1
@@ -265,6 +265,7 @@ static struct attribute *display_sysfs_attrs[] = { · 264 unmodified lines
265265 &display_attr_wss.attr,
266266 NULL
267267 };
268+ATTRIBUTE_GROUPS(display_sysfs);
268269
269270 static ssize_t display_attr_show(struct kobject *kobj, struct attribute *attr,
270271 char *buf)
@@ -303,7 +304,7 @@ static const struct sysfs_ops display_sysfs_ops = { · 32 unmodified lines
303304
304305 static struct kobj_type display_ktype = {
305306 .sysfs_ops = &display_sysfs_ops,
306− .default_attrs = display_sysfs_attrs,
307+ .default_groups = display_sysfs_groups,
307308 };
308309
309310 int display_init_sysfs(struct platform_device *pdev)
drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c+2−1
@@ -457,6 +457,7 @@ static struct attribute *manager_sysfs_attrs[] = { · 456 unmodified lines
457457 &manager_attr_cpr_coef.attr,
458458 NULL
459459 };
460+ATTRIBUTE_GROUPS(manager_sysfs);
460461
461462 static ssize_t manager_attr_show(struct kobject *kobj, struct attribute *attr,
462463 char *buf)
@@ -495,7 +496,7 @@ static const struct sysfs_ops manager_sysfs_ops = { · 32 unmodified lines
495496
496497 static struct kobj_type manager_ktype = {
497498 .sysfs_ops = &manager_sysfs_ops,
498− .default_attrs = manager_sysfs_attrs,
499+ .default_groups = manager_sysfs_groups,
499500 };
500501
501502 int dss_manager_kobj_init(struct omap_overlay_manager *mgr,
drivers/video/fbdev/omap2/omapfb/dss/overlay-sysfs.c+2−1
@@ -390,6 +390,7 @@ static struct attribute *overlay_sysfs_attrs[] = { · 389 unmodified lines
390390 &overlay_attr_zorder.attr,
391391 NULL
392392 };
393+ATTRIBUTE_GROUPS(overlay_sysfs);
393394
394395 static ssize_t overlay_attr_show(struct kobject *kobj, struct attribute *attr,
395396 char *buf)
@@ -428,7 +429,7 @@ static const struct sysfs_ops overlay_sysfs_ops = { · 32 unmodified lines
428429
429430 static struct kobj_type overlay_ktype = {
430431 .sysfs_ops = &overlay_sysfs_ops,
431− .default_attrs = overlay_sysfs_attrs,
432+ .default_groups = overlay_sysfs_groups,
432433 };
433434
434435 int dss_overlay_kobj_init(struct omap_overlay *ovl,
drivers/video/fbdev/omap2/omapfb/omapfb-main.c+0−1
@@ -1854,7 +1854,6 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) · 1853 unmodified lines
18541854 }
18551855
18561856 if (fbdev->auto_update_wq != NULL) {
1857− flush_workqueue(fbdev->auto_update_wq);
18581857 destroy_workqueue(fbdev->auto_update_wq);
18591858 fbdev->auto_update_wq = NULL;
18601859 }
drivers/video/fbdev/pxa168fb.c+6−9
@@ -593,8 +593,8 @@ static void pxa168fb_init_mode(struct fb_info *info, · 592 unmodified lines
593593 static int pxa168fb_probe(struct platform_device *pdev)
594594 {
595595 struct pxa168fb_mach_info *mi;
596− struct fb_info *info = 0;
597− struct pxa168fb_info *fbi = 0;
596+ struct fb_info *info = NULL;
597+ struct pxa168fb_info *fbi = NULL;
598598 struct resource *res;
599599 struct clk *clk;
600600 int irq, ret;
@@ -606,10 +606,9 @@ static int pxa168fb_probe(struct platform_device *pdev) · 5 unmodified lines
606606 }
607607
608608 clk = devm_clk_get(&pdev->dev, "LCDCLK");
609− if (IS_ERR(clk)) {
610− dev_err(&pdev->dev, "unable to get LCDCLK");
611− return PTR_ERR(clk);
612− }
609+ if (IS_ERR(clk))
610+ return dev_err_probe(&pdev->dev, PTR_ERR(clk),
611+ "unable to get LCDCLK");
613612
614613 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
615614 if (res == NULL) {
@@ -618,10 +617,8 @@ static int pxa168fb_probe(struct platform_device *pdev) · 2 unmodified lines
618617 }
619618
620619 irq = platform_get_irq(pdev, 0);
621− if (irq < 0) {
622− dev_err(&pdev->dev, "no IRQ defined\n");
620+ if (irq < 0)
623621 return -ENOENT;
624− }
625622
626623 info = framebuffer_alloc(sizeof(struct pxa168fb_info), &pdev->dev);
627624 if (info == NULL) {
drivers/video/fbdev/pxa3xx-gcu.c+3−7
@@ -606,17 +606,13 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) · 605 unmodified lines
606606
607607 /* enable the clock */
608608 priv->clk = devm_clk_get(dev, NULL);
609− if (IS_ERR(priv->clk)) {
610− dev_err(dev, "failed to get clock\n");
611− return PTR_ERR(priv->clk);
612− }
609+ if (IS_ERR(priv->clk))
610+ return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get clock\n");
613611
614612 /* request the IRQ */
615613 irq = platform_get_irq(pdev, 0);
616− if (irq < 0) {
617− dev_err(dev, "no IRQ defined: %d\n", irq);
614+ if (irq < 0)
618615 return irq;
619− }
620616
621617 ret = devm_request_irq(dev, irq, pxa3xx_gcu_handle_irq,
622618 0, DRV_NAME, priv);
drivers/video/fbdev/s3c-fb.c+8−12
@@ -1360,7 +1360,6 @@ static int s3c_fb_probe(struct platform_device *pdev) · 1359 unmodified lines
13601360 struct device *dev = &pdev->dev;
13611361 struct s3c_fb_platdata *pd;
13621362 struct s3c_fb *sfb;
1363− struct resource *res;
13641363 int win;
13651364 int ret = 0;
13661365 u32 reg;
@@ -1392,18 +1391,17 @@ static int s3c_fb_probe(struct platform_device *pdev) · 25 unmodified lines
13921391 spin_lock_init(&sfb->slock);
13931392
13941393 sfb->bus_clk = devm_clk_get(dev, "lcd");
1395− if (IS_ERR(sfb->bus_clk)) {
1396− dev_err(dev, "failed to get bus clock\n");
1397− return PTR_ERR(sfb->bus_clk);
1398− }
1394+ if (IS_ERR(sfb->bus_clk))
1395+ return dev_err_probe(dev, PTR_ERR(sfb->bus_clk),
1396+ "failed to get bus clock\n");
13991397
14001398 clk_prepare_enable(sfb->bus_clk);
14011399
14021400 if (!sfb->variant.has_clksel) {
14031401 sfb->lcd_clk = devm_clk_get(dev, "sclk_fimd");
14041402 if (IS_ERR(sfb->lcd_clk)) {
1405− dev_err(dev, "failed to get lcd clock\n");
1406− ret = PTR_ERR(sfb->lcd_clk);
1403+ ret = dev_err_probe(dev, PTR_ERR(sfb->lcd_clk),
1404+ "failed to get lcd clock\n");
14071405 goto err_bus_clk;
14081406 }
14091407
@@ -1418,13 +1416,12 @@ static int s3c_fb_probe(struct platform_device *pdev) · 8 unmodified lines
14181416 goto err_lcd_clk;
14191417 }
14201418
1421− res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1422− if (!res) {
1423− dev_err(dev, "failed to acquire irq resource\n");
1419+ sfb->irq_no = platform_get_irq(pdev, 0);
1420+ if (sfb->irq_no < 0) {
14241421 ret = -ENOENT;
14251422 goto err_lcd_clk;
14261423 }
1427− sfb->irq_no = res->start;
1424+
14281425 ret = devm_request_irq(dev, sfb->irq_no, s3c_fb_irq,
14291426 0, "s3c_fb", sfb);
14301427 if (ret) {
@@ -1810,4 +1807,3 @@ module_platform_driver(s3c_fb_driver); · 379 unmodified lines
18101807 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
18111808 MODULE_DESCRIPTION("Samsung S3C SoC Framebuffer driver");
18121809 MODULE_LICENSE("GPL");
1813−MODULE_ALIAS("platform:s3c-fb");
drivers/video/fbdev/savage/savagefb.h+0−1
@@ -195,7 +195,6 @@ struct savagefb_par { · 194 unmodified lines
195195 struct savage_reg initial;
196196 struct vgastate vgastate;
197197 struct mutex open_lock;
198− unsigned char *edid;
199198 u32 pseudo_palette[16];
200199 u32 open_count;
201200 int paletteEnabled;
drivers/video/fbdev/savage/savagefb_driver.c+4−3
@@ -2170,6 +2170,7 @@ static int savagefb_probe(struct pci_dev *dev, const struct pci_device_id *id) · 2169 unmodified lines
21702170 struct fb_info *info;
21712171 struct savagefb_par *par;
21722172 u_int h_sync, v_sync;
2173+ unsigned char __maybe_unused *edid;
21732174 int err, lpitch;
21742175 int video_len;
21752176
@@ -2212,9 +2213,9 @@ static int savagefb_probe(struct pci_dev *dev, const struct pci_device_id *id) · 36 unmodified lines
22122213 INIT_LIST_HEAD(&info->modelist);
22132214 #if defined(CONFIG_FB_SAVAGE_I2C)
22142215 savagefb_create_i2c_busses(info);
2215− savagefb_probe_i2c_connector(info, &par->edid);
2216− fb_edid_to_monspecs(par->edid, &info->monspecs);
2217− kfree(par->edid);
2216+ savagefb_probe_i2c_connector(info, &edid);
2217+ fb_edid_to_monspecs(edid, &info->monspecs);
2218+ kfree(edid);
22182219 fb_videomode_to_modelist(info->monspecs.modedb,
22192220 info->monspecs.modedb_len,
22202221 &info->modelist);
drivers/video/fbdev/sis/sis_main.c+1−1
@@ -213,7 +213,7 @@ static void sisfb_search_mode(char *name, bool quiet) · 212 unmodified lines
213213 /* This does some fuzzy mode naming detection */
214214 if(sscanf(strbuf1, "%u %u %u %u", &xres, &yres, &depth, &rate) == 4) {
215215 if((rate <= 32) || (depth > 32)) {
216− j = rate; rate = depth; depth = j;
216+ swap(rate, depth);
217217 }
218218 sprintf(strbuf, "%ux%ux%u", xres, yres, depth);
219219 nameptr = strbuf;
drivers/video/fbdev/sm712fb.c+11−35
@@ -1047,7 +1047,7 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, · 1046 unmodified lines
10471047 if (count + p > total_size)
10481048 count = total_size - p;
10491049
1050− buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL);
1050+ buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
10511051 if (!buffer)
10521052 return -ENOMEM;
10531053
@@ -1059,25 +1059,14 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, · 5 unmodified lines
10591059 while (count) {
10601060 c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
10611061 dst = buffer;
1062− for (i = c >> 2; i--;) {
1063− *dst = fb_readl(src++);
1064− *dst = big_swap(*dst);
1062+ for (i = (c + 3) >> 2; i--;) {
1063+ u32 val;
1064+
1065+ val = fb_readl(src);
1066+ *dst = big_swap(val);
1067+ src++;
10651068 dst++;
10661069 }
1067− if (c & 3) {
1068− u8 *dst8 = (u8 *)dst;
1069− u8 __iomem *src8 = (u8 __iomem *)src;
1070−
1071− for (i = c & 3; i--;) {
1072− if (i & 1) {
1073− *dst8++ = fb_readb(++src8);
1074− } else {
1075− *dst8++ = fb_readb(--src8);
1076− src8 += 2;
1077− }
1078− }
1079− src = (u32 __iomem *)src8;
1080− }
10811070
10821071 if (copy_to_user(buf, buffer, c)) {
10831072 err = -EFAULT;
@@ -1130,7 +1119,7 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, · 46 unmodified lines
11301119 count = total_size - p;
11311120 }
11321121
1133− buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL);
1122+ buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
11341123 if (!buffer)
11351124 return -ENOMEM;
11361125
@@ -1148,24 +1137,11 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, · 11 unmodified lines
11481137 break;
11491138 }
11501139
1151− for (i = c >> 2; i--;) {
1152− fb_writel(big_swap(*src), dst++);
1140+ for (i = (c + 3) >> 2; i--;) {
1141+ fb_writel(big_swap(*src), dst);
1142+ dst++;
11531143 src++;
11541144 }
1155− if (c & 3) {
1156− u8 *src8 = (u8 *)src;
1157− u8 __iomem *dst8 = (u8 __iomem *)dst;
1158−
1159− for (i = c & 3; i--;) {
1160− if (i & 1) {
1161− fb_writeb(*src8++, ++dst8);
1162− } else {
1163− fb_writeb(*src8++, --dst8);
1164− dst8 += 2;
1165− }
1166− }
1167− dst = (u32 __iomem *)dst8;
1168− }
11691145
11701146 *ppos += c;
11711147 buf += c;
drivers/video/fbdev/smscufx.c+1−2
@@ -1656,6 +1656,7 @@ static int ufx_usb_probe(struct usb_interface *interface, · 1655 unmodified lines
16561656 info->par = dev;
16571657 info->pseudo_palette = dev->pseudo_palette;
16581658 info->fbops = &ufx_ops;
1659+ INIT_LIST_HEAD(&info->modelist);
16591660
16601661 retval = fb_alloc_cmap(&info->cmap, 256, 0);
16611662 if (retval < 0) {
@@ -1666,8 +1667,6 @@ static int ufx_usb_probe(struct usb_interface *interface, · 4 unmodified lines
16661667 INIT_DELAYED_WORK(&dev->free_framebuffer_work,
16671668 ufx_free_framebuffer_work);
16681669
1669− INIT_LIST_HEAD(&info->modelist);
1670−
16711670 retval = ufx_reg_read(dev, 0x3000, &id_rev);
16721671 check_warn_goto_error(retval, "error %d reading 0x3000 register from device", retval);
16731672 dev_dbg(dev->gdev, "ID_REV register value 0x%08x", id_rev);
drivers/video/fbdev/ssd1307fb.c+3−4
@@ -658,9 +658,8 @@ static int ssd1307fb_probe(struct i2c_client *client) · 657 unmodified lines
658658
659659 par->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
660660 if (IS_ERR(par->reset)) {
661− dev_err(dev, "failed to get reset gpio: %ld\n",
662− PTR_ERR(par->reset));
663− ret = PTR_ERR(par->reset);
661+ ret = dev_err_probe(dev, PTR_ERR(par->reset),
662+ "failed to get reset gpio\n");
664663 goto fb_alloc_error;
665664 }
666665
@@ -670,7 +669,7 @@ static int ssd1307fb_probe(struct i2c_client *client) · 3 unmodified lines
670669 if (ret == -ENODEV) {
671670 par->vbat_reg = NULL;
672671 } else {
673− dev_err(dev, "failed to get VBAT regulator: %d\n", ret);
672+ dev_err_probe(dev, ret, "failed to get VBAT regulator\n");
674673 goto fb_alloc_error;
675674 }
676675 }
drivers/video/fbdev/udlfb.c+4−4
@@ -1426,7 +1426,7 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev, · 1425 unmodified lines
14261426 struct device_attribute *a, char *buf) {
14271427 struct fb_info *fb_info = dev_get_drvdata(fbdev);
14281428 struct dlfb_data *dlfb = fb_info->par;
1429− return snprintf(buf, PAGE_SIZE, "%u\n",
1429+ return sysfs_emit(buf, "%u\n",
14301430 atomic_read(&dlfb->bytes_rendered));
14311431 }
14321432
@@ -1434,7 +1434,7 @@ static ssize_t metrics_bytes_identical_show(struct device *fbdev, · 1 unmodified line
14341434 struct device_attribute *a, char *buf) {
14351435 struct fb_info *fb_info = dev_get_drvdata(fbdev);
14361436 struct dlfb_data *dlfb = fb_info->par;
1437− return snprintf(buf, PAGE_SIZE, "%u\n",
1437+ return sysfs_emit(buf, "%u\n",
14381438 atomic_read(&dlfb->bytes_identical));
14391439 }
14401440
@@ -1442,7 +1442,7 @@ static ssize_t metrics_bytes_sent_show(struct device *fbdev, · 1 unmodified line
14421442 struct device_attribute *a, char *buf) {
14431443 struct fb_info *fb_info = dev_get_drvdata(fbdev);
14441444 struct dlfb_data *dlfb = fb_info->par;
1445− return snprintf(buf, PAGE_SIZE, "%u\n",
1445+ return sysfs_emit(buf, "%u\n",
14461446 atomic_read(&dlfb->bytes_sent));
14471447 }
14481448
@@ -1450,7 +1450,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev, · 1 unmodified line
14501450 struct device_attribute *a, char *buf) {
14511451 struct fb_info *fb_info = dev_get_drvdata(fbdev);
14521452 struct dlfb_data *dlfb = fb_info->par;
1453− return snprintf(buf, PAGE_SIZE, "%u\n",
1453+ return sysfs_emit(buf, "%u\n",
14541454 atomic_read(&dlfb->cpu_kcycles_used));
14551455 }
14561456
drivers/video/fbdev/via/lcd.c+1−1
@@ -543,7 +543,7 @@ void viafb_lcd_set_mode(const struct fb_var_screeninfo *var, u16 cxres, · 542 unmodified lines
543543 /* Get panel table Pointer */
544544 panel_crt_table = viafb_get_best_mode(panel_hres, panel_vres, 60);
545545 viafb_fill_var_timing_info(&panel_var, panel_crt_table);
546− DEBUG_MSG(KERN_INFO "bellow viafb_lcd_set_mode!!\n");
546+ DEBUG_MSG(KERN_INFO "below viafb_lcd_set_mode!!\n");
547547 if (VT1636_LVDS == plvds_chip_info->lvds_chip_name)
548548 viafb_init_lvds_vt1636(plvds_setting_info, plvds_chip_info);
549549 clock = PICOS2KHZ(panel_crt_table->pixclock) * 1000;
drivers/video/fbdev/via/viafbdev.c+10−0
@@ -1939,8 +1939,12 @@ static int __init viafb_setup(void) · 1938 unmodified lines
19391939
19401940 if (!strncmp(this_opt, "viafb_mode1=", 12)) {
19411941 viafb_mode1 = kstrdup(this_opt + 12, GFP_KERNEL);
1942+ if (!viafb_mode1)
1943+ return -ENOMEM;
19421944 } else if (!strncmp(this_opt, "viafb_mode=", 11)) {
19431945 viafb_mode = kstrdup(this_opt + 11, GFP_KERNEL);
1946+ if (!viafb_mode)
1947+ return -ENOMEM;
19441948 } else if (!strncmp(this_opt, "viafb_bpp1=", 11)) {
19451949 if (kstrtouint(this_opt + 11, 0, &viafb_bpp1) < 0)
19461950 return -EINVAL;
@@ -1969,6 +1973,8 @@ static int __init viafb_setup(void) · 22 unmodified lines
19691973 return -EINVAL;
19701974 } else if (!strncmp(this_opt, "viafb_active_dev=", 17)) {
19711975 viafb_active_dev = kstrdup(this_opt + 17, GFP_KERNEL);
1976+ if (!viafb_active_dev)
1977+ return -ENOMEM;
19721978 } else if (!strncmp(this_opt,
19731979 "viafb_display_hardware_layout=", 30)) {
19741980 if (kstrtoint(this_opt + 30, 0,
@@ -1995,8 +2001,12 @@ static int __init viafb_setup(void) · 20 unmodified lines
19952001 return -EINVAL;
19962002 } else if (!strncmp(this_opt, "viafb_lcd_port=", 15)) {
19972003 viafb_lcd_port = kstrdup(this_opt + 15, GFP_KERNEL);
2004+ if (!viafb_lcd_port)
2005+ return -ENOMEM;
19982006 } else if (!strncmp(this_opt, "viafb_dvi_port=", 15)) {
19992007 viafb_dvi_port = kstrdup(this_opt + 15, GFP_KERNEL);
2008+ if (!viafb_dvi_port)
2009+ return -ENOMEM;
20002010 }
20012011 }
20022012 return 0;
drivers/video/fbdev/w100fb.c+12−3
@@ -770,12 +770,18 @@ out: · 769 unmodified lines
770770 fb_dealloc_cmap(&info->cmap);
771771 kfree(info->pseudo_palette);
772772 }
773− if (remapped_fbuf != NULL)
773+ if (remapped_fbuf != NULL) {
774774 iounmap(remapped_fbuf);
775− if (remapped_regs != NULL)
775+ remapped_fbuf = NULL;
776+ }
777+ if (remapped_regs != NULL) {
776778 iounmap(remapped_regs);
777− if (remapped_base != NULL)
779+ remapped_regs = NULL;
780+ }
781+ if (remapped_base != NULL) {
778782 iounmap(remapped_base);
783+ remapped_base = NULL;
784+ }
779785 if (info)
780786 framebuffer_release(info);
781787 return err;
@@ -795,8 +801,11 @@ static int w100fb_remove(struct platform_device *pdev) · 13 unmodified lines
795801 fb_dealloc_cmap(&info->cmap);
796802
797803 iounmap(remapped_base);
804+ remapped_base = NULL;
798805 iounmap(remapped_regs);
806+ remapped_regs = NULL;
799807 iounmap(remapped_fbuf);
808+ remapped_fbuf = NULL;
800809
801810 framebuffer_release(info);
802811