aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-09-07 10:02:31 -0400
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-12 17:40:42 -0400
commit0a7f17aa3d6b693700af2e1cbf8cfdd28e18aebb (patch)
tree9c5ff513f0a4adeecbcc29d653b324b4538f4065
parent4774c12aacafc0b8be81b1d159be5a761889e2d7 (diff)
fbdev: sh_mobile_lcdc: Don't pass struct device around
Pass a pointer to a struct sh_mobile_lcdc_priv instead, which stores a pointer to the device. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 75f613b024bf..a805f96eb163 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -187,9 +187,8 @@ static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
187 } 187 }
188} 188}
189 189
190static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev, 190static int sh_mobile_lcdc_setup_clocks(struct sh_mobile_lcdc_priv *priv,
191 int clock_source, 191 int clock_source)
192 struct sh_mobile_lcdc_priv *priv)
193{ 192{
194 struct clk *clk; 193 struct clk *clk;
195 char *str; 194 char *str;
@@ -214,9 +213,9 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
214 if (str == NULL) 213 if (str == NULL)
215 return 0; 214 return 0;
216 215
217 clk = clk_get(&pdev->dev, str); 216 clk = clk_get(priv->dev, str);
218 if (IS_ERR(clk)) { 217 if (IS_ERR(clk)) {
219 dev_err(&pdev->dev, "cannot get dot clock %s\n", str); 218 dev_err(priv->dev, "cannot get dot clock %s\n", str);
220 return PTR_ERR(clk); 219 return PTR_ERR(clk);
221 } 220 }
222 221
@@ -1563,8 +1562,9 @@ static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *
1563 return 0; 1562 return 0;
1564} 1563}
1565 1564
1566static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch, 1565static int __devinit
1567 struct device *dev) 1566sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
1567 struct sh_mobile_lcdc_chan *ch)
1568{ 1568{
1569 struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg; 1569 struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
1570 const struct fb_videomode *max_mode; 1570 const struct fb_videomode *max_mode;
@@ -1580,9 +1580,9 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
1580 mutex_init(&ch->open_lock); 1580 mutex_init(&ch->open_lock);
1581 1581
1582 /* Allocate the frame buffer device. */ 1582 /* Allocate the frame buffer device. */
1583 ch->info = framebuffer_alloc(0, dev); 1583 ch->info = framebuffer_alloc(0, priv->dev);
1584 if (!ch->info) { 1584 if (!ch->info) {
1585 dev_err(dev, "unable to allocate fb_info\n"); 1585 dev_err(priv->dev, "unable to allocate fb_info\n");
1586 return -ENOMEM; 1586 return -ENOMEM;
1587 } 1587 }
1588 1588
@@ -1604,8 +1604,8 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
1604 /* NV12/NV21 buffers must have even number of lines */ 1604 /* NV12/NV21 buffers must have even number of lines */
1605 if ((cfg->fourcc == V4L2_PIX_FMT_NV12 || 1605 if ((cfg->fourcc == V4L2_PIX_FMT_NV12 ||
1606 cfg->fourcc == V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) { 1606 cfg->fourcc == V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) {
1607 dev_err(dev, "yres must be multiple of 2 for YCbCr420 " 1607 dev_err(priv->dev, "yres must be multiple of 2 for "
1608 "mode.\n"); 1608 "YCbCr420 mode.\n");
1609 return -EINVAL; 1609 return -EINVAL;
1610 } 1610 }
1611 1611
@@ -1618,7 +1618,7 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
1618 if (!max_size) 1618 if (!max_size)
1619 max_size = MAX_XRES * MAX_YRES; 1619 max_size = MAX_XRES * MAX_YRES;
1620 else 1620 else
1621 dev_dbg(dev, "Found largest videomode %ux%u\n", 1621 dev_dbg(priv->dev, "Found largest videomode %ux%u\n",
1622 max_mode->xres, max_mode->yres); 1622 max_mode->xres, max_mode->yres);
1623 1623
1624 /* Create the mode list. */ 1624 /* Create the mode list. */
@@ -1669,16 +1669,17 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
1669 max_size = max_size * var->bits_per_pixel / 8 * 2; 1669 max_size = max_size * var->bits_per_pixel / 8 * 2;
1670 1670
1671 /* Allocate frame buffer memory and color map. */ 1671 /* Allocate frame buffer memory and color map. */
1672 buf = dma_alloc_coherent(dev, max_size, &ch->dma_handle, GFP_KERNEL); 1672 buf = dma_alloc_coherent(priv->dev, max_size, &ch->dma_handle,
1673 GFP_KERNEL);
1673 if (!buf) { 1674 if (!buf) {
1674 dev_err(dev, "unable to allocate buffer\n"); 1675 dev_err(priv->dev, "unable to allocate buffer\n");
1675 return -ENOMEM; 1676 return -ENOMEM;
1676 } 1677 }
1677 1678
1678 ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0); 1679 ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
1679 if (ret < 0) { 1680 if (ret < 0) {
1680 dev_err(dev, "unable to allocate cmap\n"); 1681 dev_err(priv->dev, "unable to allocate cmap\n");
1681 dma_free_coherent(dev, max_size, buf, ch->dma_handle); 1682 dma_free_coherent(priv->dev, max_size, buf, ch->dma_handle);
1682 return ret; 1683 return ret;
1683 } 1684 }
1684 1685
@@ -1701,7 +1702,7 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
1701 } 1702 }
1702 1703
1703 info->screen_base = buf; 1704 info->screen_base = buf;
1704 info->device = dev; 1705 info->device = priv->dev;
1705 ch->display_var = *var; 1706 ch->display_var = *var;
1706 1707
1707 return 0; 1708 return 0;
@@ -1795,7 +1796,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1795 if (!priv->base) 1796 if (!priv->base)
1796 goto err1; 1797 goto err1;
1797 1798
1798 error = sh_mobile_lcdc_setup_clocks(pdev, pdata->clock_source, priv); 1799 error = sh_mobile_lcdc_setup_clocks(priv, pdata->clock_source);
1799 if (error) { 1800 if (error) {
1800 dev_err(&pdev->dev, "unable to setup clocks\n"); 1801 dev_err(&pdev->dev, "unable to setup clocks\n");
1801 goto err1; 1802 goto err1;
@@ -1807,7 +1808,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1807 for (i = 0; i < num_channels; i++) { 1808 for (i = 0; i < num_channels; i++) {
1808 struct sh_mobile_lcdc_chan *ch = priv->ch + i; 1809 struct sh_mobile_lcdc_chan *ch = priv->ch + i;
1809 1810
1810 error = sh_mobile_lcdc_channel_init(ch, &pdev->dev); 1811 error = sh_mobile_lcdc_channel_init(priv, ch);
1811 if (error) 1812 if (error)
1812 goto err1; 1813 goto err1;
1813 } 1814 }
@@ -1837,7 +1838,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1837 if (error < 0) 1838 if (error < 0)
1838 goto err1; 1839 goto err1;
1839 1840
1840 dev_info(info->dev, "registered %s/%s as %dx%d %dbpp.\n", 1841 dev_info(&pdev->dev, "registered %s/%s as %dx%d %dbpp.\n",
1841 pdev->name, (ch->cfg.chan == LCDC_CHAN_MAINLCD) ? 1842 pdev->name, (ch->cfg.chan == LCDC_CHAN_MAINLCD) ?
1842 "mainlcd" : "sublcd", info->var.xres, info->var.yres, 1843 "mainlcd" : "sublcd", info->var.xres, info->var.yres,
1843 info->var.bits_per_pixel); 1844 info->var.bits_per_pixel);