Skip to content

Commit 42110e9

Browse files
plagniojtomba
authored andcommitted
video: atmel_lcdfb: introduce atmel_lcdfb_power_control
to simplify the check on the presence of the callback Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]>
1 parent 8af2c28 commit 42110e9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/video/atmel_lcdfb.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo)
288288
init_backlight(sinfo);
289289
}
290290

291+
static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on)
292+
{
293+
struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
294+
295+
if (pdata->atmel_lcdfb_power_control)
296+
pdata->atmel_lcdfb_power_control(on);
297+
}
291298

292299
static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
293300
.type = FB_TYPE_PACKED_PIXELS,
@@ -1122,8 +1129,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
11221129
fb_add_videomode(&fbmode, &info->modelist);
11231130

11241131
/* Power up the LCDC screen */
1125-
if (pdata->atmel_lcdfb_power_control)
1126-
pdata->atmel_lcdfb_power_control(1);
1132+
atmel_lcdfb_power_control(sinfo, 1);
11271133

11281134
dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n",
11291135
info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
@@ -1175,8 +1181,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
11751181

11761182
cancel_work_sync(&sinfo->task);
11771183
exit_backlight(sinfo);
1178-
if (pdata->atmel_lcdfb_power_control)
1179-
pdata->atmel_lcdfb_power_control(0);
1184+
atmel_lcdfb_power_control(sinfo, 0);
11801185
unregister_framebuffer(info);
11811186
atmel_lcdfb_stop_clock(sinfo);
11821187
clk_put(sinfo->lcdc_clk);
@@ -1203,7 +1208,6 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
12031208
{
12041209
struct fb_info *info = platform_get_drvdata(pdev);
12051210
struct atmel_lcdfb_info *sinfo = info->par;
1206-
struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
12071211

12081212
/*
12091213
* We don't want to handle interrupts while the clock is
@@ -1213,9 +1217,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
12131217

12141218
sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
12151219
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
1216-
if (pdata->atmel_lcdfb_power_control)
1217-
pdata->atmel_lcdfb_power_control(0);
1218-
1220+
atmel_lcdfb_power_control(sinfo, 0);
12191221
atmel_lcdfb_stop(sinfo);
12201222
atmel_lcdfb_stop_clock(sinfo);
12211223

@@ -1226,12 +1228,10 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
12261228
{
12271229
struct fb_info *info = platform_get_drvdata(pdev);
12281230
struct atmel_lcdfb_info *sinfo = info->par;
1229-
struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
12301231

12311232
atmel_lcdfb_start_clock(sinfo);
12321233
atmel_lcdfb_start(sinfo);
1233-
if (pdata->atmel_lcdfb_power_control)
1234-
pdata->atmel_lcdfb_power_control(1);
1234+
atmel_lcdfb_power_control(sinfo, 1);
12351235
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
12361236

12371237
/* Enable FIFO & DMA errors */

0 commit comments

Comments
 (0)