From: Al Viro Date: Sun, 31 Mar 2013 17:27:56 +0000 (-0400) Subject: scsi: bury ->proc_info() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=70ef457dc92bdd03c0c8d640fce45909166983a1;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git scsi: bury ->proc_info() all users converted to ->show_info()/->write_info() Signed-off-by: Al Viro --- diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index 6f4c3cff03bb..1670ba7ad6af 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c @@ -45,58 +45,6 @@ static struct proc_dir_entry *proc_scsi; /* Protect sht->present and sht->proc_dir */ static DEFINE_MUTEX(global_host_template_mutex); -/** - * proc_scsi_read - handle read from /proc by calling host's proc_info() command - * @buffer: passed to proc_info - * @start: passed to proc_info - * @offset: passed to proc_info - * @length: passed to proc_info - * @eof: returns whether length read was less than requested - * @data: pointer to a &struct Scsi_Host - */ - -static int proc_scsi_read(char *buffer, char **start, off_t offset, - int length, int *eof, void *data) -{ - struct Scsi_Host *shost = data; - int n; - - n = shost->hostt->proc_info(shost, buffer, start, offset, length, 0); - *eof = (n < length); - - return n; -} - -/** - * proc_scsi_write_proc - Handle write to /proc by calling host's proc_info() - * @file: not used - * @buf: source of data to write. - * @count: number of bytes (at most PROC_BLOCK_SIZE) to write. - * @data: pointer to &struct Scsi_Host - */ -static int proc_scsi_write_proc(struct file *file, const char __user *buf, - unsigned long count, void *data) -{ - struct Scsi_Host *shost = data; - ssize_t ret = -ENOMEM; - char *page; - char *start; - - if (count > PROC_BLOCK_SIZE) - return -EOVERFLOW; - - page = (char *)__get_free_page(GFP_KERNEL); - if (page) { - ret = -EFAULT; - if (copy_from_user(page, buf, count)) - goto out; - ret = shost->hostt->proc_info(shost, page, &start, 0, count, 1); - } -out: - free_page((unsigned long)page); - return ret; -} - static ssize_t proc_scsi_host_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { @@ -149,7 +97,7 @@ static const struct file_operations proc_scsi_fops = { void scsi_proc_hostdir_add(struct scsi_host_template *sht) { - if (!sht->proc_info && !sht->show_info) + if (!sht->show_info) return; mutex_lock(&global_host_template_mutex); @@ -168,7 +116,7 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht) */ void scsi_proc_hostdir_rm(struct scsi_host_template *sht) { - if (!sht->proc_info && !sht->show_info) + if (!sht->show_info) return; mutex_lock(&global_host_template_mutex); @@ -194,23 +142,12 @@ void scsi_proc_host_add(struct Scsi_Host *shost) return; sprintf(name,"%d", shost->host_no); - if (sht->show_info) { - p = proc_create_data(name, S_IRUGO | S_IWUSR, - sht->proc_dir, &proc_scsi_fops, shost); - if (!p) - goto Fail; - return; - } - p = create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR, - sht->proc_dir, proc_scsi_read, shost); - if (p) { - p->write_proc = proc_scsi_write_proc; - return; - } -Fail: - printk(KERN_ERR "%s: Failed to register host %d in" - "%s\n", __func__, shost->host_no, - sht->proc_name); + p = proc_create_data(name, S_IRUGO | S_IWUSR, + sht->proc_dir, &proc_scsi_fops, shost); + if (!p) + printk(KERN_ERR "%s: Failed to register host %d in" + "%s\n", __func__, shost->host_no, + sht->proc_name); } /** diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 70e08e442bfc..755243572219 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -341,7 +341,6 @@ struct scsi_host_template { * * Status: OBSOLETE */ - int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int); int (*show_info)(struct seq_file *, struct Scsi_Host *); int (*write_info)(struct Scsi_Host *, char *, int); @@ -378,7 +377,7 @@ struct scsi_host_template { /* * Used to store the procfs directory if a driver implements the - * proc_info or show_info method. + * show_info method. */ struct proc_dir_entry *proc_dir;