diff options
author | Jon Smirl <jonsmirl@gmail.com> | 2006-04-12 19:43:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-27 16:08:56 -0400 |
commit | 913e7ec545462b9a49fa308d0c81697236f7d29d (patch) | |
tree | a2cacb4c2536ce09f4c43032dabd54042e886bfc | |
parent | 2be4d50295e2b6f62c07b614e1b103e280dddb84 (diff) |
[PATCH] Frame buffer: remove cmap sysfs interface
Remove it as it does not work properly due to sysfs core changes.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/video/fbsysfs.c | 92 |
1 files changed, 3 insertions, 89 deletions
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index b72b05250a9d..34e07399756b 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -305,94 +305,6 @@ static ssize_t show_stride(struct class_device *class_device, char *buf) | |||
305 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->fix.line_length); | 305 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->fix.line_length); |
306 | } | 306 | } |
307 | 307 | ||
308 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ | ||
309 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ | ||
310 | /* 256 rows at 16 chars equals 4096, the normal page size */ | ||
311 | /* the code will automatically adjust for different page sizes */ | ||
312 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, | ||
313 | size_t count) | ||
314 | { | ||
315 | struct fb_info *fb_info = class_get_devdata(class_device); | ||
316 | int rc, i, start, length, transp = 0; | ||
317 | |||
318 | if ((count > PAGE_SIZE) || ((count % 16) != 0)) | ||
319 | return -EINVAL; | ||
320 | |||
321 | if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap) | ||
322 | return -EINVAL; | ||
323 | |||
324 | sscanf(buf, "%02x", &start); | ||
325 | length = count / 16; | ||
326 | |||
327 | for (i = 0; i < length; i++) | ||
328 | if (buf[i * 16 + 2] != ' ') | ||
329 | transp = 1; | ||
330 | |||
331 | /* If we can batch, do it */ | ||
332 | if (fb_info->fbops->fb_setcmap && length > 1) { | ||
333 | struct fb_cmap umap; | ||
334 | |||
335 | memset(&umap, 0, sizeof(umap)); | ||
336 | if ((rc = fb_alloc_cmap(&umap, length, transp))) | ||
337 | return rc; | ||
338 | |||
339 | umap.start = start; | ||
340 | for (i = 0; i < length; i++) { | ||
341 | sscanf(&buf[i * 16 + 3], "%4hx", &umap.red[i]); | ||
342 | sscanf(&buf[i * 16 + 7], "%4hx", &umap.blue[i]); | ||
343 | sscanf(&buf[i * 16 + 11], "%4hx", &umap.green[i]); | ||
344 | if (transp) | ||
345 | umap.transp[i] = (buf[i * 16 + 2] != ' '); | ||
346 | } | ||
347 | rc = fb_info->fbops->fb_setcmap(&umap, fb_info); | ||
348 | fb_copy_cmap(&umap, &fb_info->cmap); | ||
349 | fb_dealloc_cmap(&umap); | ||
350 | |||
351 | return rc ?: count; | ||
352 | } | ||
353 | for (i = 0; i < length; i++) { | ||
354 | u16 red, blue, green, tsp; | ||
355 | |||
356 | sscanf(&buf[i * 16 + 3], "%4hx", &red); | ||
357 | sscanf(&buf[i * 16 + 7], "%4hx", &blue); | ||
358 | sscanf(&buf[i * 16 + 11], "%4hx", &green); | ||
359 | tsp = (buf[i * 16 + 2] != ' '); | ||
360 | if ((rc = fb_info->fbops->fb_setcolreg(start++, | ||
361 | red, green, blue, tsp, fb_info))) | ||
362 | return rc; | ||
363 | |||
364 | fb_info->cmap.red[i] = red; | ||
365 | fb_info->cmap.blue[i] = blue; | ||
366 | fb_info->cmap.green[i] = green; | ||
367 | if (transp) | ||
368 | fb_info->cmap.transp[i] = tsp; | ||
369 | } | ||
370 | return count; | ||
371 | } | ||
372 | |||
373 | static ssize_t show_cmap(struct class_device *class_device, char *buf) | ||
374 | { | ||
375 | struct fb_info *fb_info = class_get_devdata(class_device); | ||
376 | unsigned int i; | ||
377 | |||
378 | if (!fb_info->cmap.red || !fb_info->cmap.blue || | ||
379 | !fb_info->cmap.green) | ||
380 | return -EINVAL; | ||
381 | |||
382 | if (fb_info->cmap.len > PAGE_SIZE / 16) | ||
383 | return -EINVAL; | ||
384 | |||
385 | /* don't mess with the format, the buffer is PAGE_SIZE */ | ||
386 | /* 256 entries at 16 chars per line equals 4096 = PAGE_SIZE */ | ||
387 | for (i = 0; i < fb_info->cmap.len; i++) { | ||
388 | snprintf(&buf[ i * 16], PAGE_SIZE - i * 16, "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start, | ||
389 | ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '), | ||
390 | fb_info->cmap.red[i], fb_info->cmap.blue[i], | ||
391 | fb_info->cmap.green[i]); | ||
392 | } | ||
393 | return 16 * fb_info->cmap.len; | ||
394 | } | ||
395 | |||
396 | static ssize_t store_blank(struct class_device *class_device, const char * buf, | 308 | static ssize_t store_blank(struct class_device *class_device, const char * buf, |
397 | size_t count) | 309 | size_t count) |
398 | { | 310 | { |
@@ -502,10 +414,12 @@ static ssize_t show_fbstate(struct class_device *class_device, char *buf) | |||
502 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->state); | 414 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->state); |
503 | } | 415 | } |
504 | 416 | ||
417 | /* When cmap is added back in it should be a binary attribute | ||
418 | * not a text one. Consideration should also be given to converting | ||
419 | * fbdev to use configfs instead of sysfs */ | ||
505 | static struct class_device_attribute class_device_attrs[] = { | 420 | static struct class_device_attribute class_device_attrs[] = { |
506 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), | 421 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), |
507 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), | 422 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), |
508 | __ATTR(color_map, S_IRUGO|S_IWUSR, show_cmap, store_cmap), | ||
509 | __ATTR(console, S_IRUGO|S_IWUSR, show_console, store_console), | 423 | __ATTR(console, S_IRUGO|S_IWUSR, show_console, store_console), |
510 | __ATTR(cursor, S_IRUGO|S_IWUSR, show_cursor, store_cursor), | 424 | __ATTR(cursor, S_IRUGO|S_IWUSR, show_cursor, store_cursor), |
511 | __ATTR(mode, S_IRUGO|S_IWUSR, show_mode, store_mode), | 425 | __ATTR(mode, S_IRUGO|S_IWUSR, show_mode, store_mode), |