aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/udlfb.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-01-06 04:04:02 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-01-06 04:04:02 -0500
commitb9f03a3cd06c6f8bbecfe08eae2a69cc0a13c690 (patch)
tree6e6166c7eafffda30e30182d731bc1dae19bdd83 /drivers/video/udlfb.c
parent1a3e528cfc00a9d08114c5fa9e486a77633a425d (diff)
video: udlfb: Kill off some magic constants for EDID sizing.
The edid length is fixed, so use the standard definition consistently. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/udlfb.c')
-rw-r--r--drivers/video/udlfb.c15
1 files changed, 7 insertions, 8 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};