aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/udlfb.c15
-rw-r--r--include/video/udlfb.h6
2 files changed, 7 insertions, 14 deletions
diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
index d4f742ea0eda..530f1598de4e 100644
--- a/drivers/video/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -27,6 +27,7 @@
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <video/udlfb.h> 29#include <video/udlfb.h>
30#include "edid.h"
30 31
31static struct fb_fix_screeninfo dlfb_fix = { 32static struct fb_fix_screeninfo dlfb_fix = {
32 .id = "udlfb", 33 .id = "udlfb",
@@ -1169,7 +1170,7 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
1169 if (info->dev) /* only use mutex if info has been registered */ 1170 if (info->dev) /* only use mutex if info has been registered */
1170 mutex_lock(&info->lock); 1171 mutex_lock(&info->lock);
1171 1172
1172 edid = kmalloc(MAX_EDID_SIZE, GFP_KERNEL); 1173 edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
1173 if (!edid) { 1174 if (!edid) {
1174 result = -ENOMEM; 1175 result = -ENOMEM;
1175 goto error; 1176 goto error;
@@ -1185,9 +1186,9 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
1185 */ 1186 */
1186 while (tries--) { 1187 while (tries--) {
1187 1188
1188 i = dlfb_get_edid(dev, edid, MAX_EDID_SIZE); 1189 i = dlfb_get_edid(dev, edid, EDID_LENGTH);
1189 1190
1190 if (i >= MIN_EDID_SIZE) 1191 if (i >= EDID_LENGTH)
1191 fb_edid_to_monspecs(edid, &info->monspecs); 1192 fb_edid_to_monspecs(edid, &info->monspecs);
1192 1193
1193 if (info->monspecs.modedb_len > 0) { 1194 if (info->monspecs.modedb_len > 0) {
@@ -1211,7 +1212,7 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
1211 1212
1212 /* If that fails, use the default EDID we were handed */ 1213 /* If that fails, use the default EDID we were handed */
1213 if (info->monspecs.modedb_len == 0) { 1214 if (info->monspecs.modedb_len == 0) {
1214 if (default_edid_size >= MIN_EDID_SIZE) { 1215 if (default_edid_size >= EDID_LENGTH) {
1215 fb_edid_to_monspecs(default_edid, &info->monspecs); 1216 fb_edid_to_monspecs(default_edid, &info->monspecs);
1216 if (info->monspecs.modedb_len > 0) { 1217 if (info->monspecs.modedb_len > 0) {
1217 memcpy(edid, default_edid, default_edid_size); 1218 memcpy(edid, default_edid, default_edid_size);
@@ -1360,9 +1361,7 @@ static ssize_t edid_store(
1360 struct dlfb_data *dev = fb_info->par; 1361 struct dlfb_data *dev = fb_info->par;
1361 1362
1362 /* We only support write of entire EDID at once, no offset*/ 1363 /* We only support write of entire EDID at once, no offset*/
1363 if ((src_size < MIN_EDID_SIZE) || 1364 if ((src_size != EDID_LENGTH) || (src_off != 0))
1364 (src_size > MAX_EDID_SIZE) ||
1365 (src_off != 0))
1366 return 0; 1365 return 0;
1367 1366
1368 dlfb_setup_modes(dev, fb_info, src, src_size); 1367 dlfb_setup_modes(dev, fb_info, src, src_size);
@@ -1393,7 +1392,7 @@ static ssize_t metrics_reset_store(struct device *fbdev,
1393static struct bin_attribute edid_attr = { 1392static struct bin_attribute edid_attr = {
1394 .attr.name = "edid", 1393 .attr.name = "edid",
1395 .attr.mode = 0666, 1394 .attr.mode = 0666,
1396 .size = MAX_EDID_SIZE, 1395 .size = EDID_LENGTH,
1397 .read = edid_show, 1396 .read = edid_show,
1398 .write = edid_store 1397 .write = edid_store
1399}; 1398};
diff --git a/include/video/udlfb.h b/include/video/udlfb.h
index 6f9785e9d62e..bf857526063b 100644
--- a/include/video/udlfb.h
+++ b/include/video/udlfb.h
@@ -65,9 +65,6 @@ struct dlfb_data {
65#define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE) 65#define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
66#define WRITES_IN_FLIGHT (4) 66#define WRITES_IN_FLIGHT (4)
67 67
68#define MIN_EDID_SIZE 128
69#define MAX_EDID_SIZE 128
70
71#define MAX_VENDOR_DESCRIPTOR_SIZE 256 68#define MAX_VENDOR_DESCRIPTOR_SIZE 256
72 69
73#define GET_URB_TIMEOUT HZ 70#define GET_URB_TIMEOUT HZ
@@ -95,9 +92,6 @@ struct dlfb_data {
95#define DL_ALIGN_UP(x, a) ALIGN(x, a) 92#define DL_ALIGN_UP(x, a) ALIGN(x, a)
96#define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a) 93#define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a)
97 94
98/* remove once this gets added to sysfs.h */
99#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store)
100
101/* 95/*
102 * udlfb is both a usb device, and a framebuffer device. 96 * udlfb is both a usb device, and a framebuffer device.
103 * They may exist at the same time, but during various stages 97 * They may exist at the same time, but during various stages