aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
commit20b4fb485227404329e41ad15588afad3df23050 (patch)
treef3e099f0ab3da8a93b447203e294d2bb22f6dc05 /drivers/char
parentb9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff)
parentac3e3c5b1164397656df81b9e9ab4991184d3236 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro, Misc cleanups all over the place, mainly wrt /proc interfaces (switch create_proc_entry to proc_create(), get rid of the deprecated create_proc_read_entry() in favor of using proc_create_data() and seq_file etc). 7kloc removed. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits) don't bother with deferred freeing of fdtables proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h proc: Make the PROC_I() and PDE() macros internal to procfs proc: Supply a function to remove a proc entry by PDE take cgroup_open() and cpuset_open() to fs/proc/base.c ppc: Clean up scanlog ppc: Clean up rtas_flash driver somewhat hostap: proc: Use remove_proc_subtree() drm: proc: Use remove_proc_subtree() drm: proc: Use minor->index to label things, not PDE->name drm: Constify drm_proc_list[] zoran: Don't print proc_dir_entry data in debug reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() proc: Supply an accessor for getting the data from a PDE's parent airo: Use remove_proc_subtree() rtl8192u: Don't need to save device proc dir PDE rtl8187se: Use a dir under /proc/net/r8180/ proc: Add proc_mkdir_data() proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h} proc: Move PDE_NET() to fs/proc/proc_net.c ...
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ds1620.c34
-rw-r--r--drivers/char/efirtc.c83
-rw-r--r--drivers/char/genrtc.c48
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c8
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c6
5 files changed, 89 insertions, 90 deletions
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c
index 24ffd8cec51e..544b4ce617f8 100644
--- a/drivers/char/ds1620.c
+++ b/drivers/char/ds1620.c
@@ -6,6 +6,7 @@
6#include <linux/miscdevice.h> 6#include <linux/miscdevice.h>
7#include <linux/delay.h> 7#include <linux/delay.h>
8#include <linux/proc_fs.h> 8#include <linux/proc_fs.h>
9#include <linux/seq_file.h>
9#include <linux/capability.h> 10#include <linux/capability.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/mutex.h> 12#include <linux/mutex.h>
@@ -329,9 +330,7 @@ ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
329} 330}
330 331
331#ifdef THERM_USE_PROC 332#ifdef THERM_USE_PROC
332static int 333static int ds1620_proc_therm_show(struct seq_file *m, void *v)
333proc_therm_ds1620_read(char *buf, char **start, off_t offset,
334 int len, int *eof, void *unused)
335{ 334{
336 struct therm th; 335 struct therm th;
337 int temp; 336 int temp;
@@ -339,17 +338,25 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset,
339 ds1620_read_state(&th); 338 ds1620_read_state(&th);
340 temp = cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9)); 339 temp = cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9));
341 340
342 len = sprintf(buf, "Thermostat: HI %i.%i, LOW %i.%i; " 341 seq_printf(m, "Thermostat: HI %i.%i, LOW %i.%i; temperature: %i.%i C, fan %s\n",
343 "temperature: %i.%i C, fan %s\n", 342 th.hi >> 1, th.hi & 1 ? 5 : 0,
344 th.hi >> 1, th.hi & 1 ? 5 : 0, 343 th.lo >> 1, th.lo & 1 ? 5 : 0,
345 th.lo >> 1, th.lo & 1 ? 5 : 0, 344 temp >> 1, temp & 1 ? 5 : 0,
346 temp >> 1, temp & 1 ? 5 : 0, 345 fan_state[netwinder_get_fan()]);
347 fan_state[netwinder_get_fan()]); 346 return 0;
347}
348 348
349 return len; 349static int ds1620_proc_therm_open(struct inode *inode, struct file *file)
350{
351 return single_open(file, ds1620_proc_therm_show, NULL);
350} 352}
351 353
352static struct proc_dir_entry *proc_therm_ds1620; 354static const struct file_operations ds1620_proc_therm_fops = {
355 .open = ds1620_proc_therm_open,
356 .read = seq_read,
357 .llseek = seq_lseek,
358 .release = seq_release,
359};
353#endif 360#endif
354 361
355static const struct file_operations ds1620_fops = { 362static const struct file_operations ds1620_fops = {
@@ -397,10 +404,7 @@ static int __init ds1620_init(void)
397 return ret; 404 return ret;
398 405
399#ifdef THERM_USE_PROC 406#ifdef THERM_USE_PROC
400 proc_therm_ds1620 = create_proc_entry("therm", 0, NULL); 407 if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops))
401 if (proc_therm_ds1620)
402 proc_therm_ds1620->read_proc = proc_therm_ds1620_read;
403 else
404 printk(KERN_ERR "therm: unable to register /proc/therm\n"); 408 printk(KERN_ERR "therm: unable to register /proc/therm\n");
405#endif 409#endif
406 410
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c
index a082d00b0f11..ea54a6e3f5ad 100644
--- a/drivers/char/efirtc.c
+++ b/drivers/char/efirtc.c
@@ -34,6 +34,7 @@
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/rtc.h> 35#include <linux/rtc.h>
36#include <linux/proc_fs.h> 36#include <linux/proc_fs.h>
37#include <linux/seq_file.h>
37#include <linux/efi.h> 38#include <linux/efi.h>
38#include <linux/uaccess.h> 39#include <linux/uaccess.h>
39 40
@@ -296,12 +297,10 @@ static struct miscdevice efi_rtc_dev= {
296/* 297/*
297 * We export RAW EFI information to /proc/driver/efirtc 298 * We export RAW EFI information to /proc/driver/efirtc
298 */ 299 */
299static int 300static int efi_rtc_proc_show(struct seq_file *m, void *v)
300efi_rtc_get_status(char *buf)
301{ 301{
302 efi_time_t eft, alm; 302 efi_time_t eft, alm;
303 efi_time_cap_t cap; 303 efi_time_cap_t cap;
304 char *p = buf;
305 efi_bool_t enabled, pending; 304 efi_bool_t enabled, pending;
306 unsigned long flags; 305 unsigned long flags;
307 306
@@ -316,64 +315,63 @@ efi_rtc_get_status(char *buf)
316 315
317 spin_unlock_irqrestore(&efi_rtc_lock,flags); 316 spin_unlock_irqrestore(&efi_rtc_lock,flags);
318 317
319 p += sprintf(p, 318 seq_printf(m,
320 "Time : %u:%u:%u.%09u\n" 319 "Time : %u:%u:%u.%09u\n"
321 "Date : %u-%u-%u\n" 320 "Date : %u-%u-%u\n"
322 "Daylight : %u\n", 321 "Daylight : %u\n",
323 eft.hour, eft.minute, eft.second, eft.nanosecond, 322 eft.hour, eft.minute, eft.second, eft.nanosecond,
324 eft.year, eft.month, eft.day, 323 eft.year, eft.month, eft.day,
325 eft.daylight); 324 eft.daylight);
326 325
327 if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) 326 if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE)
328 p += sprintf(p, "Timezone : unspecified\n"); 327 seq_puts(m, "Timezone : unspecified\n");
329 else 328 else
330 /* XXX fixme: convert to string? */ 329 /* XXX fixme: convert to string? */
331 p += sprintf(p, "Timezone : %u\n", eft.timezone); 330 seq_printf(m, "Timezone : %u\n", eft.timezone);
332 331
333 332
334 p += sprintf(p, 333 seq_printf(m,
335 "Alarm Time : %u:%u:%u.%09u\n" 334 "Alarm Time : %u:%u:%u.%09u\n"
336 "Alarm Date : %u-%u-%u\n" 335 "Alarm Date : %u-%u-%u\n"
337 "Alarm Daylight : %u\n" 336 "Alarm Daylight : %u\n"
338 "Enabled : %s\n" 337 "Enabled : %s\n"
339 "Pending : %s\n", 338 "Pending : %s\n",
340 alm.hour, alm.minute, alm.second, alm.nanosecond, 339 alm.hour, alm.minute, alm.second, alm.nanosecond,
341 alm.year, alm.month, alm.day, 340 alm.year, alm.month, alm.day,
342 alm.daylight, 341 alm.daylight,
343 enabled == 1 ? "yes" : "no", 342 enabled == 1 ? "yes" : "no",
344 pending == 1 ? "yes" : "no"); 343 pending == 1 ? "yes" : "no");
345 344
346 if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) 345 if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE)
347 p += sprintf(p, "Timezone : unspecified\n"); 346 seq_puts(m, "Timezone : unspecified\n");
348 else 347 else
349 /* XXX fixme: convert to string? */ 348 /* XXX fixme: convert to string? */
350 p += sprintf(p, "Timezone : %u\n", alm.timezone); 349 seq_printf(m, "Timezone : %u\n", alm.timezone);
351 350
352 /* 351 /*
353 * now prints the capabilities 352 * now prints the capabilities
354 */ 353 */
355 p += sprintf(p, 354 seq_printf(m,
356 "Resolution : %u\n" 355 "Resolution : %u\n"
357 "Accuracy : %u\n" 356 "Accuracy : %u\n"
358 "SetstoZero : %u\n", 357 "SetstoZero : %u\n",
359 cap.resolution, cap.accuracy, cap.sets_to_zero); 358 cap.resolution, cap.accuracy, cap.sets_to_zero);
360 359
361 return p - buf; 360 return 0;
362} 361}
363 362
364static int 363static int efi_rtc_proc_open(struct inode *inode, struct file *file)
365efi_rtc_read_proc(char *page, char **start, off_t off,
366 int count, int *eof, void *data)
367{ 364{
368 int len = efi_rtc_get_status(page); 365 return single_open(file, efi_rtc_proc_show, NULL);
369 if (len <= off+count) *eof = 1;
370 *start = page + off;
371 len -= off;
372 if (len>count) len = count;
373 if (len<0) len = 0;
374 return len;
375} 366}
376 367
368static const struct file_operations efi_rtc_proc_fops = {
369 .open = efi_rtc_proc_open,
370 .read = seq_read,
371 .llseek = seq_lseek,
372 .release = seq_release,
373};
374
377static int __init 375static int __init
378efi_rtc_init(void) 376efi_rtc_init(void)
379{ 377{
@@ -389,8 +387,7 @@ efi_rtc_init(void)
389 return ret; 387 return ret;
390 } 388 }
391 389
392 dir = create_proc_read_entry ("driver/efirtc", 0, NULL, 390 dir = proc_create("driver/efirtc", 0, NULL, &efi_rtc_proc_fops);
393 efi_rtc_read_proc, NULL);
394 if (dir == NULL) { 391 if (dir == NULL) {
395 printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n"); 392 printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n");
396 misc_deregister(&efi_rtc_dev); 393 misc_deregister(&efi_rtc_dev);
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 21cb980f1157..bc9b84d56ee4 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -52,6 +52,7 @@
52#include <linux/init.h> 52#include <linux/init.h>
53#include <linux/poll.h> 53#include <linux/poll.h>
54#include <linux/proc_fs.h> 54#include <linux/proc_fs.h>
55#include <linux/seq_file.h>
55#include <linux/mutex.h> 56#include <linux/mutex.h>
56#include <linux/workqueue.h> 57#include <linux/workqueue.h>
57 58
@@ -386,18 +387,15 @@ static int gen_rtc_release(struct inode *inode, struct file *file)
386 * Info exported via "/proc/driver/rtc". 387 * Info exported via "/proc/driver/rtc".
387 */ 388 */
388 389
389static int gen_rtc_proc_output(char *buf) 390static int gen_rtc_proc_show(struct seq_file *m, void *v)
390{ 391{
391 char *p;
392 struct rtc_time tm; 392 struct rtc_time tm;
393 unsigned int flags; 393 unsigned int flags;
394 struct rtc_pll_info pll; 394 struct rtc_pll_info pll;
395 395
396 p = buf;
397
398 flags = get_rtc_time(&tm); 396 flags = get_rtc_time(&tm);
399 397
400 p += sprintf(p, 398 seq_printf(m,
401 "rtc_time\t: %02d:%02d:%02d\n" 399 "rtc_time\t: %02d:%02d:%02d\n"
402 "rtc_date\t: %04d-%02d-%02d\n" 400 "rtc_date\t: %04d-%02d-%02d\n"
403 "rtc_epoch\t: %04u\n", 401 "rtc_epoch\t: %04u\n",
@@ -406,23 +404,23 @@ static int gen_rtc_proc_output(char *buf)
406 404
407 tm.tm_hour = tm.tm_min = tm.tm_sec = 0; 405 tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
408 406
409 p += sprintf(p, "alarm\t\t: "); 407 seq_puts(m, "alarm\t\t: ");
410 if (tm.tm_hour <= 24) 408 if (tm.tm_hour <= 24)
411 p += sprintf(p, "%02d:", tm.tm_hour); 409 seq_printf(m, "%02d:", tm.tm_hour);
412 else 410 else
413 p += sprintf(p, "**:"); 411 seq_puts(m, "**:");
414 412
415 if (tm.tm_min <= 59) 413 if (tm.tm_min <= 59)
416 p += sprintf(p, "%02d:", tm.tm_min); 414 seq_printf(m, "%02d:", tm.tm_min);
417 else 415 else
418 p += sprintf(p, "**:"); 416 seq_puts(m, "**:");
419 417
420 if (tm.tm_sec <= 59) 418 if (tm.tm_sec <= 59)
421 p += sprintf(p, "%02d\n", tm.tm_sec); 419 seq_printf(m, "%02d\n", tm.tm_sec);
422 else 420 else
423 p += sprintf(p, "**\n"); 421 seq_puts(m, "**\n");
424 422
425 p += sprintf(p, 423 seq_printf(m,
426 "DST_enable\t: %s\n" 424 "DST_enable\t: %s\n"
427 "BCD\t\t: %s\n" 425 "BCD\t\t: %s\n"
428 "24hr\t\t: %s\n" 426 "24hr\t\t: %s\n"
@@ -442,7 +440,7 @@ static int gen_rtc_proc_output(char *buf)
442 0L /* freq */, 440 0L /* freq */,
443 (flags & RTC_BATT_BAD) ? "bad" : "okay"); 441 (flags & RTC_BATT_BAD) ? "bad" : "okay");
444 if (!get_rtc_pll(&pll)) 442 if (!get_rtc_pll(&pll))
445 p += sprintf(p, 443 seq_printf(m,
446 "PLL adjustment\t: %d\n" 444 "PLL adjustment\t: %d\n"
447 "PLL max +ve adjustment\t: %d\n" 445 "PLL max +ve adjustment\t: %d\n"
448 "PLL max -ve adjustment\t: %d\n" 446 "PLL max -ve adjustment\t: %d\n"
@@ -455,26 +453,26 @@ static int gen_rtc_proc_output(char *buf)
455 pll.pll_posmult, 453 pll.pll_posmult,
456 pll.pll_negmult, 454 pll.pll_negmult,
457 pll.pll_clock); 455 pll.pll_clock);
458 return p - buf; 456 return 0;
459} 457}
460 458
461static int gen_rtc_read_proc(char *page, char **start, off_t off, 459static int gen_rtc_proc_open(struct inode *inode, struct file *file)
462 int count, int *eof, void *data)
463{ 460{
464 int len = gen_rtc_proc_output (page); 461 return single_open(file, gen_rtc_proc_show, NULL);
465 if (len <= off+count) *eof = 1;
466 *start = page + off;
467 len -= off;
468 if (len>count) len = count;
469 if (len<0) len = 0;
470 return len;
471} 462}
472 463
464static const struct file_operations gen_rtc_proc_fops = {
465 .open = gen_rtc_proc_open,
466 .read = seq_read,
467 .llseek = seq_lseek,
468 .release = seq_release,
469};
470
473static int __init gen_rtc_proc_init(void) 471static int __init gen_rtc_proc_init(void)
474{ 472{
475 struct proc_dir_entry *r; 473 struct proc_dir_entry *r;
476 474
477 r = create_proc_read_entry("driver/rtc", 0, NULL, gen_rtc_read_proc, NULL); 475 r = proc_create("driver/rtc", 0, NULL, &gen_rtc_proc_fops);
478 if (!r) 476 if (!r)
479 return -ENOMEM; 477 return -ENOMEM;
480 return 0; 478 return 0;
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 053201b062a4..4d439d2fcfd6 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -1917,7 +1917,7 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v)
1917 1917
1918static int smi_ipmb_proc_open(struct inode *inode, struct file *file) 1918static int smi_ipmb_proc_open(struct inode *inode, struct file *file)
1919{ 1919{
1920 return single_open(file, smi_ipmb_proc_show, PDE(inode)->data); 1920 return single_open(file, smi_ipmb_proc_show, PDE_DATA(inode));
1921} 1921}
1922 1922
1923static const struct file_operations smi_ipmb_proc_ops = { 1923static const struct file_operations smi_ipmb_proc_ops = {
@@ -1938,7 +1938,7 @@ static int smi_version_proc_show(struct seq_file *m, void *v)
1938 1938
1939static int smi_version_proc_open(struct inode *inode, struct file *file) 1939static int smi_version_proc_open(struct inode *inode, struct file *file)
1940{ 1940{
1941 return single_open(file, smi_version_proc_show, PDE(inode)->data); 1941 return single_open(file, smi_version_proc_show, PDE_DATA(inode));
1942} 1942}
1943 1943
1944static const struct file_operations smi_version_proc_ops = { 1944static const struct file_operations smi_version_proc_ops = {
@@ -2013,7 +2013,7 @@ static int smi_stats_proc_show(struct seq_file *m, void *v)
2013 2013
2014static int smi_stats_proc_open(struct inode *inode, struct file *file) 2014static int smi_stats_proc_open(struct inode *inode, struct file *file)
2015{ 2015{
2016 return single_open(file, smi_stats_proc_show, PDE(inode)->data); 2016 return single_open(file, smi_stats_proc_show, PDE_DATA(inode));
2017} 2017}
2018 2018
2019static const struct file_operations smi_stats_proc_ops = { 2019static const struct file_operations smi_stats_proc_ops = {
@@ -4541,7 +4541,7 @@ static void __exit cleanup_ipmi(void)
4541 del_timer_sync(&ipmi_timer); 4541 del_timer_sync(&ipmi_timer);
4542 4542
4543#ifdef CONFIG_PROC_FS 4543#ifdef CONFIG_PROC_FS
4544 remove_proc_entry(proc_ipmi_root->name, NULL); 4544 proc_remove(proc_ipmi_root);
4545#endif /* CONFIG_PROC_FS */ 4545#endif /* CONFIG_PROC_FS */
4546 4546
4547 driver_unregister(&ipmidriver.driver); 4547 driver_unregister(&ipmidriver.driver);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 0ac9b45a585e..313538abe63c 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2839,7 +2839,7 @@ static int smi_type_proc_show(struct seq_file *m, void *v)
2839 2839
2840static int smi_type_proc_open(struct inode *inode, struct file *file) 2840static int smi_type_proc_open(struct inode *inode, struct file *file)
2841{ 2841{
2842 return single_open(file, smi_type_proc_show, PDE(inode)->data); 2842 return single_open(file, smi_type_proc_show, PDE_DATA(inode));
2843} 2843}
2844 2844
2845static const struct file_operations smi_type_proc_ops = { 2845static const struct file_operations smi_type_proc_ops = {
@@ -2882,7 +2882,7 @@ static int smi_si_stats_proc_show(struct seq_file *m, void *v)
2882 2882
2883static int smi_si_stats_proc_open(struct inode *inode, struct file *file) 2883static int smi_si_stats_proc_open(struct inode *inode, struct file *file)
2884{ 2884{
2885 return single_open(file, smi_si_stats_proc_show, PDE(inode)->data); 2885 return single_open(file, smi_si_stats_proc_show, PDE_DATA(inode));
2886} 2886}
2887 2887
2888static const struct file_operations smi_si_stats_proc_ops = { 2888static const struct file_operations smi_si_stats_proc_ops = {
@@ -2910,7 +2910,7 @@ static int smi_params_proc_show(struct seq_file *m, void *v)
2910 2910
2911static int smi_params_proc_open(struct inode *inode, struct file *file) 2911static int smi_params_proc_open(struct inode *inode, struct file *file)
2912{ 2912{
2913 return single_open(file, smi_params_proc_show, PDE(inode)->data); 2913 return single_open(file, smi_params_proc_show, PDE_DATA(inode));
2914} 2914}
2915 2915
2916static const struct file_operations smi_params_proc_ops = { 2916static const struct file_operations smi_params_proc_ops = {