mirror of
https://github.com/torvalds/linux.git
synced 2024-11-08 21:21:47 +00:00
fbdev: sh_mobile_lcdcfb: minor simplifications and clean up
Remove an unused variable and simplify several pointer dereferences. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
5ef6b505d9
commit
01ac25b59f
@ -460,7 +460,6 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
|
|||||||
static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
|
static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
|
||||||
{
|
{
|
||||||
struct sh_mobile_lcdc_chan *ch;
|
struct sh_mobile_lcdc_chan *ch;
|
||||||
struct fb_videomode *lcd_cfg;
|
|
||||||
struct sh_mobile_lcdc_board_cfg *board_cfg;
|
struct sh_mobile_lcdc_board_cfg *board_cfg;
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
int k, m;
|
int k, m;
|
||||||
@ -518,7 +517,6 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
|
|||||||
|
|
||||||
for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
|
for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
|
||||||
ch = &priv->ch[k];
|
ch = &priv->ch[k];
|
||||||
lcd_cfg = &ch->cfg.lcd_cfg;
|
|
||||||
|
|
||||||
if (!ch->enabled)
|
if (!ch->enabled)
|
||||||
continue;
|
continue;
|
||||||
@ -1018,14 +1016,14 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct fb_info *info;
|
struct fb_info *info;
|
||||||
struct sh_mobile_lcdc_priv *priv;
|
struct sh_mobile_lcdc_priv *priv;
|
||||||
struct sh_mobile_lcdc_info *pdata;
|
struct sh_mobile_lcdc_info *pdata = pdev->dev.platform_data;
|
||||||
struct sh_mobile_lcdc_chan_cfg *cfg;
|
struct sh_mobile_lcdc_chan_cfg *cfg;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
int error;
|
int error;
|
||||||
void *buf;
|
void *buf;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if (!pdev->dev.platform_data) {
|
if (!pdata) {
|
||||||
dev_err(&pdev->dev, "no platform data defined\n");
|
dev_err(&pdev->dev, "no platform data defined\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -1053,32 +1051,33 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv->irq = i;
|
priv->irq = i;
|
||||||
pdata = pdev->dev.platform_data;
|
|
||||||
atomic_set(&priv->hw_usecnt, -1);
|
atomic_set(&priv->hw_usecnt, -1);
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = 0; i < ARRAY_SIZE(pdata->ch); i++) {
|
for (i = 0; i < ARRAY_SIZE(pdata->ch); i++) {
|
||||||
priv->ch[j].lcdc = priv;
|
struct sh_mobile_lcdc_chan *ch = priv->ch + j;
|
||||||
memcpy(&priv->ch[j].cfg, &pdata->ch[i], sizeof(pdata->ch[i]));
|
|
||||||
|
|
||||||
error = sh_mobile_lcdc_check_interface(&priv->ch[j]);
|
ch->lcdc = priv;
|
||||||
|
memcpy(&ch->cfg, &pdata->ch[i], sizeof(pdata->ch[i]));
|
||||||
|
|
||||||
|
error = sh_mobile_lcdc_check_interface(ch);
|
||||||
if (error) {
|
if (error) {
|
||||||
dev_err(&pdev->dev, "unsupported interface type\n");
|
dev_err(&pdev->dev, "unsupported interface type\n");
|
||||||
goto err1;
|
goto err1;
|
||||||
}
|
}
|
||||||
init_waitqueue_head(&priv->ch[j].frame_end_wait);
|
init_waitqueue_head(&ch->frame_end_wait);
|
||||||
init_completion(&priv->ch[j].vsync_completion);
|
init_completion(&ch->vsync_completion);
|
||||||
priv->ch[j].pan_offset = 0;
|
ch->pan_offset = 0;
|
||||||
|
|
||||||
switch (pdata->ch[i].chan) {
|
switch (pdata->ch[i].chan) {
|
||||||
case LCDC_CHAN_MAINLCD:
|
case LCDC_CHAN_MAINLCD:
|
||||||
priv->ch[j].enabled = 1 << 1;
|
ch->enabled = 1 << 1;
|
||||||
priv->ch[j].reg_offs = lcdc_offs_mainlcd;
|
ch->reg_offs = lcdc_offs_mainlcd;
|
||||||
j++;
|
j++;
|
||||||
break;
|
break;
|
||||||
case LCDC_CHAN_SUBLCD:
|
case LCDC_CHAN_SUBLCD:
|
||||||
priv->ch[j].enabled = 1 << 2;
|
ch->enabled = 1 << 2;
|
||||||
priv->ch[j].reg_offs = lcdc_offs_sublcd;
|
ch->reg_offs = lcdc_offs_sublcd;
|
||||||
j++;
|
j++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1102,17 +1101,19 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
for (i = 0; i < j; i++) {
|
for (i = 0; i < j; i++) {
|
||||||
struct fb_var_screeninfo *var;
|
struct fb_var_screeninfo *var;
|
||||||
struct fb_videomode *lcd_cfg;
|
const struct fb_videomode *lcd_cfg;
|
||||||
cfg = &priv->ch[i].cfg;
|
struct sh_mobile_lcdc_chan *ch = priv->ch + i;
|
||||||
|
|
||||||
priv->ch[i].info = framebuffer_alloc(0, &pdev->dev);
|
cfg = &ch->cfg;
|
||||||
if (!priv->ch[i].info) {
|
|
||||||
|
ch->info = framebuffer_alloc(0, &pdev->dev);
|
||||||
|
if (!ch->info) {
|
||||||
dev_err(&pdev->dev, "unable to allocate fb_info\n");
|
dev_err(&pdev->dev, "unable to allocate fb_info\n");
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
info = priv->ch[i].info;
|
info = ch->info;
|
||||||
var = &info->var;
|
var = &info->var;
|
||||||
lcd_cfg = &cfg->lcd_cfg;
|
lcd_cfg = &cfg->lcd_cfg;
|
||||||
info->fbops = &sh_mobile_lcdc_ops;
|
info->fbops = &sh_mobile_lcdc_ops;
|
||||||
@ -1130,28 +1131,28 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
|
|||||||
var->yres_virtual;
|
var->yres_virtual;
|
||||||
|
|
||||||
buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len,
|
buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len,
|
||||||
&priv->ch[i].dma_handle, GFP_KERNEL);
|
&ch->dma_handle, GFP_KERNEL);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
dev_err(&pdev->dev, "unable to allocate buffer\n");
|
dev_err(&pdev->dev, "unable to allocate buffer\n");
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->pseudo_palette = &priv->ch[i].pseudo_palette;
|
info->pseudo_palette = &ch->pseudo_palette;
|
||||||
info->flags = FBINFO_FLAG_DEFAULT;
|
info->flags = FBINFO_FLAG_DEFAULT;
|
||||||
|
|
||||||
error = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
|
error = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
dev_err(&pdev->dev, "unable to allocate cmap\n");
|
dev_err(&pdev->dev, "unable to allocate cmap\n");
|
||||||
dma_free_coherent(&pdev->dev, info->fix.smem_len,
|
dma_free_coherent(&pdev->dev, info->fix.smem_len,
|
||||||
buf, priv->ch[i].dma_handle);
|
buf, ch->dma_handle);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->fix.smem_start = priv->ch[i].dma_handle;
|
info->fix.smem_start = ch->dma_handle;
|
||||||
info->screen_base = buf;
|
info->screen_base = buf;
|
||||||
info->device = &pdev->dev;
|
info->device = &pdev->dev;
|
||||||
info->par = &priv->ch[i];
|
info->par = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
|
Loading…
Reference in New Issue
Block a user