Skip to content

Commit 870c3a9

Browse files
committed
Merge tag 'fbdev-for-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev fixes from Helge Deller: - fix fbcon to prevent fonts bigger than 32x32 pixels to avoid overflows reported by syzbot - switch omapfb to use kstrtobool() - switch some fbdev drivers to use the backlight helpers * tag 'fbdev-for-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: fbcon: Check font dimension limits fbdev: omapfb: Use kstrtobool() instead of strtobool() fbdev: fbmon: fix function name in kernel-doc fbdev: atmel_lcdfb: Rework backlight status updates fbdev: riva: Use backlight helper fbdev: omapfb: panel-dsi-cm: Use backlight helper fbdev: nvidia: Use backlight helper fbdev: mx3fb: Use backlight helper fbdev: radeon: Use backlight helper fbdev: atyfb: Use backlight helper fbdev: aty128fb: Use backlight helper
2 parents 9e48260 + 2b09d5d commit 870c3a9

File tree

14 files changed

+27
-75
lines changed

14 files changed

+27
-75
lines changed

drivers/video/fbdev/atmel_lcdfb.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct atmel_lcdfb_info {
4949
struct clk *lcdc_clk;
5050

5151
struct backlight_device *backlight;
52-
u8 bl_power;
5352
u8 saved_lcdcon;
5453

5554
u32 pseudo_palette[16];
@@ -109,22 +108,7 @@ static u32 contrast_ctr = ATMEL_LCDC_PS_DIV8
109108
static int atmel_bl_update_status(struct backlight_device *bl)
110109
{
111110
struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
112-
int power = sinfo->bl_power;
113-
int brightness = bl->props.brightness;
114-
115-
/* REVISIT there may be a meaningful difference between
116-
* fb_blank and power ... there seem to be some cases
117-
* this doesn't handle correctly.
118-
*/
119-
if (bl->props.fb_blank != sinfo->bl_power)
120-
power = bl->props.fb_blank;
121-
else if (bl->props.power != sinfo->bl_power)
122-
power = bl->props.power;
123-
124-
if (brightness < 0 && power == FB_BLANK_UNBLANK)
125-
brightness = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
126-
else if (power != FB_BLANK_UNBLANK)
127-
brightness = 0;
111+
int brightness = backlight_get_brightness(bl);
128112

129113
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness);
130114
if (contrast_ctr & ATMEL_LCDC_POL_POSITIVE)
@@ -133,8 +117,6 @@ static int atmel_bl_update_status(struct backlight_device *bl)
133117
else
134118
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
135119

136-
bl->props.fb_blank = bl->props.power = sinfo->bl_power = power;
137-
138120
return 0;
139121
}
140122

@@ -155,8 +137,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)
155137
struct backlight_properties props;
156138
struct backlight_device *bl;
157139

158-
sinfo->bl_power = FB_BLANK_UNBLANK;
159-
160140
if (sinfo->backlight)
161141
return;
162142

drivers/video/fbdev/aty/aty128fb.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,12 +1766,10 @@ static int aty128_bl_update_status(struct backlight_device *bd)
17661766
unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL);
17671767
int level;
17681768

1769-
if (bd->props.power != FB_BLANK_UNBLANK ||
1770-
bd->props.fb_blank != FB_BLANK_UNBLANK ||
1771-
!par->lcd_on)
1769+
if (!par->lcd_on)
17721770
level = 0;
17731771
else
1774-
level = bd->props.brightness;
1772+
level = backlight_get_brightness(bd);
17751773

17761774
reg |= LVDS_BL_MOD_EN | LVDS_BLON;
17771775
if (level > 0) {

drivers/video/fbdev/aty/atyfb_base.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,13 +2219,7 @@ static int aty_bl_update_status(struct backlight_device *bd)
22192219
{
22202220
struct atyfb_par *par = bl_get_data(bd);
22212221
unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
2222-
int level;
2223-
2224-
if (bd->props.power != FB_BLANK_UNBLANK ||
2225-
bd->props.fb_blank != FB_BLANK_UNBLANK)
2226-
level = 0;
2227-
else
2228-
level = bd->props.brightness;
2222+
int level = backlight_get_brightness(bd);
22292223

22302224
reg |= (BLMOD_EN | BIASMOD_EN);
22312225
if (level > 0) {

drivers/video/fbdev/aty/radeon_backlight.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ static int radeon_bl_update_status(struct backlight_device *bd)
5757
* backlight. This provides some greater power saving and the display
5858
* is useless without backlight anyway.
5959
*/
60-
if (bd->props.power != FB_BLANK_UNBLANK ||
61-
bd->props.fb_blank != FB_BLANK_UNBLANK)
62-
level = 0;
63-
else
64-
level = bd->props.brightness;
60+
level = backlight_get_brightness(bd);
6561

6662
del_timer_sync(&rinfo->lvds_timer);
6763
radeon_engine_idle();

drivers/video/fbdev/core/fbcon.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,9 +2495,12 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
24952495
h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
24962496
return -EINVAL;
24972497

2498+
if (font->width > 32 || font->height > 32)
2499+
return -EINVAL;
2500+
24982501
/* Make sure drawing engine can handle the font */
2499-
if (!(info->pixmap.blit_x & (1 << (font->width - 1))) ||
2500-
!(info->pixmap.blit_y & (1 << (font->height - 1))))
2502+
if (!(info->pixmap.blit_x & BIT(font->width - 1)) ||
2503+
!(info->pixmap.blit_y & BIT(font->height - 1)))
25012504
return -EINVAL;
25022505

25032506
/* Make sure driver can handle the font length */

drivers/video/fbdev/core/fbmon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ static u32 fb_get_vblank(u32 hfreq)
10501050
}
10511051

10521052
/**
1053-
* fb_get_hblank_by_freq - get horizontal blank time given hfreq
1053+
* fb_get_hblank_by_hfreq - get horizontal blank time given hfreq
10541054
* @hfreq: horizontal freq
10551055
* @xres: horizontal resolution in pixels
10561056
*

drivers/video/fbdev/mx3fb.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl)
283283
static int mx3fb_bl_update_status(struct backlight_device *bl)
284284
{
285285
struct mx3fb_data *fbd = bl_get_data(bl);
286-
int brightness = bl->props.brightness;
287-
288-
if (bl->props.power != FB_BLANK_UNBLANK)
289-
brightness = 0;
290-
if (bl->props.fb_blank != FB_BLANK_UNBLANK)
291-
brightness = 0;
286+
int brightness = backlight_get_brightness(bl);
292287

293288
fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness;
294289

drivers/video/fbdev/nvidia/nv_backlight.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
4949
{
5050
struct nvidia_par *par = bl_get_data(bd);
5151
u32 tmp_pcrt, tmp_pmc, fpcontrol;
52-
int level;
52+
int level = backlight_get_brightness(bd);
5353

5454
if (!par->FlatPanel)
5555
return 0;
5656

57-
if (bd->props.power != FB_BLANK_UNBLANK ||
58-
bd->props.fb_blank != FB_BLANK_UNBLANK)
59-
level = 0;
60-
else
61-
level = bd->props.brightness;
62-
6357
tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF;
6458
tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC;
6559
fpcontrol = NV_RD32(par->PRAMDAC, 0x0848) & 0xCFFFFFCC;

drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
331331
struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
332332
struct omap_dss_device *in = ddata->in;
333333
int r;
334-
int level;
335-
336-
if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
337-
dev->props.power == FB_BLANK_UNBLANK)
338-
level = dev->props.brightness;
339-
else
340-
level = 0;
334+
int level = backlight_get_brightness(dev);
341335

342336
dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
343337

drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define DSS_SUBSYS_NAME "DISPLAY"
1111

1212
#include <linux/kernel.h>
13+
#include <linux/kstrtox.h>
1314
#include <linux/module.h>
1415
#include <linux/platform_device.h>
1516
#include <linux/sysfs.h>
@@ -36,7 +37,7 @@ static ssize_t display_enabled_store(struct omap_dss_device *dssdev,
3637
int r;
3738
bool enable;
3839

39-
r = strtobool(buf, &enable);
40+
r = kstrtobool(buf, &enable);
4041
if (r)
4142
return r;
4243

@@ -73,7 +74,7 @@ static ssize_t display_tear_store(struct omap_dss_device *dssdev,
7374
if (!dssdev->driver->enable_te || !dssdev->driver->get_te)
7475
return -ENOENT;
7576

76-
r = strtobool(buf, &te);
77+
r = kstrtobool(buf, &te);
7778
if (r)
7879
return r;
7980

@@ -183,7 +184,7 @@ static ssize_t display_mirror_store(struct omap_dss_device *dssdev,
183184
if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror)
184185
return -ENOENT;
185186

186-
r = strtobool(buf, &mirror);
187+
r = kstrtobool(buf, &mirror);
187188
if (r)
188189
return r;
189190

0 commit comments

Comments
 (0)