@@ -3766,77 +3766,6 @@ sg_rq_st_str(enum sg_rq_state rq_st, bool long_str)
#endif
#if IS_ENABLED(CONFIG_SCSI_PROC_FS) /* long, almost to end of file */
-static int sg_proc_seq_show_int(struct seq_file *s, void *v);
-
-static int sg_proc_single_open_adio(struct inode *inode, struct file *filp);
-static ssize_t sg_proc_write_adio(struct file *filp, const char __user *buffer,
- size_t count, loff_t *off);
-static const struct proc_ops adio_proc_ops = {
- .proc_open = sg_proc_single_open_adio,
- .proc_read = seq_read,
- .proc_lseek = seq_lseek,
- .proc_write = sg_proc_write_adio,
- .proc_release = single_release,
-};
-
-static int sg_proc_single_open_dressz(struct inode *inode, struct file *filp);
-static ssize_t sg_proc_write_dressz(struct file *filp,
- const char __user *buffer, size_t count, loff_t *off);
-static const struct proc_ops dressz_proc_ops = {
- .proc_open = sg_proc_single_open_dressz,
- .proc_read = seq_read,
- .proc_lseek = seq_lseek,
- .proc_write = sg_proc_write_dressz,
- .proc_release = single_release,
-};
-
-static int sg_proc_seq_show_version(struct seq_file *s, void *v);
-static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v);
-static int sg_proc_seq_show_dev(struct seq_file *s, void *v);
-static void * dev_seq_start(struct seq_file *s, loff_t *pos);
-static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos);
-static void dev_seq_stop(struct seq_file *s, void *v);
-static const struct seq_operations dev_seq_ops = {
- .start = dev_seq_start,
- .next = dev_seq_next,
- .stop = dev_seq_stop,
- .show = sg_proc_seq_show_dev,
-};
-
-static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v);
-static const struct seq_operations devstrs_seq_ops = {
- .start = dev_seq_start,
- .next = dev_seq_next,
- .stop = dev_seq_stop,
- .show = sg_proc_seq_show_devstrs,
-};
-
-static int sg_proc_seq_show_debug(struct seq_file *s, void *v);
-static const struct seq_operations debug_seq_ops = {
- .start = dev_seq_start,
- .next = dev_seq_next,
- .stop = dev_seq_stop,
- .show = sg_proc_seq_show_debug,
-};
-
-static int
-sg_proc_init(void)
-{
- struct proc_dir_entry *p;
-
- p = proc_mkdir("scsi/sg", NULL);
- if (!p)
- return 1;
-
- proc_create("allow_dio", 0644, p, &adio_proc_ops);
- proc_create_seq("debug", 0444, p, &debug_seq_ops);
- proc_create("def_reserved_size", 0644, p, &dressz_proc_ops);
- proc_create_single("device_hdr", 0444, p, sg_proc_seq_show_devhdr);
- proc_create_seq("devices", 0444, p, &dev_seq_ops);
- proc_create_seq("device_strs", 0444, p, &devstrs_seq_ops);
- proc_create_single("version", 0444, p, sg_proc_seq_show_version);
- return 0;
-}
static int
sg_last_dev(void)
@@ -4209,6 +4138,64 @@ sg_proc_seq_show_debug(struct seq_file *s, void *v)
return 0;
}
+static const struct proc_ops adio_proc_ops = {
+ .proc_open = sg_proc_single_open_adio,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_write = sg_proc_write_adio,
+ .proc_release = single_release,
+};
+
+static const struct proc_ops dressz_proc_ops = {
+ .proc_open = sg_proc_single_open_dressz,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_write = sg_proc_write_dressz,
+ .proc_release = single_release,
+};
+
+static const struct seq_operations dev_seq_ops = {
+ .start = dev_seq_start,
+ .next = dev_seq_next,
+ .stop = dev_seq_stop,
+ .show = sg_proc_seq_show_dev,
+};
+
+static const struct seq_operations devstrs_seq_ops = {
+ .start = dev_seq_start,
+ .next = dev_seq_next,
+ .stop = dev_seq_stop,
+ .show = sg_proc_seq_show_devstrs,
+};
+
+static const struct seq_operations debug_seq_ops = {
+ .start = dev_seq_start,
+ .next = dev_seq_next,
+ .stop = dev_seq_stop,
+ .show = sg_proc_seq_show_debug,
+};
+
+static int
+sg_proc_init(void)
+{
+ struct proc_dir_entry *p;
+
+ p = proc_mkdir("scsi/sg", NULL);
+ if (!p)
+ return 1;
+
+ proc_create("allow_dio", 0644, p, &adio_proc_ops);
+ proc_create_seq("debug", 0444, p, &debug_seq_ops);
+ proc_create("def_reserved_size", 0644, p, &dressz_proc_ops);
+ proc_create_single("device_hdr", 0444, p, sg_proc_seq_show_devhdr);
+ proc_create_seq("devices", 0444, p, &dev_seq_ops);
+ proc_create_seq("device_strs", 0444, p, &devstrs_seq_ops);
+ proc_create_single("version", 0444, p, sg_proc_seq_show_version);
+ return 0;
+}
+
+/* remove_proc_subtree("scsi/sg", NULL) in exit_sg() does cleanup */
+
#endif /* CONFIG_SCSI_PROC_FS (~400 lines back) */
module_init(init_sg);