From 0f5e17c5fde5d28b26cd83e077c21d28bbf50a80 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Jun 2013 12:13:16 +0200 Subject: video: xilinxfb: Fix OF probing on little-endian systems DTB is always big-endian that's why it is necessary to properly convert value (*p). It is automatically done in of_property_read_u32(). Signed-off-by: Michal Simek Acked-by: Arnd Bergmann Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index af0b4fd..aecd15d 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -406,8 +406,7 @@ static int xilinxfb_release(struct device *dev) static int xilinxfb_of_probe(struct platform_device *op) { const u32 *prop; - u32 *p; - u32 tft_access; + u32 tft_access = 0; struct xilinxfb_platform_data pdata; struct resource res; int size, rc; @@ -427,8 +426,8 @@ static int xilinxfb_of_probe(struct platform_device *op) * To check whether the core is connected directly to DCR or PLB * interface and initialize the tft_access accordingly. */ - p = (u32 *)of_get_property(op->dev.of_node, "xlnx,dcr-splb-slave-if", NULL); - tft_access = p ? *p : 0; + of_property_read_u32(op->dev.of_node, "xlnx,dcr-splb-slave-if", + &tft_access); /* * Fill the resource structure if its direct PLB interface -- cgit v0.10.2 From ec05e7a8aaf5fd73a64d28fc9f28384ea247cc1c Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Jun 2013 12:13:17 +0200 Subject: video: xilinxfb: Do not name out_be32 in function name out_be32 IO function is not supported by ARM. It is only available for PPC and Microblaze. Because this driver can be used on ARM let's remove out_be32 from function name. Signed-off-by: Michal Simek Acked-by: Arnd Bergmann Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index aecd15d..c9b442b 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -57,7 +57,7 @@ * In case of direct PLB access the second control register will be at * an offset of 4 as compared to the DCR access where the offset is 1 * i.e. REG_CTRL. So this is taken care in the function - * xilinx_fb_out_be32 where it left shifts the offset 2 times in case of + * xilinx_fb_out32 where it left shifts the offset 2 times in case of * direct PLB access. */ #define NUM_REGS 2 @@ -150,7 +150,7 @@ struct xilinxfb_drvdata { * To perform the read/write on the registers we need to check on * which bus its connected and call the appropriate write API. */ -static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset, +static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset, u32 val) { if (drvdata->flags & PLB_ACCESS_FLAG) @@ -197,7 +197,7 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi) switch (blank_mode) { case FB_BLANK_UNBLANK: /* turn on panel */ - xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); + xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); break; case FB_BLANK_NORMAL: @@ -205,7 +205,7 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi) case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_POWERDOWN: /* turn off panel */ - xilinx_fb_out_be32(drvdata, REG_CTRL, 0); + xilinx_fb_out32(drvdata, REG_CTRL, 0); default: break; @@ -280,13 +280,13 @@ static int xilinxfb_assign(struct device *dev, memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize); /* Tell the hardware where the frame buffer is */ - xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys); + xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); /* Turn on the display */ drvdata->reg_ctrl_default = REG_CTRL_ENABLE; if (pdata->rotate_screen) drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; - xilinx_fb_out_be32(drvdata, REG_CTRL, + xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); /* Fill struct fb_info */ @@ -345,7 +345,7 @@ err_cmap: iounmap(drvdata->fb_virt); /* Turn off the display */ - xilinx_fb_out_be32(drvdata, REG_CTRL, 0); + xilinx_fb_out32(drvdata, REG_CTRL, 0); err_fbmem: if (drvdata->flags & PLB_ACCESS_FLAG) @@ -381,7 +381,7 @@ static int xilinxfb_release(struct device *dev) iounmap(drvdata->fb_virt); /* Turn off the display */ - xilinx_fb_out_be32(drvdata, REG_CTRL, 0); + xilinx_fb_out32(drvdata, REG_CTRL, 0); /* Release the resources, as allocated based on interface */ if (drvdata->flags & PLB_ACCESS_FLAG) { -- cgit v0.10.2 From 5130af35bf34e7b57e86c7f72c08b8c68adbb425 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Jun 2013 12:13:18 +0200 Subject: video: xilinxfb: Rename PLB_ACCESS_FLAG to BUS_ACCESS_FLAG Using only PLB name is wrong for a long time because the same access functions are also used for AXI. s/PLB/BUS/g Signed-off-by: Michal Simek Acked-by: Arnd Bergmann Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index c9b442b..d94c992 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -44,7 +44,7 @@ /* - * Xilinx calls it "PLB TFT LCD Controller" though it can also be used for + * Xilinx calls it "TFT LCD Controller" though it can also be used for * the VGA port on the Xilinx ML40x board. This is a hardware display * controller for a 640x480 resolution TFT or VGA screen. * @@ -54,11 +54,11 @@ * don't start thinking about scrolling). The second allows the LCD to * be turned on or off as well as rotated 180 degrees. * - * In case of direct PLB access the second control register will be at + * In case of direct BUS access the second control register will be at * an offset of 4 as compared to the DCR access where the offset is 1 * i.e. REG_CTRL. So this is taken care in the function * xilinx_fb_out32 where it left shifts the offset 2 times in case of - * direct PLB access. + * direct BUS access. */ #define NUM_REGS 2 #define REG_FB_ADDR 0 @@ -116,7 +116,7 @@ static struct fb_var_screeninfo xilinx_fb_var = { }; -#define PLB_ACCESS_FLAG 0x1 /* 1 = PLB, 0 = DCR */ +#define BUS_ACCESS_FLAG 0x1 /* 1 = BUS, 0 = DCR */ struct xilinxfb_drvdata { @@ -146,14 +146,14 @@ struct xilinxfb_drvdata { container_of(_info, struct xilinxfb_drvdata, info) /* - * The XPS TFT Controller can be accessed through PLB or DCR interface. + * The XPS TFT Controller can be accessed through BUS or DCR interface. * To perform the read/write on the registers we need to check on * which bus its connected and call the appropriate write API. */ static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset, u32 val) { - if (drvdata->flags & PLB_ACCESS_FLAG) + if (drvdata->flags & BUS_ACCESS_FLAG) out_be32(drvdata->regs + (offset << 2), val); #ifdef CONFIG_PPC_DCR else @@ -235,10 +235,10 @@ static int xilinxfb_assign(struct device *dev, int rc; int fbsize = pdata->xvirt * pdata->yvirt * BYTES_PER_PIXEL; - if (drvdata->flags & PLB_ACCESS_FLAG) { + if (drvdata->flags & BUS_ACCESS_FLAG) { /* * Map the control registers in if the controller - * is on direct PLB interface. + * is on direct BUS interface. */ if (!request_mem_region(physaddr, 8, DRIVER_NAME)) { dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", @@ -270,7 +270,7 @@ static int xilinxfb_assign(struct device *dev, if (!drvdata->fb_virt) { dev_err(dev, "Could not allocate frame buffer memory\n"); rc = -ENOMEM; - if (drvdata->flags & PLB_ACCESS_FLAG) + if (drvdata->flags & BUS_ACCESS_FLAG) goto err_fbmem; else goto err_region; @@ -323,7 +323,7 @@ static int xilinxfb_assign(struct device *dev, goto err_regfb; } - if (drvdata->flags & PLB_ACCESS_FLAG) { + if (drvdata->flags & BUS_ACCESS_FLAG) { /* Put a banner in the log (for DEBUG) */ dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr, drvdata->regs); @@ -348,11 +348,11 @@ err_cmap: xilinx_fb_out32(drvdata, REG_CTRL, 0); err_fbmem: - if (drvdata->flags & PLB_ACCESS_FLAG) + if (drvdata->flags & BUS_ACCESS_FLAG) iounmap(drvdata->regs); err_map: - if (drvdata->flags & PLB_ACCESS_FLAG) + if (drvdata->flags & BUS_ACCESS_FLAG) release_mem_region(physaddr, 8); err_region: @@ -384,7 +384,7 @@ static int xilinxfb_release(struct device *dev) xilinx_fb_out32(drvdata, REG_CTRL, 0); /* Release the resources, as allocated based on interface */ - if (drvdata->flags & PLB_ACCESS_FLAG) { + if (drvdata->flags & BUS_ACCESS_FLAG) { iounmap(drvdata->regs); release_mem_region(drvdata->regs_phys, 8); } @@ -423,18 +423,18 @@ static int xilinxfb_of_probe(struct platform_device *op) } /* - * To check whether the core is connected directly to DCR or PLB + * To check whether the core is connected directly to DCR or BUS * interface and initialize the tft_access accordingly. */ of_property_read_u32(op->dev.of_node, "xlnx,dcr-splb-slave-if", &tft_access); /* - * Fill the resource structure if its direct PLB interface + * Fill the resource structure if its direct BUS interface * otherwise fill the dcr_host structure. */ if (tft_access) { - drvdata->flags |= PLB_ACCESS_FLAG; + drvdata->flags |= BUS_ACCESS_FLAG; rc = of_address_to_resource(op->dev.of_node, 0, &res); if (rc) { dev_err(&op->dev, "invalid address\n"); -- cgit v0.10.2 From c88fafef0135e1e1c3e23c3e32ccbeeabc587f81 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Jun 2013 12:13:19 +0200 Subject: video: xilinxfb: Use drvdata->regs_phys instead of physaddr physaddr will be remove in the next patch. Signed-off-by: Michal Simek Acked-by: Arnd Bergmann Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index d94c992..1b55f18 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -325,7 +325,7 @@ static int xilinxfb_assign(struct device *dev, if (drvdata->flags & BUS_ACCESS_FLAG) { /* Put a banner in the log (for DEBUG) */ - dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr, + dev_dbg(dev, "regs: phys=%x, virt=%p\n", drvdata->regs_phys, drvdata->regs); } /* Put a banner in the log (for DEBUG) */ @@ -353,7 +353,7 @@ err_fbmem: err_map: if (drvdata->flags & BUS_ACCESS_FLAG) - release_mem_region(physaddr, 8); + release_mem_region(drvdata->regs_phys, 8); err_region: kfree(drvdata); -- cgit v0.10.2 From a8f045aa07b3d40f46e35536eeb54e3c5423c5c2 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Jun 2013 12:13:20 +0200 Subject: video: xilinxfb: Group bus initialization Move of_address_to_resource() to xilinxfb_assign() which simplify driver probing. Signed-off-by: Michal Simek Acked-by: Arnd Bergmann Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index 1b55f18..bd3b85d 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -227,33 +227,23 @@ static struct fb_ops xilinxfb_ops = * Bus independent setup/teardown */ -static int xilinxfb_assign(struct device *dev, +static int xilinxfb_assign(struct platform_device *pdev, struct xilinxfb_drvdata *drvdata, - unsigned long physaddr, struct xilinxfb_platform_data *pdata) { int rc; + struct device *dev = &pdev->dev; int fbsize = pdata->xvirt * pdata->yvirt * BYTES_PER_PIXEL; if (drvdata->flags & BUS_ACCESS_FLAG) { - /* - * Map the control registers in if the controller - * is on direct BUS interface. - */ - if (!request_mem_region(physaddr, 8, DRIVER_NAME)) { - dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", - physaddr); - rc = -ENODEV; - goto err_region; - } + struct resource *res; - drvdata->regs_phys = physaddr; - drvdata->regs = ioremap(physaddr, 8); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + drvdata->regs_phys = res->start; + drvdata->regs = devm_request_and_ioremap(&pdev->dev, res); if (!drvdata->regs) { - dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", - physaddr); - rc = -ENODEV; - goto err_map; + rc = -EADDRNOTAVAIL; + goto err_region; } } @@ -349,11 +339,7 @@ err_cmap: err_fbmem: if (drvdata->flags & BUS_ACCESS_FLAG) - iounmap(drvdata->regs); - -err_map: - if (drvdata->flags & BUS_ACCESS_FLAG) - release_mem_region(drvdata->regs_phys, 8); + devm_iounmap(dev, drvdata->regs); err_region: kfree(drvdata); @@ -384,10 +370,8 @@ static int xilinxfb_release(struct device *dev) xilinx_fb_out32(drvdata, REG_CTRL, 0); /* Release the resources, as allocated based on interface */ - if (drvdata->flags & BUS_ACCESS_FLAG) { - iounmap(drvdata->regs); - release_mem_region(drvdata->regs_phys, 8); - } + if (drvdata->flags & BUS_ACCESS_FLAG) + devm_iounmap(dev, drvdata->regs); #ifdef CONFIG_PPC_DCR else dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); @@ -408,8 +392,7 @@ static int xilinxfb_of_probe(struct platform_device *op) const u32 *prop; u32 tft_access = 0; struct xilinxfb_platform_data pdata; - struct resource res; - int size, rc; + int size; struct xilinxfb_drvdata *drvdata; /* Copy with the default pdata (not a ptr reference!) */ @@ -435,22 +418,17 @@ static int xilinxfb_of_probe(struct platform_device *op) */ if (tft_access) { drvdata->flags |= BUS_ACCESS_FLAG; - rc = of_address_to_resource(op->dev.of_node, 0, &res); - if (rc) { - dev_err(&op->dev, "invalid address\n"); - goto err; - } } #ifdef CONFIG_PPC_DCR else { int start; - res.start = 0; start = dcr_resource_start(op->dev.of_node, 0); drvdata->dcr_len = dcr_resource_len(op->dev.of_node, 0); drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len); if (!DCR_MAP_OK(drvdata->dcr_host)) { dev_err(&op->dev, "invalid DCR address\n"); - goto err; + kfree(drvdata); + return -ENODEV; } } #endif @@ -477,11 +455,7 @@ static int xilinxfb_of_probe(struct platform_device *op) pdata.rotate_screen = 1; dev_set_drvdata(&op->dev, drvdata); - return xilinxfb_assign(&op->dev, drvdata, res.start, &pdata); - - err: - kfree(drvdata); - return -ENODEV; + return xilinxfb_assign(op, drvdata, &pdata); } static int xilinxfb_of_remove(struct platform_device *op) -- cgit v0.10.2 From 2121c339eb6fd234df16172d6a748d7007eceba8 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Jun 2013 12:13:21 +0200 Subject: video: xilinxfb: Add support for little endian accesses Dynamically detect endianess on IP and use ioread/iowrite functions instead of powerpc and microblaze specific out_be32. Signed-off-by: Michal Simek Acked-by: Arnd Bergmann Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index bd3b85d..f3d4a69 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -117,6 +117,7 @@ static struct fb_var_screeninfo xilinx_fb_var = { #define BUS_ACCESS_FLAG 0x1 /* 1 = BUS, 0 = DCR */ +#define LITTLE_ENDIAN_ACCESS 0x2 /* LITTLE ENDIAN IO functions */ struct xilinxfb_drvdata { @@ -153,14 +154,33 @@ struct xilinxfb_drvdata { static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset, u32 val) { - if (drvdata->flags & BUS_ACCESS_FLAG) - out_be32(drvdata->regs + (offset << 2), val); + if (drvdata->flags & BUS_ACCESS_FLAG) { + if (drvdata->flags & LITTLE_ENDIAN_ACCESS) + iowrite32(val, drvdata->regs + (offset << 2)); + else + iowrite32be(val, drvdata->regs + (offset << 2)); + } #ifdef CONFIG_PPC_DCR else dcr_write(drvdata->dcr_host, offset, val); #endif } +static u32 xilinx_fb_in32(struct xilinxfb_drvdata *drvdata, u32 offset) +{ + if (drvdata->flags & BUS_ACCESS_FLAG) { + if (drvdata->flags & LITTLE_ENDIAN_ACCESS) + return ioread32(drvdata->regs + (offset << 2)); + else + return ioread32be(drvdata->regs + (offset << 2)); + } +#ifdef CONFIG_PPC_DCR + else + return dcr_read(drvdata->dcr_host, offset); +#endif + return 0; +} + static int xilinx_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi) @@ -271,6 +291,12 @@ static int xilinxfb_assign(struct platform_device *pdev, /* Tell the hardware where the frame buffer is */ xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); + rc = xilinx_fb_in32(drvdata, REG_FB_ADDR); + /* Endianess detection */ + if (rc != drvdata->fb_phys) { + drvdata->flags |= LITTLE_ENDIAN_ACCESS; + xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); + } /* Turn on the display */ drvdata->reg_ctrl_default = REG_CTRL_ENABLE; -- cgit v0.10.2 From 196bf9f379ed88648ea62c86519beb6dfc385bbd Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 3 Jun 2013 12:13:22 +0200 Subject: video: xilinxfb: Use driver for Xilinx ARM Zynq Enable this driver for all Xilinx platforms. Signed-off-by: Michal Simek Acked-by: Arnd Bergmann Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index d71d60f..bed84b0 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -2188,7 +2188,7 @@ config FB_PS3_DEFAULT_SIZE_M config FB_XILINX tristate "Xilinx frame buffer support" - depends on FB && (XILINX_VIRTEX || MICROBLAZE) + depends on FB && (XILINX_VIRTEX || MICROBLAZE || ARCH_ZYNQ) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT -- cgit v0.10.2 From 12b23d5ffafcc27291f518608367ab4a7a0dd026 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Wed, 26 Jun 2013 09:50:50 +0800 Subject: video: mxsfb: remove redundant dev_err call in mxsfb_probe() There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Signed-off-by: Wei Yongjun Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 21223d4..251bbec 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -899,7 +899,6 @@ static int mxsfb_probe(struct platform_device *pdev) host->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(host->base)) { - dev_err(&pdev->dev, "ioremap failed\n"); ret = PTR_ERR(host->base); goto fb_release; } -- cgit v0.10.2 From e21d2170f36602ae2708597aabfbdf54c6144d3e Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Tue, 25 Jun 2013 10:56:07 +0900 Subject: video: remove unnecessary platform_set_drvdata() The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han Cc: Sylwester Nawrocki Acked-by: Kuninori Morimoto Acked-by: Shawn Guo Reviewed-by: H Hartley Sweeten Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 700cac0..606a3ba 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c @@ -579,7 +579,6 @@ failed: if (fbdev->info.cmap.len != 0) { fb_dealloc_cmap(&fbdev->info.cmap); } - platform_set_drvdata(dev, NULL); return -ENODEV; } diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index 2726a5b..87f288b 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c @@ -681,7 +681,6 @@ out3: out2: free_dma(CH_EPPI0); out1: - platform_set_drvdata(pdev, NULL); return ret; } diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c index 29d8c04..be65bae 100644 --- a/drivers/video/bfin-lq035q1-fb.c +++ b/drivers/video/bfin-lq035q1-fb.c @@ -759,7 +759,6 @@ static int bfin_lq035q1_probe(struct platform_device *pdev) out2: free_dma(CH_PPI); out1: - platform_set_drvdata(pdev, NULL); return ret; } @@ -788,7 +787,6 @@ static int bfin_lq035q1_remove(struct platform_device *pdev) bfin_lq035q1_free_ports(info->disp_info->ppi_mode == USE_RGB565_16_BIT_PPI); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); dev_info(&pdev->dev, "unregistered LCD driver\n"); diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c index d46da01..48c0c4e 100644 --- a/drivers/video/bfin-t350mcqb-fb.c +++ b/drivers/video/bfin-t350mcqb-fb.c @@ -578,7 +578,6 @@ out3: out2: free_dma(CH_PPI); out1: - platform_set_drvdata(pdev, NULL); return ret; } @@ -608,7 +607,6 @@ static int bfin_t350mcqb_remove(struct platform_device *pdev) bfin_t350mcqb_request_ports(0); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n"); diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c index ee1ee54..28a837d 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/ep93xx-fb.c @@ -595,7 +595,6 @@ failed_videomem: fb_dealloc_cmap(&info->cmap); failed_cmap: kfree(info); - platform_set_drvdata(pdev, NULL); return err; } @@ -614,7 +613,6 @@ static int ep93xxfb_remove(struct platform_device *pdev) fbi->mach_info->teardown(pdev); kfree(info); - platform_set_drvdata(pdev, NULL); return 0; } diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 0abf2bf..c1945b3 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -923,7 +923,6 @@ failed_getclock: failed_req: kfree(info->pseudo_palette); failed_init: - platform_set_drvdata(pdev, NULL); framebuffer_release(info); return ret; } @@ -955,8 +954,6 @@ static int imxfb_remove(struct platform_device *pdev) iounmap(fbi->regs); release_mem_region(res->start, resource_size(res)); - platform_set_drvdata(pdev, NULL); - return 0; } diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c index 36979b4..2c49112 100644 --- a/drivers/video/jz4740_fb.c +++ b/drivers/video/jz4740_fb.c @@ -737,8 +737,6 @@ static int jzfb_remove(struct platform_device *pdev) fb_dealloc_cmap(&jzfb->fb->cmap); jzfb_free_devmem(jzfb); - platform_set_drvdata(pdev, NULL); - framebuffer_release(jzfb->fb); return 0; diff --git a/drivers/video/mmp/fb/mmpfb.c b/drivers/video/mmp/fb/mmpfb.c index 6d1fa96..4ab95b8 100644 --- a/drivers/video/mmp/fb/mmpfb.c +++ b/drivers/video/mmp/fb/mmpfb.c @@ -659,7 +659,6 @@ failed_destroy_mutex: mutex_destroy(&fbi->access_ok); failed: dev_err(fbi->dev, "mmp-fb: frame buffer device init failed\n"); - platform_set_drvdata(pdev, NULL); framebuffer_release(info); diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c index 4bd31b2..c46bf5a 100644 --- a/drivers/video/mmp/hw/mmp_ctrl.c +++ b/drivers/video/mmp/hw/mmp_ctrl.c @@ -566,7 +566,6 @@ failed: devm_kfree(ctrl->dev, ctrl); } - platform_set_drvdata(pdev, NULL); dev_err(&pdev->dev, "device init failed\n"); return ret; diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 251bbec..3ba3771 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -985,8 +985,6 @@ static int mxsfb_remove(struct platform_device *pdev) framebuffer_release(fb_info); - platform_set_drvdata(pdev, NULL); - return 0; } diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index 32581c7..8c527e5 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c @@ -707,7 +707,6 @@ static int nuc900fb_remove(struct platform_device *pdev) release_resource(fbi->mem); kfree(fbi->mem); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); return 0; diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c index 97563c5..95c3c4ae 100644 --- a/drivers/video/pxa3xx-gcu.c +++ b/drivers/video/pxa3xx-gcu.c @@ -711,7 +711,6 @@ err_misc_deregister: misc_deregister(&priv->misc_dev); err_free_priv: - platform_set_drvdata(dev, NULL); free_buffers(dev, priv); kfree(priv); return ret; @@ -729,7 +728,6 @@ static int pxa3xx_gcu_remove(struct platform_device *dev) priv->shared, priv->shared_phys); iounmap(priv->mmio_base); release_mem_region(r->start, resource_size(r)); - platform_set_drvdata(dev, NULL); clk_disable(priv->clk); free_buffers(dev, priv); kfree(priv); diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 580f80c..eca2de4 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -2256,7 +2256,6 @@ failed_free_res: release_mem_region(r->start, resource_size(r)); failed_fbi: clk_put(fbi->clk); - platform_set_drvdata(dev, NULL); kfree(fbi); failed: return ret; diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 76a0e7f..21a32ad 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -1005,7 +1005,6 @@ release_regs: release_mem: release_mem_region(res->start, size); dealloc_fb: - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); return ret; } @@ -1051,7 +1050,6 @@ static int s3c2410fb_remove(struct platform_device *pdev) release_mem_region(info->mem->start, resource_size(info->mem)); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); return 0; diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index f34c858..de76da0 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -1271,7 +1271,6 @@ static int sa1100fb_probe(struct platform_device *pdev) failed: if (fbi) iounmap(fbi->base); - platform_set_drvdata(pdev, NULL); kfree(fbi); release_mem_region(res->start, resource_size(res)); return ret; diff --git a/drivers/video/sh7760fb.c b/drivers/video/sh7760fb.c index 5fbb0c7..a8c6c43 100644 --- a/drivers/video/sh7760fb.c +++ b/drivers/video/sh7760fb.c @@ -571,7 +571,6 @@ static int sh7760fb_remove(struct platform_device *dev) iounmap(par->base); release_mem_region(par->ioarea->start, resource_size(par->ioarea)); framebuffer_release(info); - platform_set_drvdata(dev, NULL); return 0; } diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 6cad530..8f6e8ff 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c @@ -567,7 +567,6 @@ static int sh_mipi_remove(struct platform_device *pdev) iounmap(mipi->base); if (res) release_mem_region(res->start, resource_size(res)); - platform_set_drvdata(pdev, NULL); kfree(mipi); return 0; diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c index dc4fb86..deb8733 100644 --- a/drivers/video/tmiofb.c +++ b/drivers/video/tmiofb.c @@ -794,7 +794,6 @@ err_hw_init: cell->disable(dev); err_enable: err_find_mode: - platform_set_drvdata(dev, NULL); free_irq(irq, info); err_request_irq: iounmap(info->screen_base); @@ -823,8 +822,6 @@ static int tmiofb_remove(struct platform_device *dev) if (cell->disable) cell->disable(dev); - platform_set_drvdata(dev, NULL); - free_irq(irq, info); iounmap(info->screen_base); diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 545faec..830ded4 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c @@ -1269,7 +1269,6 @@ static void vga16fb_destroy(struct fb_info *info) iounmap(info->screen_base); fb_dealloc_cmap(&info->cmap); /* XXX unshare VGA regions */ - platform_set_drvdata(dev, NULL); framebuffer_release(info); } diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index 9547e18..897484903 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c @@ -448,7 +448,6 @@ failed_free_io: failed_free_res: release_mem_region(res->start, resource_size(res)); failed_fbi: - platform_set_drvdata(pdev, NULL); kfree(fbi); failed: return ret; -- cgit v0.10.2 From 414aa06e874dcffaf44a80bc178ed21592c3b990 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Fri, 10 May 2013 17:05:07 +0530 Subject: video: smscufx: Use NULL instead of 0 'info' is a pointer. Use NULL instead of 0. Signed-off-by: Sachin Kamat Acked-by: Steve Glendinning Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c index b2b33fc..e188ada 100644 --- a/drivers/video/smscufx.c +++ b/drivers/video/smscufx.c @@ -1622,7 +1622,7 @@ static int ufx_usb_probe(struct usb_interface *interface, { struct usb_device *usbdev; struct ufx_data *dev; - struct fb_info *info = 0; + struct fb_info *info = NULL; int retval = -ENOMEM; u32 id_rev, fpga_rev; -- cgit v0.10.2 From 8e62e0e7f738c055ac31be6d396d427613b78c97 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Fri, 10 May 2013 17:16:48 +0530 Subject: video: udlfb: Use NULL instead of 0 Pointer variables should be initialized with NULL instead of 0. Signed-off-by: Sachin Kamat Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index ec03e72..20353a6 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -434,10 +434,10 @@ static void dlfb_compress_hline( while ((pixel_end > pixel) && (cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) { - uint8_t *raw_pixels_count_byte = 0; - uint8_t *cmd_pixels_count_byte = 0; - const uint16_t *raw_pixel_start = 0; - const uint16_t *cmd_pixel_start, *cmd_pixel_end = 0; + uint8_t *raw_pixels_count_byte = NULL; + uint8_t *cmd_pixels_count_byte = NULL; + const uint16_t *raw_pixel_start = NULL; + const uint16_t *cmd_pixel_start, *cmd_pixel_end = NULL; prefetchw((void *) cmd); /* pull in one cache line at least */ @@ -1588,7 +1588,7 @@ static int dlfb_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) { struct usb_device *usbdev; - struct dlfb_data *dev = 0; + struct dlfb_data *dev = NULL; int retval = -ENOMEM; /* usb initialization */ -- cgit v0.10.2 From 21810ee8f465b53fd2aa3dd0839b282746921251 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Fri, 10 May 2013 17:16:49 +0530 Subject: video: udlfb: Make local symbol static 'dlfb_handle_damage' is used only in this file. Make it static. Signed-off-by: Sachin Kamat Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index 20353a6..d2e5bc3 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -573,7 +573,7 @@ static int dlfb_render_hline(struct dlfb_data *dev, struct urb **urb_ptr, return 0; } -int dlfb_handle_damage(struct dlfb_data *dev, int x, int y, +static int dlfb_handle_damage(struct dlfb_data *dev, int x, int y, int width, int height, char *data) { int i, ret; -- cgit v0.10.2 From 486dd6d305ddf6229011e23226416b179425ca23 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Fri, 10 May 2013 17:25:08 +0530 Subject: video: imxfb: Make local symbols static These symbols are used only in this file. Make them static. Signed-off-by: Sachin Kamat Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index c1945b3..12af22b 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -957,7 +957,7 @@ static int imxfb_remove(struct platform_device *pdev) return 0; } -void imxfb_shutdown(struct platform_device * dev) +static void imxfb_shutdown(struct platform_device *dev) { struct fb_info *info = platform_get_drvdata(dev); struct imxfb_info *fbi = info->par; @@ -996,7 +996,7 @@ static int imxfb_setup(void) return 0; } -int __init imxfb_init(void) +static int __init imxfb_init(void) { int ret = imxfb_setup(); -- cgit v0.10.2 From 6e36308a6fb87d104452855610398446aafb0ea6 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 19 Jun 2013 19:38:13 -0700 Subject: fb: fix atyfb build warning Fix build warning when neither of CONFIG_FB_ATY_GX or CONFIG_FB_ATY_CT is enabled, since ARRAY_SIZE(aty_chips) is 0 in that case. drivers/video/aty/atyfb_base.c:437:11: warning: overflow in implicit constant conversion [-Woverflow] Signed-off-by: Randy Dunlap Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Cc: linux-fbdev@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 4f27fdc..813b7d7 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -434,8 +434,8 @@ static int correct_chipset(struct atyfb_par *par) const char *name; int i; - for (i = ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) - if (par->pci_id == aty_chips[i].pci_id) + for (i = ARRAY_SIZE(aty_chips); i > 0; i--) + if (par->pci_id == aty_chips[i - 1].pci_id) break; if (i < 0) -- cgit v0.10.2 From 9abc907ed781ea12825fde867d473c90214e3b4c Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 24 Jun 2013 10:54:20 -0700 Subject: fb: fix atyfb unused data warnings Fix compiler warnings of data defined but not used by using the __maybe_unused attribute. The date are only used with certain kconfig settings. drivers/video/aty/atyfb_base.c:534:13: warning: 'ram_dram' defined but not used [-Wunused-variable] drivers/video/aty/atyfb_base.c:535:13: warning: 'ram_resv' defined but not used [-Wunused-variable] Signed-off-by: Randy Dunlap Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Cc: linux-fbdev@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 813b7d7..a89c15d 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -531,8 +532,8 @@ static int correct_chipset(struct atyfb_par *par) return 0; } -static char ram_dram[] = "DRAM"; -static char ram_resv[] = "RESV"; +static char ram_dram[] __maybe_unused = "DRAM"; +static char ram_resv[] __maybe_unused = "RESV"; #ifdef CONFIG_FB_ATY_GX static char ram_vram[] = "VRAM"; #endif /* CONFIG_FB_ATY_GX */ -- cgit v0.10.2 From e0f3aab9105a42fa5e111a7d988b25937833a727 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Fri, 19 Apr 2013 16:05:25 +0200 Subject: uvesafb: Correct/simplify warning message Streamline it a bit. No functional change. Signed-off-by: Borislav Petkov Cc: Wang YanQing Cc: Michal Januszewski Cc: Florian Tobias Schandinat Cc: linux-fbdev@vger.kernel.org Acked-by: Wang YanQing Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index e328a61..10138b6 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -819,8 +819,8 @@ static int uvesafb_vbe_init(struct fb_info *info) if (par->pmi_setpal || par->ypan) { if (__supported_pte_mask & _PAGE_NX) { par->pmi_setpal = par->ypan = 0; - printk(KERN_WARNING "uvesafb: NX protection is actively." - "We have better not to use the PMI.\n"); + printk(KERN_WARNING "uvesafb: NX protection is active, " + "better not use the PMI.\n"); } else { uvesafb_vbe_getpmi(task, par); } -- cgit v0.10.2 From f5725af59c7dfd00809eb08ad5602b1fba58bc0f Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Sat, 1 Jun 2013 16:31:21 +0900 Subject: video: replace strict_strtoul() with kstrtoul() The usage of strict_strtoul() is not preferred, because strict_strtoul() is obsolete. Thus, kstrtoul() should be used. Signed-off-by: Jingoo Han Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 6c27805..6dd7225 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -469,7 +469,7 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s) unsigned long val; if (s) { - if (!strict_strtoul(s, 10, &val) && (val <= 2)) + if (!kstrtoul(s, 10, &val) && (val <= 2)) port = (enum fsl_diu_monitor_port) val; else if (strncmp(s, "lvds", 4) == 0) port = FSL_DIU_PORT_LVDS; @@ -1853,7 +1853,7 @@ static int __init fsl_diu_setup(char *options) if (!strncmp(opt, "monitor=", 8)) { monitor_port = fsl_diu_name_to_port(opt + 8); } else if (!strncmp(opt, "bpp=", 4)) { - if (!strict_strtoul(opt + 4, 10, &val)) + if (!kstrtoul(opt + 4, 10, &val)) default_bpp = val; } else fb_mode = opt; diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index c4f78bd..52541f2 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c @@ -573,7 +573,7 @@ static ssize_t taal_store_esd_interval(struct device *dev, unsigned long t; int r; - r = strict_strtoul(buf, 10, &t); + r = kstrtoul(buf, 10, &t); if (r) return r; @@ -611,7 +611,7 @@ static ssize_t taal_store_ulps(struct device *dev, unsigned long t; int r; - r = strict_strtoul(buf, 10, &t); + r = kstrtoul(buf, 10, &t); if (r) return r; @@ -660,7 +660,7 @@ static ssize_t taal_store_ulps_timeout(struct device *dev, unsigned long t; int r; - r = strict_strtoul(buf, 10, &t); + r = kstrtoul(buf, 10, &t); if (r) return r; diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index 01f9ace..3072f30 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -173,7 +173,7 @@ static ssize_t contrast_store(struct device *dev, struct wm8505fb_info *fbi = to_wm8505fb_info(info); unsigned long tmp; - if (strict_strtoul(buf, 10, &tmp) || (tmp > 0xff)) + if (kstrtoul(buf, 10, &tmp) || (tmp > 0xff)) return -EINVAL; fbi->contrast = tmp; -- cgit v0.10.2 From 72e5512ade915862035679ca51c4645c7fb5f1ca Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 12 Jun 2013 09:44:52 +0300 Subject: OMAPDSS: DPI: Fix wrong pixel clock limit DPI is supposed to skip odd dividers in the clock path when the pixel clock is higher than 100MHz. The code, however, defines the pixel clock limit as 1MHz. This causes the driver to skip valid clock dividers, possibly making the pixel clock to be further away from the requested one than necessary. Fix the clock limit to 100MHz. Signed-off-by: Tomi Valkeinen Cc: NeilBrown diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 757b57f..0bdcd41 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -129,7 +129,7 @@ static bool dpi_calc_dispc_cb(int lckd, int pckd, unsigned long lck, * shifted. So skip all odd dividers when the pixel clock is on the * higher side. */ - if (ctx->pck_min >= 1000000) { + if (ctx->pck_min >= 100000000) { if (lckd > 1 && lckd % 2 != 0) return false; @@ -156,7 +156,7 @@ static bool dpi_calc_hsdiv_cb(int regm_dispc, unsigned long dispc, * shifted. So skip all odd dividers when the pixel clock is on the * higher side. */ - if (regm_dispc > 1 && regm_dispc % 2 != 0 && ctx->pck_min >= 1000000) + if (regm_dispc > 1 && regm_dispc % 2 != 0 && ctx->pck_min >= 100000000) return false; ctx->dsi_cinfo.regm_dispc = regm_dispc; -- cgit v0.10.2 From 2c30aba2b2894ceb2108f1cb2602015b121e9a81 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 18 Jun 2013 10:05:29 +0300 Subject: fbmem: return -EFAULT on copy_to_user() failure copy_to_user() returns the number of bytes remaining to be copied. put_user() returns -EFAULT on error. This function ORs a bunch of stuff together and returns jumbled non-zero values on error. It should return -EFAULT. Signed-off-by: Dan Carpenter Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 098bfc6..9217be3 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1305,7 +1305,9 @@ static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix, err |= copy_to_user(fix32->reserved, fix->reserved, sizeof(fix->reserved)); - return err; + if (err) + return -EFAULT; + return 0; } static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, -- cgit v0.10.2 From 0268d130ab16668cd32428035ed0bd56bf124239 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 20 Jun 2013 18:38:46 +0200 Subject: fbdev: bfin-lq035q1-fb: Use dev_pm_ops Use dev_pm_ops instead of the legacy suspend/resume callbacks. Signed-off-by: Lars-Peter Clausen Acked-by: Michael Hennerich Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c index be65bae..b594a58 100644 --- a/drivers/video/bfin-lq035q1-fb.c +++ b/drivers/video/bfin-lq035q1-fb.c @@ -170,16 +170,19 @@ static int lq035q1_spidev_remove(struct spi_device *spi) return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT); } -#ifdef CONFIG_PM -static int lq035q1_spidev_suspend(struct spi_device *spi, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int lq035q1_spidev_suspend(struct device *dev) { + struct spi_device *spi = to_spi_device(dev); + return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT); } -static int lq035q1_spidev_resume(struct spi_device *spi) +static int lq035q1_spidev_resume(struct device *dev) { - int ret; + struct spi_device *spi = to_spi_device(dev); struct spi_control *ctl = spi_get_drvdata(spi); + int ret; ret = lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode); if (ret) @@ -187,9 +190,13 @@ static int lq035q1_spidev_resume(struct spi_device *spi) return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON); } + +static SIMPLE_DEV_PM_OPS(lq035q1_spidev_pm_ops, lq035q1_spidev_suspend, + lq035q1_spidev_resume); +#define LQ035Q1_SPIDEV_PM_OPS (&lq035q1_spidev_pm_ops) + #else -# define lq035q1_spidev_suspend NULL -# define lq035q1_spidev_resume NULL +#define LQ035Q1_SPIDEV_PM_OPS NULL #endif /* Power down all displays on reboot, poweroff or halt */ @@ -708,8 +715,7 @@ static int bfin_lq035q1_probe(struct platform_device *pdev) info->spidrv.probe = lq035q1_spidev_probe; info->spidrv.remove = lq035q1_spidev_remove; info->spidrv.shutdown = lq035q1_spidev_shutdown; - info->spidrv.suspend = lq035q1_spidev_suspend; - info->spidrv.resume = lq035q1_spidev_resume; + info->spidrv.driver.pm = LQ035Q1_SPIDEV_PM_OPS; ret = spi_register_driver(&info->spidrv); if (ret < 0) { -- cgit v0.10.2 From d22cd3016964afdacf27a0d63b65a90393b2e66a Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 26 Jun 2013 10:34:25 -0300 Subject: video: of_display_timing.h: Declare 'display_timing' Commit ffa3fd21de ("videomode: implement public of_get_display_timing()") causes the following build warning: include/video/of_display_timing.h:18:10: warning: 'struct display_timing' declared inside parameter list [enabled by default] include/video/of_display_timing.h:18:10: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] Declare 'display_timing' to avoid the build warning. Signed-off-by: Fabio Estevam Signed-off-by: Tomi Valkeinen diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h index 6562ad9..79e6697 100644 --- a/include/video/of_display_timing.h +++ b/include/video/of_display_timing.h @@ -10,6 +10,7 @@ #define __LINUX_OF_DISPLAY_TIMING_H struct device_node; +struct display_timing; struct display_timings; #define OF_USE_NATIVE_MODE -1 -- cgit v0.10.2 From 394c90f2a325a7fc9f0525517a4cc3708207b4db Mon Sep 17 00:00:00 2001 From: Yijing Wang Date: Wed, 26 Jun 2013 09:13:12 +0800 Subject: aty128fb: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM) Pci core has been saved pm cap register offset by pdev->pm_cap in pci_pm_init() in init path. So we can use pdev->pm_cap instead of using pci_find_capability(pdev, PCI_CAP_ID_PM) for better performance and simplified code. Signed-off-by: Yijing Wang Cc: Paul Mackerras Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 8c55011..a4dfe8c 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c @@ -2016,7 +2016,7 @@ static int aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent) aty128_init_engine(par); - par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM); + par->pm_reg = pdev->pm_cap; par->pdev = pdev; par->asleep = 0; par->lock_blank = 0; -- cgit v0.10.2 From 66be736921f955192ad4f75f2db38c903b191f3b Mon Sep 17 00:00:00 2001 From: Yijing Wang Date: Wed, 26 Jun 2013 09:13:41 +0800 Subject: radeon: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM) Pci core has been saved pm cap register offset by pdev->pm_cap in pci_pm_init() in init path. So we can use pdev->pm_cap instead of using pci_find_capability(pdev, PCI_CAP_ID_PM) for better performance and simplified code. Signed-off-by: Yijing Wang Cc: Benjamin Herrenschmidt Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 92bda58..f7091ec 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c @@ -2805,7 +2805,7 @@ static void radeonfb_early_resume(void *data) void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlist, int force_sleep) { /* Find PM registers in config space if any*/ - rinfo->pm_reg = pci_find_capability(rinfo->pdev, PCI_CAP_ID_PM); + rinfo->pm_reg = rinfo->pdev->pm_cap; /* Enable/Disable dynamic clocks: TODO add sysfs access */ if (rinfo->family == CHIP_FAMILY_RS480) -- cgit v0.10.2 From 464d8a54a0ca7827a2278e2122e5eb22462ae044 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Thu, 27 Jun 2013 12:45:17 +0530 Subject: video: i740fb: Make i740fb_init static i740fb_init is referenced only in this function. Make it static. Signed-off-by: Sachin Kamat Cc: Tomi Valkeinen Cc: Ondrej Zary Signed-off-by: Tomi Valkeinen diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c index cfd0c52..6c48388 100644 --- a/drivers/video/i740fb.c +++ b/drivers/video/i740fb.c @@ -1302,7 +1302,7 @@ static int __init i740fb_setup(char *options) } #endif -int __init i740fb_init(void) +static int __init i740fb_init(void) { #ifndef MODULE char *option = NULL; -- cgit v0.10.2