Skip to content

Commit b9f03a3

Browse files
committed
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>
1 parent 1a3e528 commit b9f03a3

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

‎drivers/video/udlfb.c‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/slab.h>
2828
#include <linux/delay.h>
2929
#include <video/udlfb.h>
30+
#include "edid.h"
3031

3132
static 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,
13931392
static 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
};

‎include/video/udlfb.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ struct dlfb_data {
6565
#define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
6666
#define WRITES_IN_FLIGHT (4)
6767

68-
#define MIN_EDID_SIZE 128
69-
#define MAX_EDID_SIZE 128
70-
7168
#define MAX_VENDOR_DESCRIPTOR_SIZE 256
7269

7370
#define GET_URB_TIMEOUT HZ
@@ -95,9 +92,6 @@ struct dlfb_data {
9592
#define DL_ALIGN_UP(x, a) ALIGN(x, a)
9693
#define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a)
9794

98-
/* remove once this gets added to sysfs.h */
99-
#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store)
100-
10195
/*
10296
* udlfb is both a usb device, and a framebuffer device.
10397
* They may exist at the same time, but during various stages

0 commit comments

Comments
 (0)