From 12f3ac2fb16130e4afcfde986fb97f61cb54eead Mon Sep 17 00:00:00 2001 From: Jia-Ju Bai Date: Tue, 24 Apr 2018 18:11:21 +0200 Subject: video: fbdev: savage: Replace mdelay with usleep_range in savage_init_hw savage_init_hw() is never called in atomic context. The call chains ending up at savage_init_hw() are: [1] savage_init_hw() <- savagefb_probe() [2] savage_init_hw() <- savagefb_resume() savagefb_probe() is only set as ".probe" in struct pci_driver. savagefb_resume) is only set as ".resume" in struct pci_driver. These functions are not called in atomic context. Despite never getting called from atomic context, savage_init_hw() calls mdelay() to busily wait. This is not necessary and can be replaced with usleep_range to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai Cc: Antonino Daplas Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/savage/savagefb_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/savage/savagefb_driver.c b/drivers/video/fbdev/savage/savagefb_driver.c index c20468362f11..c09d7426cd92 100644 --- a/drivers/video/fbdev/savage/savagefb_driver.c +++ b/drivers/video/fbdev/savage/savagefb_driver.c @@ -1892,11 +1892,11 @@ static int savage_init_hw(struct savagefb_par *par) vga_out8(0x3d4, 0x66, par); cr66 = vga_in8(0x3d5, par); vga_out8(0x3d5, cr66 | 0x02, par); - mdelay(10); + usleep_range(10000, 11000); vga_out8(0x3d4, 0x66, par); vga_out8(0x3d5, cr66 & ~0x02, par); /* clear reset flag */ - mdelay(10); + usleep_range(10000, 11000); /* @@ -1906,11 +1906,11 @@ static int savage_init_hw(struct savagefb_par *par) vga_out8(0x3d4, 0x3f, par); cr3f = vga_in8(0x3d5, par); vga_out8(0x3d5, cr3f | 0x08, par); - mdelay(10); + usleep_range(10000, 11000); vga_out8(0x3d4, 0x3f, par); vga_out8(0x3d5, cr3f & ~0x08, par); /* clear reset flags */ - mdelay(10); + usleep_range(10000, 11000); /* Savage ramdac speeds */ par->numClocks = 4; -- cgit v1.2.3 From 86c4e7c350a5bd116ff4b9cea2c75a4a4ae321ff Mon Sep 17 00:00:00 2001 From: Jia-Ju Bai Date: Tue, 24 Apr 2018 18:11:21 +0200 Subject: video: fbdev: aty: aty128fb: Replace mdelay with msleep in aty128_set_suspend aty128_set_suspend() is never called in atomic context. The call chains ending up at aty128_set_suspend() are: [1] aty128_set_suspend() <- aty128_pci_suspend() [2] aty128_set_suspend() <- aty128_do_resume() <- aty128_pci_resume() [3] aty128_set_suspend() <- aty128_do_resume() <- aty128_early_resume() aty128_pci_suspend() is set as ".suspend" in struct pci_driver. aty128_pci_resume() is set as ".resume" in struct pci_driver. aty128_early_resume() is never called. These functions are not called in atomic context. Despite never getting called from atomic context, aty128_set_suspend() calls mdelay() to busily wait. This is not necessary and can be replaced with msleep() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai Cc: Paul Mackerras Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/aty/aty128fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 09b0e558dce8..6cc46867ff57 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -2442,7 +2442,7 @@ static void aty128_set_suspend(struct aty128fb_par *par, int suspend) (void)aty_ld_pll(POWER_MANAGEMENT); aty_st_le32(BUS_CNTL1, 0x00000010); aty_st_le32(MEM_POWER_MISC, 0x0c830000); - mdelay(100); + msleep(100); /* Switch PCI power management to D2 */ pci_set_power_state(pdev, PCI_D2); -- cgit v1.2.3 From de11731278712e0f8b12a2539aa2958ca95200c3 Mon Sep 17 00:00:00 2001 From: Jia-Ju Bai Date: Tue, 24 Apr 2018 18:11:21 +0200 Subject: video: fbdev: aty: radeon_pm: Replace mdelay with msleep in radeonfb_pci_suspend radeonfb_pci_suspend() is never called in atomic context. radeonfb_pci_suspend() is only set as ".suspend" in struct pci_driver. This function is not called in atomic context. Despite never getting called from atomic context, radeonfb_pci_suspend() calls mdelay() to busily wait. This is not necessary and can be replaced with msleep() and usleep_range() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai Cc: Benjamin Herrenschmidt Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/aty/radeon_pm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/aty/radeon_pm.c b/drivers/video/fbdev/aty/radeon_pm.c index 7137c12cbcee..e695adb0e573 100644 --- a/drivers/video/fbdev/aty/radeon_pm.c +++ b/drivers/video/fbdev/aty/radeon_pm.c @@ -2678,17 +2678,17 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) * it, we'll restore the dynamic clocks state on wakeup */ radeon_pm_disable_dynamic_mode(rinfo); - mdelay(50); + msleep(50); radeon_pm_save_regs(rinfo, 1); if (rinfo->is_mobility && !(rinfo->pm_mode & radeon_pm_d2)) { /* Switch off LVDS interface */ - mdelay(1); + usleep_range(1000, 2000); OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_BL_MOD_EN)); - mdelay(1); + usleep_range(1000, 2000); OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_EN | LVDS_ON)); OUTREG(LVDS_PLL_CNTL, (INREG(LVDS_PLL_CNTL) & ~30000) | 0x20000); - mdelay(20); + msleep(20); OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON)); } pci_disable_device(pdev); -- cgit v1.2.3 From c8b54776c173227eb4d89d8fa682333165275402 Mon Sep 17 00:00:00 2001 From: Souptick Joarder Date: Tue, 24 Apr 2018 18:11:21 +0200 Subject: video: fbdev: core: Change return type to vm_fault_t Use new return type vm_fault_t for fault handler and page_mkwrite handler. Signed-off-by: Souptick Joarder Reviewed-by: Matthew Wilcox Cc: Jaya Kumar Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/core/fb_defio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c index 487d5e336e1b..82c20c6047b0 100644 --- a/drivers/video/fbdev/core/fb_defio.c +++ b/drivers/video/fbdev/core/fb_defio.c @@ -37,7 +37,7 @@ static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs } /* this is to find and return the vmalloc-ed fb pages */ -static int fb_deferred_io_fault(struct vm_fault *vmf) +static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf) { unsigned long offset; struct page *page; @@ -90,7 +90,7 @@ int fb_deferred_io_fsync(struct file *file, loff_t start, loff_t end, int datasy EXPORT_SYMBOL_GPL(fb_deferred_io_fsync); /* vm_ops->page_mkwrite handler */ -static int fb_deferred_io_mkwrite(struct vm_fault *vmf) +static vm_fault_t fb_deferred_io_mkwrite(struct vm_fault *vmf) { struct page *page = vmf->page; struct fb_info *info = vmf->vma->vm_private_data; -- cgit v1.2.3 From b2faabc8309065526a43d634da95139afa16770f Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 24 Apr 2018 18:11:21 +0200 Subject: video: fbdev: simplify getting .drvdata We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/auo_k190x.c | 12 ++++-------- drivers/video/fbdev/sh_mobile_lcdcfb.c | 6 ++---- drivers/video/fbdev/sh_mobile_meram.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/auo_k190x.c b/drivers/video/fbdev/auo_k190x.c index 9d24d1b3e9ef..9bf6a6e02342 100644 --- a/drivers/video/fbdev/auo_k190x.c +++ b/drivers/video/fbdev/auo_k190x.c @@ -776,8 +776,7 @@ static void auok190x_recover(struct auok190xfb_par *par) */ static int __maybe_unused auok190x_runtime_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct fb_info *info = platform_get_drvdata(pdev); + struct fb_info *info = dev_get_drvdata(dev); struct auok190xfb_par *par = info->par; struct auok190x_board *board = par->board; u16 standby_param; @@ -823,8 +822,7 @@ finish: static int __maybe_unused auok190x_runtime_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct fb_info *info = platform_get_drvdata(pdev); + struct fb_info *info = dev_get_drvdata(dev); struct auok190xfb_par *par = info->par; struct auok190x_board *board = par->board; @@ -857,8 +855,7 @@ static int __maybe_unused auok190x_runtime_resume(struct device *dev) static int __maybe_unused auok190x_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct fb_info *info = platform_get_drvdata(pdev); + struct fb_info *info = dev_get_drvdata(dev); struct auok190xfb_par *par = info->par; struct auok190x_board *board = par->board; int ret; @@ -897,8 +894,7 @@ static int __maybe_unused auok190x_suspend(struct device *dev) static int __maybe_unused auok190x_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct fb_info *info = platform_get_drvdata(pdev); + struct fb_info *info = dev_get_drvdata(dev); struct auok190xfb_par *par = info->par; struct auok190x_board *board = par->board; diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index c3a46506e47e..86bd4090b011 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -2354,8 +2354,7 @@ static int sh_mobile_lcdc_resume(struct device *dev) static int sh_mobile_lcdc_runtime_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); + struct sh_mobile_lcdc_priv *priv = dev_get_drvdata(dev); /* turn off LCDC hardware */ lcdc_write(priv, _LDCNT1R, 0); @@ -2365,8 +2364,7 @@ static int sh_mobile_lcdc_runtime_suspend(struct device *dev) static int sh_mobile_lcdc_runtime_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); + struct sh_mobile_lcdc_priv *priv = dev_get_drvdata(dev); __sh_mobile_lcdc_start(priv); diff --git a/drivers/video/fbdev/sh_mobile_meram.c b/drivers/video/fbdev/sh_mobile_meram.c index baadfb207b2e..f5d8bd7ef509 100644 --- a/drivers/video/fbdev/sh_mobile_meram.c +++ b/drivers/video/fbdev/sh_mobile_meram.c @@ -572,8 +572,7 @@ EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_update); #ifdef CONFIG_PM static int sh_mobile_meram_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); + struct sh_mobile_meram_priv *priv = dev_get_drvdata(dev); unsigned int i, j; for (i = 0; i < MERAM_REGS_SIZE; i++) @@ -596,8 +595,7 @@ static int sh_mobile_meram_suspend(struct device *dev) static int sh_mobile_meram_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); + struct sh_mobile_meram_priv *priv = dev_get_drvdata(dev); unsigned int i, j; for (i = 0; i < 32; i++) { -- cgit v1.2.3 From 6677b275f3406858ff39d88e95f02ea6c59de7c4 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 24 Apr 2018 18:11:21 +0200 Subject: video: fbdev: omap2: omapfb: displays: simplify getting .drvdata We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang Cc: Tomi Valkeinen Signed-off-by: Bartlomiej Zolnierkiewicz --- .../video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c index bef431530090..87497a00241f 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c @@ -387,8 +387,7 @@ static void dsicm_get_resolution(struct omap_dss_device *dssdev, static ssize_t dsicm_num_errors_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); struct omap_dss_device *in = ddata->in; u8 errors = 0; int r; @@ -419,8 +418,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev, static ssize_t dsicm_hw_revision_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); struct omap_dss_device *in = ddata->in; u8 id1, id2, id3; int r; @@ -451,8 +449,7 @@ static ssize_t dsicm_store_ulps(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); struct omap_dss_device *in = ddata->in; unsigned long t; int r; @@ -486,8 +483,7 @@ static ssize_t dsicm_show_ulps(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); unsigned t; mutex_lock(&ddata->lock); @@ -501,8 +497,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); struct omap_dss_device *in = ddata->in; unsigned long t; int r; @@ -533,8 +528,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); unsigned t; mutex_lock(&ddata->lock); -- cgit v1.2.3 From 4f7afece3afda1b6cd2768b3d2fa10464be42069 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 24 Apr 2018 18:11:22 +0200 Subject: video: fbdev: sh_mobile_meram: Drop SUPERH platform dependency Since commit a521422ea4ae6128 ("ARM: shmobile: mackerel: Remove Legacy C board code"), the only remaining platforms using this driver are SuperH SH-Mobile SoCs (sh7723). As both SUPERH and ARCH_SHMOBILE are set for these platforms, the SUPERH dependency can be dropped. Signed-off-by: Geert Uytterhoeven Acked-by: Laurent Pinchart Acked-by: Simon Horman Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index d94254263ea5..434e95b9320e 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2348,7 +2348,7 @@ source "drivers/video/fbdev/mmp/Kconfig" config FB_SH_MOBILE_MERAM tristate "SuperH Mobile MERAM read ahead support" - depends on (SUPERH || ARCH_SHMOBILE) + depends on ARCH_SHMOBILE select GENERIC_ALLOCATOR ---help--- Enable MERAM support for the SuperH controller. -- cgit v1.2.3 From bdb488e65352daca4dbab37df99f605754cfcdd8 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 26 Apr 2018 12:24:18 +0200 Subject: video: sh_mobile_meram: Delete an error message for a failed memory allocation in sh_mobile_meram_probe() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/sh_mobile_meram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/sh_mobile_meram.c b/drivers/video/fbdev/sh_mobile_meram.c index f5d8bd7ef509..da9df12f63f0 100644 --- a/drivers/video/fbdev/sh_mobile_meram.c +++ b/drivers/video/fbdev/sh_mobile_meram.c @@ -642,10 +642,8 @@ static int sh_mobile_meram_probe(struct platform_device *pdev) } priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { - dev_err(&pdev->dev, "cannot allocate device data\n"); + if (!priv) return -ENOMEM; - } /* Initialize private data. */ mutex_init(&priv->lock); -- cgit v1.2.3 From e281018b0b2562d8b82e6aa7c8647dfb2e4c1b29 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 26 Apr 2018 12:24:18 +0200 Subject: video: sh_mobile_lcdcfb: Delete an error message for a failed memory allocation in two functions Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Cc: Arvind Yadav Cc: Geert Uytterhoeven Cc: Kees Cook Cc: Wei Yongjun Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/sh_mobile_lcdcfb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 86bd4090b011..929b1c51aab6 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -2149,10 +2149,8 @@ sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch) if (info->fbdefio) { ch->sglist = vmalloc(sizeof(struct scatterlist) * ch->fb_size >> PAGE_SHIFT); - if (!ch->sglist) { - dev_err(ch->lcdc->dev, "cannot allocate sglist\n"); + if (!ch->sglist) return -ENOMEM; - } } info->bl_dev = ch->bl; @@ -2716,10 +2714,8 @@ static int sh_mobile_lcdc_probe(struct platform_device *pdev) } priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { - dev_err(&pdev->dev, "cannot allocate device data\n"); + if (!priv) return -ENOMEM; - } priv->dev = &pdev->dev; priv->meram_dev = pdata->meram_dev; -- cgit v1.2.3 From c24a5e934775865270b1a79a95affadb4289b3d3 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 26 Apr 2018 12:24:18 +0200 Subject: video: auo_k190x: Delete an error message for a failed memory allocation in auok190x_common_probe() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Cc: Ingo Molnar Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/auo_k190x.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/auo_k190x.c b/drivers/video/fbdev/auo_k190x.c index 9bf6a6e02342..b39681e6f4fd 100644 --- a/drivers/video/fbdev/auo_k190x.c +++ b/drivers/video/fbdev/auo_k190x.c @@ -1076,7 +1076,6 @@ int auok190x_common_probe(struct platform_device *pdev, sizeof(struct fb_deferred_io), GFP_KERNEL); if (!info->fbdefio) { - dev_err(info->device, "Failed to allocate memory\n"); ret = -ENOMEM; goto err_defio; } -- cgit v1.2.3 From e0e894f5941871a08cddeda0ad6996c82613d0a7 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 26 Apr 2018 12:24:18 +0200 Subject: video: fbdev-MMP: Delete an error message for a failed memory allocation in two functions Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/mmp/fb/mmpfb.c | 5 ++--- drivers/video/fbdev/mmp/hw/mmp_ctrl.c | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c index 92279e02dd94..292b3e403044 100644 --- a/drivers/video/fbdev/mmp/fb/mmpfb.c +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c @@ -495,10 +495,9 @@ static int modes_setup(struct mmpfb_info *fbi) /* put videomode list to info structure */ videomodes = kzalloc(sizeof(struct fb_videomode) * videomode_num, GFP_KERNEL); - if (!videomodes) { - dev_err(fbi->dev, "can't malloc video modes\n"); + if (!videomodes) return -ENOMEM; - } + for (i = 0; i < videomode_num; i++) mmpmode_to_fbmode(&videomodes[i], &mmp_modes[i]); fb_videomode_to_modelist(videomodes, videomode_num, &info->modelist); diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c index b6f83d5df9fd..9f912ea0bfce 100644 --- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c @@ -407,11 +407,9 @@ static int path_init(struct mmphw_path_plat *path_plat, /* init driver data */ path_info = kzalloc(sizeof(struct mmp_path_info), GFP_KERNEL); - if (!path_info) { - dev_err(ctrl->dev, "%s: unable to alloc path_info for %s\n", - __func__, config->name); + if (!path_info) return 0; - } + path_info->name = config->name; path_info->id = path_plat->id; path_info->dev = ctrl->dev; -- cgit v1.2.3 From 965bef6483e2bab20cd959d014f83b48da70e71c Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 26 Apr 2018 12:24:18 +0200 Subject: video: fbdev-MMP: Improve a size determination in path_init() Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/mmp/hw/mmp_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c index 9f912ea0bfce..fcdbb2df137f 100644 --- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c @@ -406,7 +406,7 @@ static int path_init(struct mmphw_path_plat *path_plat, dev_info(ctrl->dev, "%s: %s\n", __func__, config->name); /* init driver data */ - path_info = kzalloc(sizeof(struct mmp_path_info), GFP_KERNEL); + path_info = kzalloc(sizeof(*path_info), GFP_KERNEL); if (!path_info) return 0; -- cgit v1.2.3 From 65a4df9f37d7282151f61c7a840ce91fdfe97420 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 26 Apr 2018 12:24:18 +0200 Subject: video: sm501fb: Improve a size determination in sm501fb_probe() Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Cc: Alexey Khoroshilov Cc: Bhumika Goyal Cc: Colin Ian King Cc: "Gustavo A. R. Silva" Cc: Sudip Mukherjee Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/sm501fb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c index 6f0a19501c6a..dde52d027416 100644 --- a/drivers/video/fbdev/sm501fb.c +++ b/drivers/video/fbdev/sm501fb.c @@ -1932,8 +1932,7 @@ static int sm501fb_probe(struct platform_device *pdev) int ret; /* allocate our framebuffers */ - - info = kzalloc(sizeof(struct sm501fb_info), GFP_KERNEL); + info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { dev_err(dev, "failed to allocate state\n"); return -ENOMEM; -- cgit v1.2.3 From 85d108dee574c038423f573b6ae93d43d12e971e Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 26 Apr 2018 12:24:19 +0200 Subject: video: omap: Improve a size determination in omapfb_do_probe() Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Cc: Tomi Valkeinen Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/omap/omapfb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c index 3479a47a3082..585f39efcff6 100644 --- a/drivers/video/fbdev/omap/omapfb_main.c +++ b/drivers/video/fbdev/omap/omapfb_main.c @@ -1645,7 +1645,7 @@ static int omapfb_do_probe(struct platform_device *pdev, goto cleanup; } - fbdev = kzalloc(sizeof(struct omapfb_device), GFP_KERNEL); + fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); if (fbdev == NULL) { dev_err(&pdev->dev, "unable to allocate memory for device info\n"); -- cgit v1.2.3 From 745f8c14e35d32ff43a52a9415e4dcc2955c4321 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 14 May 2018 15:47:30 +0200 Subject: video: fbdev: remove unused auo_k190xfb drivers auo_k1900fb and auo_k1901fb drivers have been introduced six years ago by following commits: commit 2c8304d3125b ("video: auo_k190x: add code shared by controller drivers") commit 96b1d500e028 ("video: auo_k190x: add driver for AUO-K1900 variant") commit 53027cdf2a67 ("video: auo_k190x: add driver for AUO-K1901 variant") They never had any in-kernel user so just remove them (since they are platform drivers they need corresponding platform devices to be registered by kernel and it has never happened). Reviewed-by: Heiko Stuebner Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/Kconfig | 33 - drivers/video/fbdev/Makefile | 3 - drivers/video/fbdev/auo_k1900fb.c | 204 ------- drivers/video/fbdev/auo_k1901fb.c | 257 -------- drivers/video/fbdev/auo_k190x.c | 1190 ------------------------------------- drivers/video/fbdev/auo_k190x.h | 129 ---- 6 files changed, 1816 deletions(-) delete mode 100644 drivers/video/fbdev/auo_k1900fb.c delete mode 100644 drivers/video/fbdev/auo_k1901fb.c delete mode 100644 drivers/video/fbdev/auo_k190x.c delete mode 100644 drivers/video/fbdev/auo_k190x.h (limited to 'drivers/video') diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 434e95b9320e..381a9c588792 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2253,39 +2253,6 @@ config FB_BROADSHEET and could also have been called by other names when coupled with a bridge adapter. -config FB_AUO_K190X - tristate "AUO-K190X EPD controller support" - depends on FB - select FB_SYS_FILLRECT - select FB_SYS_COPYAREA - select FB_SYS_IMAGEBLIT - select FB_SYS_FOPS - select FB_DEFERRED_IO - help - Provides support for epaper controllers from the K190X series - of AUO. These controllers can be used to drive epaper displays - from Sipix. - - This option enables the common support, shared by the individual - controller drivers. You will also have to enable the driver - for the controller type used in your device. - -config FB_AUO_K1900 - tristate "AUO-K1900 EPD controller support" - depends on FB && FB_AUO_K190X - help - This driver implements support for the AUO K1900 epd-controller. - This controller can drive Sipix epaper displays but can only do - serial updates, reducing the number of possible frames per second. - -config FB_AUO_K1901 - tristate "AUO-K1901 EPD controller support" - depends on FB && FB_AUO_K190X - help - This driver implements support for the AUO K1901 epd-controller. - This controller can drive Sipix epaper displays and supports - concurrent updates, making higher frames per second possible. - config FB_JZ4740 tristate "JZ4740 LCD framebuffer support" depends on FB && MACH_JZ4740 diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile index 55282a21b500..317a6fd0e54e 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -100,9 +100,6 @@ obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o obj-$(CONFIG_FB_MAXINE) += maxinefb.o obj-$(CONFIG_FB_METRONOME) += metronomefb.o obj-$(CONFIG_FB_BROADSHEET) += broadsheetfb.o -obj-$(CONFIG_FB_AUO_K190X) += auo_k190x.o -obj-$(CONFIG_FB_AUO_K1900) += auo_k1900fb.o -obj-$(CONFIG_FB_AUO_K1901) += auo_k1901fb.o obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o obj-$(CONFIG_FB_SH7760) += sh7760fb.o obj-$(CONFIG_FB_IMX) += imxfb.o diff --git a/drivers/video/fbdev/auo_k1900fb.c b/drivers/video/fbdev/auo_k1900fb.c deleted file mode 100644 index 7637c60eae3d..000000000000 --- a/drivers/video/fbdev/auo_k1900fb.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * auok190xfb.c -- FB driver for AUO-K1900 controllers - * - * Copyright (C) 2011, 2012 Heiko Stuebner - * - * based on broadsheetfb.c - * - * Copyright (C) 2008, Jaya Kumar - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven. - * - * This driver is written to be used with the AUO-K1900 display controller. - * - * It is intended to be architecture independent. A board specific driver - * must be used to perform all the physical IO interactions. - * - * The controller supports different update modes: - * mode0+1 16 step gray (4bit) - * mode2 4 step gray (2bit) - FIXME: add strange refresh - * mode3 2 step gray (1bit) - FIXME: add strange refresh - * mode4 handwriting mode (strange behaviour) - * mode5 automatic selection of update mode - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include