Skip to content

Commit

Permalink
proc: convert everything to "struct proc_ops"
Browse files Browse the repository at this point in the history
The most notable change is DEFINE_SHOW_ATTRIBUTE macro split in
seq_file.h.

Conversion rule is:

	llseek		=> proc_lseek
	unlocked_ioctl	=> proc_ioctl

	xxx		=> proc_xxx

	delete ".owner = THIS_MODULE" line

[[email protected]: fix drivers/isdn/capi/kcapi_proc.c]
[[email protected]: fix kernel/sched/psi.c]
  Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/20191225172546.GB13378@avx2
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Stephen Rothwell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and torvalds committed Feb 4, 2020
1 parent d56c0d4 commit 97a3253
Show file tree
Hide file tree
Showing 100 changed files with 961 additions and 1,006 deletions.
17 changes: 8 additions & 9 deletions arch/alpha/kernel/srm_env.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,12 @@ static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
return res;
}

static const struct file_operations srm_env_proc_fops = {
.owner = THIS_MODULE,
.open = srm_env_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = srm_env_proc_write,
static const struct proc_ops srm_env_proc_ops = {
.proc_open = srm_env_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = srm_env_proc_write,
};

static int __init
Expand Down Expand Up @@ -182,7 +181,7 @@ srm_env_init(void)
entry = srm_named_entries;
while (entry->name && entry->id) {
if (!proc_create_data(entry->name, 0644, named_dir,
&srm_env_proc_fops, (void *)entry->id))
&srm_env_proc_ops, (void *)entry->id))
goto cleanup;
entry++;
}
Expand All @@ -194,7 +193,7 @@ srm_env_init(void)
char name[4];
sprintf(name, "%ld", var_num);
if (!proc_create_data(name, 0644, numbered_dir,
&srm_env_proc_fops, (void *)var_num))
&srm_env_proc_ops, (void *)var_num))
goto cleanup;
}

Expand Down
8 changes: 4 additions & 4 deletions arch/arm/kernel/atags_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ static ssize_t atags_read(struct file *file, char __user *buf,
return simple_read_from_buffer(buf, count, ppos, b->data, b->size);
}

static const struct file_operations atags_fops = {
.read = atags_read,
.llseek = default_llseek,
static const struct proc_ops atags_proc_ops = {
.proc_read = atags_read,
.proc_lseek = default_llseek,
};

#define BOOT_PARAMS_SIZE 1536
Expand Down Expand Up @@ -61,7 +61,7 @@ static int __init init_atags_procfs(void)
b->size = size;
memcpy(b->data, atags_copy, size);

tags_entry = proc_create_data("atags", 0400, NULL, &atags_fops, b);
tags_entry = proc_create_data("atags", 0400, NULL, &atags_proc_ops, b);
if (!tags_entry)
goto nomem;

Expand Down
14 changes: 7 additions & 7 deletions arch/arm/mm/alignment.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ static ssize_t alignment_proc_write(struct file *file, const char __user *buffer
return count;
}

static const struct file_operations alignment_proc_fops = {
.open = alignment_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = alignment_proc_write,
static const struct proc_ops alignment_proc_ops = {
.proc_open = alignment_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = alignment_proc_write,
};
#endif /* CONFIG_PROC_FS */

Expand Down Expand Up @@ -1016,7 +1016,7 @@ static int __init alignment_init(void)
struct proc_dir_entry *res;

res = proc_create("cpu/alignment", S_IWUSR | S_IRUGO, NULL,
&alignment_proc_fops);
&alignment_proc_ops);
if (!res)
return -ENOMEM;
#endif
Expand Down
24 changes: 12 additions & 12 deletions arch/ia64/kernel/salinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t
return size;
}

static const struct file_operations salinfo_event_fops = {
.open = salinfo_event_open,
.read = salinfo_event_read,
.llseek = noop_llseek,
static const struct proc_ops salinfo_event_proc_ops = {
.proc_open = salinfo_event_open,
.proc_read = salinfo_event_read,
.proc_lseek = noop_llseek,
};

static int
Expand Down Expand Up @@ -534,12 +534,12 @@ salinfo_log_write(struct file *file, const char __user *buffer, size_t count, lo
return count;
}

static const struct file_operations salinfo_data_fops = {
.open = salinfo_log_open,
.release = salinfo_log_release,
.read = salinfo_log_read,
.write = salinfo_log_write,
.llseek = default_llseek,
static const struct proc_ops salinfo_data_proc_ops = {
.proc_open = salinfo_log_open,
.proc_release = salinfo_log_release,
.proc_read = salinfo_log_read,
.proc_write = salinfo_log_write,
.proc_lseek = default_llseek,
};

static int salinfo_cpu_online(unsigned int cpu)
Expand Down Expand Up @@ -617,13 +617,13 @@ salinfo_init(void)
continue;

entry = proc_create_data("event", S_IRUSR, dir,
&salinfo_event_fops, data);
&salinfo_event_proc_ops, data);
if (!entry)
continue;
*sdir++ = entry;

entry = proc_create_data("data", S_IRUSR | S_IWUSR, dir,
&salinfo_data_fops, data);
&salinfo_data_proc_ops, data);
if (!entry)
continue;
*sdir++ = entry;
Expand Down
8 changes: 4 additions & 4 deletions arch/m68k/kernel/bootinfo_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ static ssize_t bootinfo_read(struct file *file, char __user *buf,
bootinfo_size);
}

static const struct file_operations bootinfo_fops = {
.read = bootinfo_read,
.llseek = default_llseek,
static const struct proc_ops bootinfo_proc_ops = {
.proc_read = bootinfo_read,
.proc_lseek = default_llseek,
};

void __init save_bootinfo(const struct bi_record *bi)
Expand Down Expand Up @@ -67,7 +67,7 @@ static int __init init_bootinfo_procfs(void)
if (!bootinfo_copy)
return -ENOMEM;

pde = proc_create_data("bootinfo", 0400, NULL, &bootinfo_fops, NULL);
pde = proc_create_data("bootinfo", 0400, NULL, &bootinfo_proc_ops, NULL);
if (!pde) {
kfree(bootinfo_copy);
return -ENOMEM;
Expand Down
31 changes: 14 additions & 17 deletions arch/mips/lasat/picvue_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
return count;
}

static const struct file_operations pvc_line_proc_fops = {
.owner = THIS_MODULE,
.open = pvc_line_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = pvc_line_proc_write,
static const struct proc_ops pvc_line_proc_ops = {
.proc_open = pvc_line_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = pvc_line_proc_write,
};

static ssize_t pvc_scroll_proc_write(struct file *file, const char __user *buf,
Expand Down Expand Up @@ -148,13 +147,12 @@ static int pvc_scroll_proc_open(struct inode *inode, struct file *file)
return single_open(file, pvc_scroll_proc_show, NULL);
}

static const struct file_operations pvc_scroll_proc_fops = {
.owner = THIS_MODULE,
.open = pvc_scroll_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = pvc_scroll_proc_write,
static const struct proc_ops pvc_scroll_proc_ops = {
.proc_open = pvc_scroll_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = pvc_scroll_proc_write,
};

void pvc_proc_timerfunc(struct timer_list *unused)
Expand Down Expand Up @@ -189,12 +187,11 @@ static int __init pvc_proc_init(void)
}
for (i = 0; i < PVC_NLINES; i++) {
proc_entry = proc_create_data(pvc_linename[i], 0644, dir,
&pvc_line_proc_fops, &pvc_linedata[i]);
&pvc_line_proc_ops, &pvc_linedata[i]);
if (proc_entry == NULL)
goto error;
}
proc_entry = proc_create("scroll", 0644, dir,
&pvc_scroll_proc_fops);
proc_entry = proc_create("scroll", 0644, dir, &pvc_scroll_proc_ops);
if (proc_entry == NULL)
goto error;

Expand Down
10 changes: 5 additions & 5 deletions arch/powerpc/kernel/proc_powerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
return 0;
}

static const struct file_operations page_map_fops = {
.llseek = page_map_seek,
.read = page_map_read,
.mmap = page_map_mmap
static const struct proc_ops page_map_proc_ops = {
.proc_lseek = page_map_seek,
.proc_read = page_map_read,
.proc_mmap = page_map_mmap,
};


Expand All @@ -51,7 +51,7 @@ static int __init proc_ppc64_init(void)
struct proc_dir_entry *pde;

pde = proc_create_data("powerpc/systemcfg", S_IFREG | 0444, NULL,
&page_map_fops, vdso_data);
&page_map_proc_ops, vdso_data);
if (!pde)
return 1;
proc_set_size(pde, PAGE_SIZE);
Expand Down
70 changes: 35 additions & 35 deletions arch/powerpc/kernel/rtas-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,64 +159,64 @@ static int poweron_open(struct inode *inode, struct file *file)
return single_open(file, ppc_rtas_poweron_show, NULL);
}

static const struct file_operations ppc_rtas_poweron_operations = {
.open = poweron_open,
.read = seq_read,
.llseek = seq_lseek,
.write = ppc_rtas_poweron_write,
.release = single_release,
static const struct proc_ops ppc_rtas_poweron_proc_ops = {
.proc_open = poweron_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_poweron_write,
.proc_release = single_release,
};

static int progress_open(struct inode *inode, struct file *file)
{
return single_open(file, ppc_rtas_progress_show, NULL);
}

static const struct file_operations ppc_rtas_progress_operations = {
.open = progress_open,
.read = seq_read,
.llseek = seq_lseek,
.write = ppc_rtas_progress_write,
.release = single_release,
static const struct proc_ops ppc_rtas_progress_proc_ops = {
.proc_open = progress_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_progress_write,
.proc_release = single_release,
};

static int clock_open(struct inode *inode, struct file *file)
{
return single_open(file, ppc_rtas_clock_show, NULL);
}

static const struct file_operations ppc_rtas_clock_operations = {
.open = clock_open,
.read = seq_read,
.llseek = seq_lseek,
.write = ppc_rtas_clock_write,
.release = single_release,
static const struct proc_ops ppc_rtas_clock_proc_ops = {
.proc_open = clock_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_clock_write,
.proc_release = single_release,
};

static int tone_freq_open(struct inode *inode, struct file *file)
{
return single_open(file, ppc_rtas_tone_freq_show, NULL);
}

static const struct file_operations ppc_rtas_tone_freq_operations = {
.open = tone_freq_open,
.read = seq_read,
.llseek = seq_lseek,
.write = ppc_rtas_tone_freq_write,
.release = single_release,
static const struct proc_ops ppc_rtas_tone_freq_proc_ops = {
.proc_open = tone_freq_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_tone_freq_write,
.proc_release = single_release,
};

static int tone_volume_open(struct inode *inode, struct file *file)
{
return single_open(file, ppc_rtas_tone_volume_show, NULL);
}

static const struct file_operations ppc_rtas_tone_volume_operations = {
.open = tone_volume_open,
.read = seq_read,
.llseek = seq_lseek,
.write = ppc_rtas_tone_volume_write,
.release = single_release,
static const struct proc_ops ppc_rtas_tone_volume_proc_ops = {
.proc_open = tone_volume_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = ppc_rtas_tone_volume_write,
.proc_release = single_release,
};

static int ppc_rtas_find_all_sensors(void);
Expand All @@ -238,17 +238,17 @@ static int __init proc_rtas_init(void)
return -ENODEV;

proc_create("powerpc/rtas/progress", 0644, NULL,
&ppc_rtas_progress_operations);
&ppc_rtas_progress_proc_ops);
proc_create("powerpc/rtas/clock", 0644, NULL,
&ppc_rtas_clock_operations);
&ppc_rtas_clock_proc_ops);
proc_create("powerpc/rtas/poweron", 0644, NULL,
&ppc_rtas_poweron_operations);
&ppc_rtas_poweron_proc_ops);
proc_create_single("powerpc/rtas/sensors", 0444, NULL,
ppc_rtas_sensors_show);
proc_create("powerpc/rtas/frequency", 0644, NULL,
&ppc_rtas_tone_freq_operations);
&ppc_rtas_tone_freq_proc_ops);
proc_create("powerpc/rtas/volume", 0644, NULL,
&ppc_rtas_tone_volume_operations);
&ppc_rtas_tone_volume_proc_ops);
proc_create_single("powerpc/rtas/rmo_buffer", 0400, NULL,
ppc_rtas_rmo_buf_show);
return 0;
Expand Down
Loading

0 comments on commit 97a3253

Please sign in to comment.