Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexey Dobriyan and committed by
Linus Torvalds
fa1f136e 8130b3b9

+21 -29
+21 -29
drivers/video/clps711xfb.c
··· 19 19 * 20 20 * Framebuffer driver for the CLPS7111 and EP7212 processors. 21 21 */ 22 + #include <linux/mm.h> 22 23 #include <linux/module.h> 23 24 #include <linux/kernel.h> 25 + #include <linux/seq_file.h> 24 26 #include <linux/slab.h> 25 27 #include <linux/fb.h> 26 28 #include <linux/init.h> ··· 39 37 struct fb_info *cfb; 40 38 41 39 #define CMAP_MAX_SIZE 16 42 - 43 - /* The /proc entry for the backlight. */ 44 - static struct proc_dir_entry *clps7111fb_backlight_proc_entry = NULL; 45 - 46 - static int clps7111fb_proc_backlight_read(char *page, char **start, off_t off, 47 - int count, int *eof, void *data); 48 - static int clps7111fb_proc_backlight_write(struct file *file, 49 - const char *buffer, unsigned long count, void *data); 50 40 51 41 /* 52 42 * LCD AC Prescale. This comes from the LCD panel manufacturers specifications. ··· 215 221 .fb_imageblit = cfb_imageblit, 216 222 }; 217 223 218 - static int 219 - clps7111fb_proc_backlight_read(char *page, char **start, off_t off, 220 - int count, int *eof, void *data) 224 + static int backlight_proc_show(struct seq_file *m, void *v) 221 225 { 222 - /* We need at least two characters, one for the digit, and one for 223 - * the terminating NULL. */ 224 - if (count < 2) 225 - return -EINVAL; 226 - 227 226 if (machine_is_edb7211()) { 228 - return sprintf(page, "%d\n", 227 + seq_printf(m, "%d\n", 229 228 (clps_readb(PDDR) & EDB_PD3_LCDBL) ? 1 : 0); 230 229 } 231 230 232 231 return 0; 233 232 } 234 233 235 - static int 236 - clps7111fb_proc_backlight_write(struct file *file, const char *buffer, 237 - unsigned long count, void *data) 234 + static int backlight_proc_open(struct inode *inode, struct file *file) 235 + { 236 + return single_open(file, backlight_proc_show, NULL); 237 + } 238 + 239 + static ssize_t backlight_proc_write(struct file *file, const char *buffer, 240 + size_t count, loff_t *pos) 238 241 { 239 242 unsigned char char_value; 240 243 int value; ··· 261 270 262 271 return count; 263 272 } 273 + 274 + static const struct file_operations backlight_proc_fops = { 275 + .owner = THIS_MODULE, 276 + .open = backlight_proc_open, 277 + .read = seq_read, 278 + .llseek = seq_lseek, 279 + .release = single_release, 280 + .write = backlight_proc_write, 281 + }; 264 282 265 283 static void __init clps711x_guess_lcd_params(struct fb_info *info) 266 284 { ··· 379 379 380 380 fb_alloc_cmap(&cfb->cmap, CMAP_MAX_SIZE, 0); 381 381 382 - /* Register the /proc entries. */ 383 - clps7111fb_backlight_proc_entry = create_proc_entry("backlight", 0444, 384 - NULL); 385 - if (clps7111fb_backlight_proc_entry == NULL) { 382 + if (!proc_create("backlight", 0444, NULL, &backlight_proc_fops)) { 386 383 printk("Couldn't create the /proc entry for the backlight.\n"); 387 384 return -EINVAL; 388 385 } 389 - 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 386 395 387 /* 396 388 * Power up the LCD