diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/backlight/apple_dwi_bl.c | 1 | ||||
-rw-r--r-- | drivers/video/backlight/as3711_bl.c | 1 | ||||
-rw-r--r-- | drivers/video/backlight/backlight.c | 1 | ||||
-rw-r--r-- | drivers/video/backlight/da9052_bl.c | 1 | ||||
-rw-r--r-- | drivers/video/backlight/jornada720_bl.c | 1 | ||||
-rw-r--r-- | drivers/video/backlight/ktd2801-backlight.c | 1 | ||||
-rw-r--r-- | drivers/video/backlight/led_bl.c | 5 | ||||
-rw-r--r-- | drivers/video/backlight/lp855x_bl.c | 2 | ||||
-rw-r--r-- | drivers/video/backlight/mp3309c.c | 14 | ||||
-rw-r--r-- | drivers/video/backlight/rave-sp-backlight.c | 2 | ||||
-rw-r--r-- | drivers/video/backlight/rt4831-backlight.c | 1 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fbcon.c | 13 | ||||
-rw-r--r-- | drivers/video/screen_info_generic.c | 55 |
13 files changed, 85 insertions, 13 deletions
diff --git a/drivers/video/backlight/apple_dwi_bl.c b/drivers/video/backlight/apple_dwi_bl.c index 93bd744972d6..ed8bf13d3f51 100644 --- a/drivers/video/backlight/apple_dwi_bl.c +++ b/drivers/video/backlight/apple_dwi_bl.c @@ -9,6 +9,7 @@ #include <linux/bitfield.h> #include <linux/device.h> #include <linux/io.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/platform_device.h> diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c index 9f89eb19894e..753160bbc3e7 100644 --- a/drivers/video/backlight/as3711_bl.c +++ b/drivers/video/backlight/as3711_bl.c @@ -13,6 +13,7 @@ #include <linux/kernel.h> #include <linux/mfd/as3711.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/slab.h> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 9dc93c5e480b..1e9b7e85d99a 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -16,6 +16,7 @@ #include <linux/ctype.h> #include <linux/err.h> #include <linux/slab.h> +#include <linux/of.h> #ifdef CONFIG_PMAC_BACKLIGHT #include <asm/backlight.h> diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c index f41523d78121..2493138febfa 100644 --- a/drivers/video/backlight/da9052_bl.c +++ b/drivers/video/backlight/da9052_bl.c @@ -9,6 +9,7 @@ #include <linux/backlight.h> #include <linux/delay.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/platform_device.h> diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c index e28d2c071798..bbb65fdaddc7 100644 --- a/drivers/video/backlight/jornada720_bl.c +++ b/drivers/video/backlight/jornada720_bl.c @@ -7,6 +7,7 @@ #include <linux/backlight.h> #include <linux/device.h> +#include <linux/io.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> diff --git a/drivers/video/backlight/ktd2801-backlight.c b/drivers/video/backlight/ktd2801-backlight.c index 0489b0615ceb..17eac1b3bce4 100644 --- a/drivers/video/backlight/ktd2801-backlight.c +++ b/drivers/video/backlight/ktd2801-backlight.c @@ -6,6 +6,7 @@ #include <linux/backlight.h> #include <linux/gpio/consumer.h> #include <linux/leds-expresswire.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/property.h> diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c index d2db157b2c29..efc5e380669a 100644 --- a/drivers/video/backlight/led_bl.c +++ b/drivers/video/backlight/led_bl.c @@ -9,6 +9,7 @@ #include <linux/backlight.h> #include <linux/leds.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/platform_device.h> struct led_bl_data { @@ -89,7 +90,7 @@ static int led_bl_get_leds(struct device *dev, return -EINVAL; } - leds = devm_kzalloc(dev, sizeof(struct led_classdev *) * nb_leds, + leds = devm_kcalloc(dev, nb_leds, sizeof(struct led_classdev *), GFP_KERNEL); if (!leds) return -ENOMEM; @@ -137,7 +138,7 @@ static int led_bl_parse_levels(struct device *dev, unsigned int db; u32 *levels = NULL; - levels = devm_kzalloc(dev, sizeof(u32) * num_levels, + levels = devm_kcalloc(dev, num_levels, sizeof(u32), GFP_KERNEL); if (!levels) return -ENOMEM; diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index 7075bfab59c4..d191560ce285 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -22,7 +22,7 @@ #define LP855X_DEVICE_CTRL 0x01 #define LP855X_EEPROM_START 0xA0 #define LP855X_EEPROM_END 0xA7 -#define LP8556_EPROM_START 0xA0 +#define LP8556_EPROM_START 0x98 #define LP8556_EPROM_END 0xAF /* LP8555/7 Registers */ diff --git a/drivers/video/backlight/mp3309c.c b/drivers/video/backlight/mp3309c.c index 372058e26129..9337110ce6e5 100644 --- a/drivers/video/backlight/mp3309c.c +++ b/drivers/video/backlight/mp3309c.c @@ -222,7 +222,6 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip, if (IS_ERR(chip->pwmd)) return dev_err_probe(dev, PTR_ERR(chip->pwmd), "error getting pwm data\n"); pdata->dimming_mode = DIMMING_PWM; - pwm_apply_args(chip->pwmd); } /* @@ -353,12 +352,13 @@ static int mp3309c_probe(struct i2c_client *client) chip->pdata = pdata; /* Backlight properties */ - memset(&props, 0, sizeof(struct backlight_properties)); - props.brightness = pdata->default_brightness; - props.max_brightness = pdata->max_brightness; - props.scale = BACKLIGHT_SCALE_LINEAR; - props.type = BACKLIGHT_RAW; - props.power = BACKLIGHT_POWER_ON; + props = (typeof(props)){ + .brightness = pdata->default_brightness, + .max_brightness = pdata->max_brightness, + .scale = BACKLIGHT_SCALE_LINEAR, + .type = BACKLIGHT_RAW, + .power = BACKLIGHT_POWER_ON, + }; chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip, &mp3309c_bl_ops, &props); if (IS_ERR(chip->bl)) diff --git a/drivers/video/backlight/rave-sp-backlight.c b/drivers/video/backlight/rave-sp-backlight.c index e708a060a6e4..bfe01b9b9174 100644 --- a/drivers/video/backlight/rave-sp-backlight.c +++ b/drivers/video/backlight/rave-sp-backlight.c @@ -9,8 +9,10 @@ #include <linux/backlight.h> #include <linux/kernel.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/mfd/rave-sp.h> +#include <linux/of.h> #include <linux/platform_device.h> #define RAVE_SP_BACKLIGHT_LCD_EN BIT(7) diff --git a/drivers/video/backlight/rt4831-backlight.c b/drivers/video/backlight/rt4831-backlight.c index 7ead75929a43..26214519bfce 100644 --- a/drivers/video/backlight/rt4831-backlight.c +++ b/drivers/video/backlight/rt4831-backlight.c @@ -4,6 +4,7 @@ #include <linux/backlight.h> #include <linux/bitops.h> #include <linux/kernel.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/property.h> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index b062b05f4128..96cc9b389246 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2497,7 +2497,7 @@ static int fbcon_set_font(struct vc_data *vc, const struct console_font *font, unsigned charcount = font->charcount; int w = font->width; int h = font->height; - int size; + int size, alloc_size; int i, csum; u8 *new_data, *data = font->data; int pitch = PITCH(font->width); @@ -2524,9 +2524,16 @@ static int fbcon_set_font(struct vc_data *vc, const struct console_font *font, if (fbcon_invalid_charcount(info, charcount)) return -EINVAL; - size = CALC_FONTSZ(h, pitch, charcount); + /* Check for integer overflow in font size calculation */ + if (check_mul_overflow(h, pitch, &size) || + check_mul_overflow(size, charcount, &size)) + return -EINVAL; + + /* Check for overflow in allocation size calculation */ + if (check_add_overflow(FONT_EXTRA_WORDS * sizeof(int), size, &alloc_size)) + return -EINVAL; - new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER); + new_data = kmalloc(alloc_size, GFP_USER); if (!new_data) return -ENOMEM; diff --git a/drivers/video/screen_info_generic.c b/drivers/video/screen_info_generic.c index 900e9386eceb..763adbba71cb 100644 --- a/drivers/video/screen_info_generic.c +++ b/drivers/video/screen_info_generic.c @@ -5,6 +5,8 @@ #include <linux/screen_info.h> #include <linux/string.h> +#include <video/pixel_format.h> + static void resource_init_named(struct resource *r, resource_size_t start, resource_size_t size, const char *name, unsigned int flags) @@ -180,3 +182,56 @@ u32 __screen_info_lfb_bits_per_pixel(const struct screen_info *si) return bits_per_pixel; } EXPORT_SYMBOL(__screen_info_lfb_bits_per_pixel); + +static int __screen_info_lfb_pixel_format(const struct screen_info *si, struct pixel_format *f) +{ + u32 bits_per_pixel = __screen_info_lfb_bits_per_pixel(si); + + if (bits_per_pixel > U8_MAX) + return -EINVAL; + + f->bits_per_pixel = bits_per_pixel; + + if (si->lfb_depth > 8) { + f->indexed = false; + f->alpha.offset = 0; + f->alpha.length = 0; + f->red.offset = si->red_pos; + f->red.length = si->red_size; + f->green.offset = si->green_pos; + f->green.length = si->green_size; + f->blue.offset = si->blue_pos; + f->blue.length = si->blue_size; + } else { + f->indexed = true; + f->index.offset = 0; + f->index.length = si->lfb_depth; + } + + return 0; +} + +/** + * screen_info_pixel_format - Returns the screen-info format as pixel-format description + * + * @si: the screen_info + * @f: pointer to return pixel-format description + * + * Returns: + * 0 on success, or a negative errno code otherwise. + */ +int screen_info_pixel_format(const struct screen_info *si, struct pixel_format *f) +{ + unsigned int type = screen_info_video_type(si); + + /* TODO: Add support for additional types as needed. */ + switch (type) { + case VIDEO_TYPE_VLFB: + case VIDEO_TYPE_EFI: + return __screen_info_lfb_pixel_format(si, f); + } + + /* not supported */ + return -EINVAL; +} +EXPORT_SYMBOL(screen_info_pixel_format); |