mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -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
|
|
@ -47,19 +47,6 @@ static int pnpconfig_proc_show(struct seq_file *m, void *v)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pnpconfig_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, pnpconfig_proc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations pnpconfig_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = pnpconfig_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int escd_info_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct escd_info_struc escd;
|
||||
|
|
@ -74,19 +61,6 @@ static int escd_info_proc_show(struct seq_file *m, void *v)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int escd_info_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, escd_info_proc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations escd_info_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = escd_info_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
#define MAX_SANE_ESCD_SIZE (32*1024)
|
||||
static int escd_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
|
|
@ -129,19 +103,6 @@ static int escd_proc_show(struct seq_file *m, void *v)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int escd_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, escd_proc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations escd_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = escd_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int pnp_legacyres_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
void *buf;
|
||||
|
|
@ -159,19 +120,6 @@ static int pnp_legacyres_proc_show(struct seq_file *m, void *v)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pnp_legacyres_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, pnp_legacyres_proc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations pnp_legacyres_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = pnp_legacyres_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int pnp_devices_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct pnp_bios_node *node;
|
||||
|
|
@ -202,19 +150,6 @@ static int pnp_devices_proc_show(struct seq_file *m, void *v)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pnp_devices_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, pnp_devices_proc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations pnp_devices_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = pnp_devices_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int pnpbios_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
void *data = m->private;
|
||||
|
|
@ -318,12 +253,13 @@ int __init pnpbios_proc_init(void)
|
|||
proc_pnp_boot = proc_mkdir("boot", proc_pnp);
|
||||
if (!proc_pnp_boot)
|
||||
return -EIO;
|
||||
proc_create("devices", 0, proc_pnp, &pnp_devices_proc_fops);
|
||||
proc_create("configuration_info", 0, proc_pnp, &pnpconfig_proc_fops);
|
||||
proc_create("escd_info", 0, proc_pnp, &escd_info_proc_fops);
|
||||
proc_create("escd", S_IRUSR, proc_pnp, &escd_proc_fops);
|
||||
proc_create("legacy_device_resources", 0, proc_pnp, &pnp_legacyres_proc_fops);
|
||||
|
||||
proc_create_single("devices", 0, proc_pnp, pnp_devices_proc_show);
|
||||
proc_create_single("configuration_info", 0, proc_pnp,
|
||||
pnpconfig_proc_show);
|
||||
proc_create_single("escd_info", 0, proc_pnp, escd_info_proc_show);
|
||||
proc_create_single("escd", S_IRUSR, proc_pnp, escd_proc_show);
|
||||
proc_create_single("legacy_device_resources", 0, proc_pnp,
|
||||
pnp_legacyres_proc_show);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue