mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
proc: introduce proc_create_single{,_data}
Variants of proc_create{,_data} that directly take a seq_file show
callback and drastically reduces the boilerplate code in the callers.
All trivial callers converted over.
Signed-off-by: Christoph Hellwig <[email protected]>
This commit is contained in:
parent
44414d82cf
commit
3f3942aca6
85 changed files with 235 additions and 1509 deletions
|
|
@ -461,19 +461,6 @@ static int proc_apm_show(struct seq_file *m, void *v)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int proc_apm_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, proc_apm_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations apm_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_apm_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
static int kapmd(void *arg)
|
||||
|
|
@ -657,7 +644,7 @@ static int __init apm_init(void)
|
|||
wake_up_process(kapmd_tsk);
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
proc_create("apm", 0, NULL, &apm_proc_fops);
|
||||
proc_create_single("apm", 0, NULL, proc_apm_show);
|
||||
#endif
|
||||
|
||||
ret = misc_register(&apm_device);
|
||||
|
|
|
|||
|
|
@ -345,18 +345,6 @@ static int ds1620_proc_therm_show(struct seq_file *m, void *v)
|
|||
fan_state[netwinder_get_fan()]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ds1620_proc_therm_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ds1620_proc_therm_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations ds1620_proc_therm_fops = {
|
||||
.open = ds1620_proc_therm_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
static const struct file_operations ds1620_fops = {
|
||||
|
|
@ -404,7 +392,7 @@ static int __init ds1620_init(void)
|
|||
return ret;
|
||||
|
||||
#ifdef THERM_USE_PROC
|
||||
if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops))
|
||||
if (!proc_create_single("therm", 0, NULL, ds1620_proc_therm_show))
|
||||
printk(KERN_ERR "therm: unable to register /proc/therm\n");
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -358,19 +358,6 @@ static int efi_rtc_proc_show(struct seq_file *m, void *v)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int efi_rtc_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
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 = single_release,
|
||||
};
|
||||
|
||||
static int __init
|
||||
efi_rtc_init(void)
|
||||
{
|
||||
|
|
@ -386,7 +373,7 @@ efi_rtc_init(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
dir = proc_create("driver/efirtc", 0, NULL, &efi_rtc_proc_fops);
|
||||
dir = proc_create_single("driver/efirtc", 0, NULL, efi_rtc_proc_show);
|
||||
if (dir == NULL) {
|
||||
printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n");
|
||||
misc_deregister(&efi_rtc_dev);
|
||||
|
|
|
|||
|
|
@ -389,22 +389,9 @@ static int nvram_proc_read(struct seq_file *seq, void *offset)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nvram_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, nvram_proc_read, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations nvram_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nvram_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int nvram_add_proc_fs(void)
|
||||
{
|
||||
if (!proc_create("driver/nvram", 0, NULL, &nvram_proc_fops))
|
||||
if (!proc_create_single("driver/nvram", 0, NULL, nvram_proc_read))
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ static void mask_rtc_irq_bit(unsigned char bit)
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static int rtc_proc_open(struct inode *inode, struct file *file);
|
||||
static int rtc_proc_show(struct seq_file *seq, void *v);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -832,16 +832,6 @@ static struct miscdevice rtc_dev = {
|
|||
.fops = &rtc_fops,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static const struct file_operations rtc_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = rtc_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
static resource_size_t rtc_size;
|
||||
|
||||
static struct resource * __init rtc_request_region(resource_size_t size)
|
||||
|
|
@ -982,7 +972,7 @@ no_irq:
|
|||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
ent = proc_create("driver/rtc", 0, NULL, &rtc_proc_fops);
|
||||
ent = proc_create_single("driver/rtc", 0, NULL, rtc_proc_show);
|
||||
if (!ent)
|
||||
printk(KERN_WARNING "rtc: Failed to register with procfs.\n");
|
||||
#endif
|
||||
|
|
@ -1201,11 +1191,6 @@ static int rtc_proc_show(struct seq_file *seq, void *v)
|
|||
#undef YN
|
||||
#undef NY
|
||||
}
|
||||
|
||||
static int rtc_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, rtc_proc_show, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void rtc_get_rtc_time(struct rtc_time *rtc_tm)
|
||||
|
|
|
|||
|
|
@ -326,19 +326,6 @@ static int proc_toshiba_show(struct seq_file *m, void *v)
|
|||
key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int proc_toshiba_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, proc_toshiba_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations proc_toshiba_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_toshiba_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -524,7 +511,7 @@ static int __init toshiba_init(void)
|
|||
{
|
||||
struct proc_dir_entry *pde;
|
||||
|
||||
pde = proc_create("toshiba", 0, NULL, &proc_toshiba_fops);
|
||||
pde = proc_create_single("toshiba", 0, NULL, proc_toshiba_show);
|
||||
if (!pde) {
|
||||
misc_deregister(&tosh_device);
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Reference in a new issue