2727#include <linux/slab.h>
2828#include <linux/delay.h>
2929#include <video/udlfb.h>
30+ #include "edid.h"
3031
3132static struct fb_fix_screeninfo dlfb_fix = {
3233 .id = "udlfb",
@@ -1169,7 +1170,7 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
11691170 if (info->dev) /* only use mutex if info has been registered */
11701171 mutex_lock(&info->lock);
11711172
1172- edid = kmalloc(MAX_EDID_SIZE , GFP_KERNEL);
1173+ edid = kmalloc(EDID_LENGTH , GFP_KERNEL);
11731174 if (!edid) {
11741175 result = -ENOMEM;
11751176 goto error;
@@ -1185,9 +1186,9 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
11851186 */
11861187 while (tries--) {
11871188
1188- i = dlfb_get_edid(dev, edid, MAX_EDID_SIZE );
1189+ i = dlfb_get_edid(dev, edid, EDID_LENGTH );
11891190
1190- if (i >= MIN_EDID_SIZE )
1191+ if (i >= EDID_LENGTH )
11911192 fb_edid_to_monspecs(edid, &info->monspecs);
11921193
11931194 if (info->monspecs.modedb_len > 0) {
@@ -1211,7 +1212,7 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
12111212
12121213 /* If that fails, use the default EDID we were handed */
12131214 if (info->monspecs.modedb_len == 0) {
1214- if (default_edid_size >= MIN_EDID_SIZE ) {
1215+ if (default_edid_size >= EDID_LENGTH ) {
12151216 fb_edid_to_monspecs(default_edid, &info->monspecs);
12161217 if (info->monspecs.modedb_len > 0) {
12171218 memcpy(edid, default_edid, default_edid_size);
@@ -1360,9 +1361,7 @@ static ssize_t edid_store(
13601361 struct dlfb_data *dev = fb_info->par;
13611362
13621363 /* We only support write of entire EDID at once, no offset*/
1363- if ((src_size < MIN_EDID_SIZE) ||
1364- (src_size > MAX_EDID_SIZE) ||
1365- (src_off != 0))
1364+ if ((src_size != EDID_LENGTH) || (src_off != 0))
13661365 return 0;
13671366
13681367 dlfb_setup_modes(dev, fb_info, src, src_size);
@@ -1393,7 +1392,7 @@ static ssize_t metrics_reset_store(struct device *fbdev,
13931392static struct bin_attribute edid_attr = {
13941393 .attr.name = "edid",
13951394 .attr.mode = 0666,
1396- .size = MAX_EDID_SIZE ,
1395+ .size = EDID_LENGTH ,
13971396 .read = edid_show,
13981397 .write = edid_store
13991398};
0 commit comments