aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-12-15 19:46:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:20:04 -0500
commitfa1f136e073ddc4e60497c51bc8918569314d38a (patch)
tree5e9cdd13896205eb279664ebdebfc4d0ebdc3441 /drivers
parent8130b3b9e6773367b44a19b504bb7c0c23e81a0e (diff)
clps711xfb: convert to proc_fops
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/clps711xfb.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/drivers/video/clps711xfb.c b/drivers/video/clps711xfb.c
index 16f5db471ab5..99b354b8e257 100644
--- a/drivers/video/clps711xfb.c
+++ b/drivers/video/clps711xfb.c
@@ -19,8 +19,10 @@
19 * 19 *
20 * Framebuffer driver for the CLPS7111 and EP7212 processors. 20 * Framebuffer driver for the CLPS7111 and EP7212 processors.
21 */ 21 */
22#include <linux/mm.h>
22#include <linux/module.h> 23#include <linux/module.h>
23#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/seq_file.h>
24#include <linux/slab.h> 26#include <linux/slab.h>
25#include <linux/fb.h> 27#include <linux/fb.h>
26#include <linux/init.h> 28#include <linux/init.h>
@@ -38,14 +40,6 @@ struct fb_info *cfb;
38 40
39#define CMAP_MAX_SIZE 16 41#define CMAP_MAX_SIZE 16
40 42
41/* The /proc entry for the backlight. */
42static struct proc_dir_entry *clps7111fb_backlight_proc_entry = NULL;
43
44static int clps7111fb_proc_backlight_read(char *page, char **start, off_t off,
45 int count, int *eof, void *data);
46static int clps7111fb_proc_backlight_write(struct file *file,
47 const char *buffer, unsigned long count, void *data);
48
49/* 43/*
50 * LCD AC Prescale. This comes from the LCD panel manufacturers specifications. 44 * LCD AC Prescale. This comes from the LCD panel manufacturers specifications.
51 * This determines how many clocks + 1 of CL1 before the M signal toggles. 45 * This determines how many clocks + 1 of CL1 before the M signal toggles.
@@ -221,26 +215,23 @@ static struct fb_ops clps7111fb_ops = {
221 .fb_imageblit = cfb_imageblit, 215 .fb_imageblit = cfb_imageblit,
222}; 216};
223 217
224static int 218static int backlight_proc_show(struct seq_file *m, void *v)
225clps7111fb_proc_backlight_read(char *page, char **start, off_t off,
226 int count, int *eof, void *data)
227{ 219{
228 /* We need at least two characters, one for the digit, and one for
229 * the terminating NULL. */
230 if (count < 2)
231 return -EINVAL;
232
233 if (machine_is_edb7211()) { 220 if (machine_is_edb7211()) {
234 return sprintf(page, "%d\n", 221 seq_printf(m, "%d\n",
235 (clps_readb(PDDR) & EDB_PD3_LCDBL) ? 1 : 0); 222 (clps_readb(PDDR) & EDB_PD3_LCDBL) ? 1 : 0);
236 } 223 }
237 224
238 return 0; 225 return 0;
239} 226}
240 227
241static int 228static int backlight_proc_open(struct inode *inode, struct file *file)
242clps7111fb_proc_backlight_write(struct file *file, const char *buffer, 229{
243 unsigned long count, void *data) 230 return single_open(file, backlight_proc_show, NULL);
231}
232
233static ssize_t backlight_proc_write(struct file *file, const char *buffer,
234 size_t count, loff_t *pos)
244{ 235{
245 unsigned char char_value; 236 unsigned char char_value;
246 int value; 237 int value;
@@ -271,6 +262,15 @@ clps7111fb_proc_backlight_write(struct file *file, const char *buffer,
271 return count; 262 return count;
272} 263}
273 264
265static const struct file_operations backlight_proc_fops = {
266 .owner = THIS_MODULE,
267 .open = backlight_proc_open,
268 .read = seq_read,
269 .llseek = seq_lseek,
270 .release = single_release,
271 .write = backlight_proc_write,
272};
273
274static void __init clps711x_guess_lcd_params(struct fb_info *info) 274static void __init clps711x_guess_lcd_params(struct fb_info *info)
275{ 275{
276 unsigned int lcdcon, syscon, size; 276 unsigned int lcdcon, syscon, size;
@@ -379,19 +379,11 @@ int __init clps711xfb_init(void)
379 379
380 fb_alloc_cmap(&cfb->cmap, CMAP_MAX_SIZE, 0); 380 fb_alloc_cmap(&cfb->cmap, CMAP_MAX_SIZE, 0);
381 381
382 /* Register the /proc entries. */ 382 if (!proc_create("backlight", 0444, NULL, &backlight_proc_fops)) {
383 clps7111fb_backlight_proc_entry = create_proc_entry("backlight", 0444,
384 NULL);
385 if (clps7111fb_backlight_proc_entry == NULL) {
386 printk("Couldn't create the /proc entry for the backlight.\n"); 383 printk("Couldn't create the /proc entry for the backlight.\n");
387 return -EINVAL; 384 return -EINVAL;
388 } 385 }
389 386
390 clps7111fb_backlight_proc_entry->read_proc =
391 &clps7111fb_proc_backlight_read;
392 clps7111fb_backlight_proc_entry->write_proc =
393 &clps7111fb_proc_backlight_write;
394
395 /* 387 /*
396 * Power up the LCD 388 * Power up the LCD
397 */ 389 */