summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 17:51:54 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 17:51:54 -0700
commit20b4fb485227404329e41ad15588afad3df23050 (patch)
treef3e099f0ab3da8a93b447203e294d2bb22f6dc05 /drivers/char
parentb9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff)
parentac3e3c5b1164397656df81b9e9ab4991184d3236 (diff)
downloadlinux-3.10-20b4fb485227404329e41ad15588afad3df23050.tar.gz
linux-3.10-20b4fb485227404329e41ad15588afad3df23050.tar.bz2
linux-3.10-20b4fb485227404329e41ad15588afad3df23050.zip
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 24ffd8cec51..544b4ce617f 100644
--- a/drivers/char/ds1620.c
+++ b/drivers/char/ds1620.c
@@ -6,6 +6,7 @@
#include <linux/miscdevice.h>
#include <linux/delay.h>
#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include <linux/capability.h>
#include <linux/init.h>
#include <linux/mutex.h>
@@ -329,9 +330,7 @@ ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
#ifdef THERM_USE_PROC
-static int
-proc_therm_ds1620_read(char *buf, char **start, off_t offset,
- int len, int *eof, void *unused)
+static int ds1620_proc_therm_show(struct seq_file *m, void *v)
{
struct therm th;
int temp;
@@ -339,17 +338,25 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset,
ds1620_read_state(&th);
temp = cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9));
- len = sprintf(buf, "Thermostat: HI %i.%i, LOW %i.%i; "
- "temperature: %i.%i C, fan %s\n",
- th.hi >> 1, th.hi & 1 ? 5 : 0,
- th.lo >> 1, th.lo & 1 ? 5 : 0,
- temp >> 1, temp & 1 ? 5 : 0,
- fan_state[netwinder_get_fan()]);
+ seq_printf(m, "Thermostat: HI %i.%i, LOW %i.%i; temperature: %i.%i C, fan %s\n",
+ th.hi >> 1, th.hi & 1 ? 5 : 0,
+ th.lo >> 1, th.lo & 1 ? 5 : 0,
+ temp >> 1, temp & 1 ? 5 : 0,
+ fan_state[netwinder_get_fan()]);
+ return 0;
+}
- return len;
+static int ds1620_proc_therm_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, ds1620_proc_therm_show, NULL);
}
-static struct proc_dir_entry *proc_therm_ds1620;
+static const struct file_operations ds1620_proc_therm_fops = {
+ .open = ds1620_proc_therm_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
#endif
static const struct file_operations ds1620_fops = {
@@ -397,10 +404,7 @@ static int __init ds1620_init(void)
return ret;
#ifdef THERM_USE_PROC
- proc_therm_ds1620 = create_proc_entry("therm", 0, NULL);
- if (proc_therm_ds1620)
- proc_therm_ds1620->read_proc = proc_therm_ds1620_read;
- else
+ if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops))
printk(KERN_ERR "therm: unable to register /proc/therm\n");
#endif
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c
index a082d00b0f1..ea54a6e3f5a 100644
--- a/drivers/char/efirtc.c
+++ b/drivers/char/efirtc.c
@@ -34,6 +34,7 @@
#include <linux/init.h>
#include <linux/rtc.h>
#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include <linux/efi.h>
#include <linux/uaccess.h>
@@ -296,12 +297,10 @@ static struct miscdevice efi_rtc_dev= {
/*
* We export RAW EFI information to /proc/driver/efirtc
*/
-static int
-efi_rtc_get_status(char *buf)
+static int efi_rtc_proc_show(struct seq_file *m, void *v)
{
efi_time_t eft, alm;
efi_time_cap_t cap;
- char *p = buf;
efi_bool_t enabled, pending;
unsigned long flags;
@@ -316,64 +315,63 @@ efi_rtc_get_status(char *buf)
spin_unlock_irqrestore(&efi_rtc_lock,flags);
- p += sprintf(p,
- "Time : %u:%u:%u.%09u\n"
- "Date : %u-%u-%u\n"
- "Daylight : %u\n",
- eft.hour, eft.minute, eft.second, eft.nanosecond,
- eft.year, eft.month, eft.day,
- eft.daylight);
+ seq_printf(m,
+ "Time : %u:%u:%u.%09u\n"
+ "Date : %u-%u-%u\n"
+ "Daylight : %u\n",
+ eft.hour, eft.minute, eft.second, eft.nanosecond,
+ eft.year, eft.month, eft.day,
+ eft.daylight);
if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE)
- p += sprintf(p, "Timezone : unspecified\n");
+ seq_puts(m, "Timezone : unspecified\n");
else
/* XXX fixme: convert to string? */
- p += sprintf(p, "Timezone : %u\n", eft.timezone);
+ seq_printf(m, "Timezone : %u\n", eft.timezone);
- p += sprintf(p,
- "Alarm Time : %u:%u:%u.%09u\n"
- "Alarm Date : %u-%u-%u\n"
- "Alarm Daylight : %u\n"
- "Enabled : %s\n"
- "Pending : %s\n",
- alm.hour, alm.minute, alm.second, alm.nanosecond,
- alm.year, alm.month, alm.day,
- alm.daylight,
- enabled == 1 ? "yes" : "no",
- pending == 1 ? "yes" : "no");
+ seq_printf(m,
+ "Alarm Time : %u:%u:%u.%09u\n"
+ "Alarm Date : %u-%u-%u\n"
+ "Alarm Daylight : %u\n"
+ "Enabled : %s\n"
+ "Pending : %s\n",
+ alm.hour, alm.minute, alm.second, alm.nanosecond,
+ alm.year, alm.month, alm.day,
+ alm.daylight,
+ enabled == 1 ? "yes" : "no",
+ pending == 1 ? "yes" : "no");
if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE)
- p += sprintf(p, "Timezone : unspecified\n");
+ seq_puts(m, "Timezone : unspecified\n");
else
/* XXX fixme: convert to string? */
- p += sprintf(p, "Timezone : %u\n", alm.timezone);
+ seq_printf(m, "Timezone : %u\n", alm.timezone);
/*
* now prints the capabilities
*/
- p += sprintf(p,
- "Resolution : %u\n"
- "Accuracy : %u\n"
- "SetstoZero : %u\n",
- cap.resolution, cap.accuracy, cap.sets_to_zero);
+ seq_printf(m,
+ "Resolution : %u\n"
+ "Accuracy : %u\n"
+ "SetstoZero : %u\n",
+ cap.resolution, cap.accuracy, cap.sets_to_zero);
- return p - buf;
+ return 0;
}
-static int
-efi_rtc_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int efi_rtc_proc_open(struct inode *inode, struct file *file)
{
- int len = efi_rtc_get_status(page);
- if (len <= off+count) *eof = 1;
- *start = page + off;
- len -= off;
- if (len>count) len = count;
- if (len<0) len = 0;
- return len;
+ return single_open(file, efi_rtc_proc_show, NULL);
}
+static const struct file_operations efi_rtc_proc_fops = {
+ .open = efi_rtc_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
static int __init
efi_rtc_init(void)
{
@@ -389,8 +387,7 @@ efi_rtc_init(void)
return ret;
}
- dir = create_proc_read_entry ("driver/efirtc", 0, NULL,
- efi_rtc_read_proc, NULL);
+ dir = proc_create("driver/efirtc", 0, NULL, &efi_rtc_proc_fops);
if (dir == NULL) {
printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n");
misc_deregister(&efi_rtc_dev);
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 21cb980f115..bc9b84d56ee 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -52,6 +52,7 @@
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
@@ -386,18 +387,15 @@ static int gen_rtc_release(struct inode *inode, struct file *file)
* Info exported via "/proc/driver/rtc".
*/
-static int gen_rtc_proc_output(char *buf)
+static int gen_rtc_proc_show(struct seq_file *m, void *v)
{
- char *p;
struct rtc_time tm;
unsigned int flags;
struct rtc_pll_info pll;
- p = buf;
-
flags = get_rtc_time(&tm);
- p += sprintf(p,
+ seq_printf(m,
"rtc_time\t: %02d:%02d:%02d\n"
"rtc_date\t: %04d-%02d-%02d\n"
"rtc_epoch\t: %04u\n",
@@ -406,23 +404,23 @@ static int gen_rtc_proc_output(char *buf)
tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
- p += sprintf(p, "alarm\t\t: ");
+ seq_puts(m, "alarm\t\t: ");
if (tm.tm_hour <= 24)
- p += sprintf(p, "%02d:", tm.tm_hour);
+ seq_printf(m, "%02d:", tm.tm_hour);
else
- p += sprintf(p, "**:");
+ seq_puts(m, "**:");
if (tm.tm_min <= 59)
- p += sprintf(p, "%02d:", tm.tm_min);
+ seq_printf(m, "%02d:", tm.tm_min);
else
- p += sprintf(p, "**:");
+ seq_puts(m, "**:");
if (tm.tm_sec <= 59)
- p += sprintf(p, "%02d\n", tm.tm_sec);
+ seq_printf(m, "%02d\n", tm.tm_sec);
else
- p += sprintf(p, "**\n");
+ seq_puts(m, "**\n");
- p += sprintf(p,
+ seq_printf(m,
"DST_enable\t: %s\n"
"BCD\t\t: %s\n"
"24hr\t\t: %s\n"
@@ -442,7 +440,7 @@ static int gen_rtc_proc_output(char *buf)
0L /* freq */,
(flags & RTC_BATT_BAD) ? "bad" : "okay");
if (!get_rtc_pll(&pll))
- p += sprintf(p,
+ seq_printf(m,
"PLL adjustment\t: %d\n"
"PLL max +ve adjustment\t: %d\n"
"PLL max -ve adjustment\t: %d\n"
@@ -455,26 +453,26 @@ static int gen_rtc_proc_output(char *buf)
pll.pll_posmult,
pll.pll_negmult,
pll.pll_clock);
- return p - buf;
+ return 0;
}
-static int gen_rtc_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int gen_rtc_proc_open(struct inode *inode, struct file *file)
{
- int len = gen_rtc_proc_output (page);
- if (len <= off+count) *eof = 1;
- *start = page + off;
- len -= off;
- if (len>count) len = count;
- if (len<0) len = 0;
- return len;
+ return single_open(file, gen_rtc_proc_show, NULL);
}
+static const struct file_operations gen_rtc_proc_fops = {
+ .open = gen_rtc_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
static int __init gen_rtc_proc_init(void)
{
struct proc_dir_entry *r;
- r = create_proc_read_entry("driver/rtc", 0, NULL, gen_rtc_read_proc, NULL);
+ r = proc_create("driver/rtc", 0, NULL, &gen_rtc_proc_fops);
if (!r)
return -ENOMEM;
return 0;
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 053201b062a..4d439d2fcfd 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)
static int smi_ipmb_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, smi_ipmb_proc_show, PDE(inode)->data);
+ return single_open(file, smi_ipmb_proc_show, PDE_DATA(inode));
}
static const struct file_operations smi_ipmb_proc_ops = {
@@ -1938,7 +1938,7 @@ static int smi_version_proc_show(struct seq_file *m, void *v)
static int smi_version_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, smi_version_proc_show, PDE(inode)->data);
+ return single_open(file, smi_version_proc_show, PDE_DATA(inode));
}
static const struct file_operations smi_version_proc_ops = {
@@ -2013,7 +2013,7 @@ static int smi_stats_proc_show(struct seq_file *m, void *v)
static int smi_stats_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, smi_stats_proc_show, PDE(inode)->data);
+ return single_open(file, smi_stats_proc_show, PDE_DATA(inode));
}
static const struct file_operations smi_stats_proc_ops = {
@@ -4541,7 +4541,7 @@ static void __exit cleanup_ipmi(void)
del_timer_sync(&ipmi_timer);
#ifdef CONFIG_PROC_FS
- remove_proc_entry(proc_ipmi_root->name, NULL);
+ proc_remove(proc_ipmi_root);
#endif /* CONFIG_PROC_FS */
driver_unregister(&ipmidriver.driver);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 0ac9b45a585..313538abe63 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)
static int smi_type_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, smi_type_proc_show, PDE(inode)->data);
+ return single_open(file, smi_type_proc_show, PDE_DATA(inode));
}
static 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)
static int smi_si_stats_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, smi_si_stats_proc_show, PDE(inode)->data);
+ return single_open(file, smi_si_stats_proc_show, PDE_DATA(inode));
}
static 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)
static int smi_params_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, smi_params_proc_show, PDE(inode)->data);
+ return single_open(file, smi_params_proc_show, PDE_DATA(inode));
}
static const struct file_operations smi_params_proc_ops = {