diff options
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 94b1a4c5abab..05dff631591c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -285,7 +285,7 @@ static int acpi_video_device_brightness_open_fs(struct inode *inode, | |||
285 | struct file *file); | 285 | struct file *file); |
286 | static ssize_t acpi_video_device_write_brightness(struct file *file, | 286 | static ssize_t acpi_video_device_write_brightness(struct file *file, |
287 | const char __user *buffer, size_t count, loff_t *data); | 287 | const char __user *buffer, size_t count, loff_t *data); |
288 | static struct file_operations acpi_video_device_brightness_fops = { | 288 | static const struct file_operations acpi_video_device_brightness_fops = { |
289 | .owner = THIS_MODULE, | 289 | .owner = THIS_MODULE, |
290 | .open = acpi_video_device_brightness_open_fs, | 290 | .open = acpi_video_device_brightness_open_fs, |
291 | .read = seq_read, | 291 | .read = seq_read, |
@@ -1109,7 +1109,12 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
1109 | */ | 1109 | */ |
1110 | 1110 | ||
1111 | /* Does this device support video switching? */ | 1111 | /* Does this device support video switching? */ |
1112 | if (video->cap._DOS) { | 1112 | if (video->cap._DOS || video->cap._DOD) { |
1113 | if (!video->cap._DOS) { | ||
1114 | printk(KERN_WARNING FW_BUG | ||
1115 | "ACPI(%s) defines _DOD but not _DOS\n", | ||
1116 | acpi_device_bid(video->device)); | ||
1117 | } | ||
1113 | video->flags.multihead = 1; | 1118 | video->flags.multihead = 1; |
1114 | status = 0; | 1119 | status = 0; |
1115 | } | 1120 | } |
@@ -1218,7 +1223,7 @@ acpi_video_device_write_state(struct file *file, | |||
1218 | u32 state = 0; | 1223 | u32 state = 0; |
1219 | 1224 | ||
1220 | 1225 | ||
1221 | if (!dev || count + 1 > sizeof str) | 1226 | if (!dev || count >= sizeof(str)) |
1222 | return -EINVAL; | 1227 | return -EINVAL; |
1223 | 1228 | ||
1224 | if (copy_from_user(str, buffer, count)) | 1229 | if (copy_from_user(str, buffer, count)) |
@@ -1275,7 +1280,7 @@ acpi_video_device_write_brightness(struct file *file, | |||
1275 | int i; | 1280 | int i; |
1276 | 1281 | ||
1277 | 1282 | ||
1278 | if (!dev || !dev->brightness || count + 1 > sizeof str) | 1283 | if (!dev || !dev->brightness || count >= sizeof(str)) |
1279 | return -EINVAL; | 1284 | return -EINVAL; |
1280 | 1285 | ||
1281 | if (copy_from_user(str, buffer, count)) | 1286 | if (copy_from_user(str, buffer, count)) |
@@ -1557,7 +1562,7 @@ acpi_video_bus_write_POST(struct file *file, | |||
1557 | unsigned long long opt, options; | 1562 | unsigned long long opt, options; |
1558 | 1563 | ||
1559 | 1564 | ||
1560 | if (!video || count + 1 > sizeof str) | 1565 | if (!video || count >= sizeof(str)) |
1561 | return -EINVAL; | 1566 | return -EINVAL; |
1562 | 1567 | ||
1563 | status = acpi_video_bus_POST_options(video, &options); | 1568 | status = acpi_video_bus_POST_options(video, &options); |
@@ -1597,7 +1602,7 @@ acpi_video_bus_write_DOS(struct file *file, | |||
1597 | unsigned long opt; | 1602 | unsigned long opt; |
1598 | 1603 | ||
1599 | 1604 | ||
1600 | if (!video || count + 1 > sizeof str) | 1605 | if (!video || count >= sizeof(str)) |
1601 | return -EINVAL; | 1606 | return -EINVAL; |
1602 | 1607 | ||
1603 | if (copy_from_user(str, buffer, count)) | 1608 | if (copy_from_user(str, buffer, count)) |
@@ -1986,6 +1991,10 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) | |||
1986 | 1991 | ||
1987 | result = acpi_video_device_lcd_set_level(device, level_next); | 1992 | result = acpi_video_device_lcd_set_level(device, level_next); |
1988 | 1993 | ||
1994 | if (!result) | ||
1995 | backlight_force_update(device->backlight, | ||
1996 | BACKLIGHT_UPDATE_HOTKEY); | ||
1997 | |||
1989 | out: | 1998 | out: |
1990 | if (result) | 1999 | if (result) |
1991 | printk(KERN_ERR PREFIX "Failed to switch the brightness\n"); | 2000 | printk(KERN_ERR PREFIX "Failed to switch the brightness\n"); |