#include <linux/errno.h>
#include <linux/blkdev.h>
#include <linux/seq_file.h>
+#include <linux/mutex.h>
#include <asm/uaccess.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
-#include "scsi.h"
+#include <scsi/scsi_transport.h>
#include "scsi_priv.h"
#include "scsi_logging.h"
static struct proc_dir_entry *proc_scsi;
/* Protect sht->present and sht->proc_dir */
-static DECLARE_MUTEX(global_host_template_sem);
+static DEFINE_MUTEX(global_host_template_mutex);
static int proc_scsi_read(char *buffer, char **start, off_t offset,
int length, int *eof, void *data)
return n;
}
-static int proc_scsi_write_proc(struct file *file, const char *buf,
+static int proc_scsi_write_proc(struct file *file, const char __user *buf,
unsigned long count, void *data)
{
struct Scsi_Host *shost = data;
if (!sht->proc_info)
return;
- down(&global_host_template_sem);
+ mutex_lock(&global_host_template_mutex);
if (!sht->present++) {
sht->proc_dir = proc_mkdir(sht->proc_name, proc_scsi);
if (!sht->proc_dir)
else
sht->proc_dir->owner = sht->module;
}
- up(&global_host_template_sem);
+ mutex_unlock(&global_host_template_mutex);
}
void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
if (!sht->proc_info)
return;
- down(&global_host_template_sem);
+ mutex_lock(&global_host_template_mutex);
if (!--sht->present && sht->proc_dir) {
remove_proc_entry(sht->proc_name, proc_scsi);
sht->proc_dir = NULL;
}
- up(&global_host_template_sem);
+ mutex_unlock(&global_host_template_mutex);
}
void scsi_proc_host_add(struct Scsi_Host *shost)
if (IS_ERR(shost))
return PTR_ERR(shost);
- error = scsi_scan_host_selected(shost, channel, id, lun, 1);
+ if (shost->transportt->user_scan)
+ error = shost->transportt->user_scan(shost, channel, id, lun);
+ else
+ error = scsi_scan_host_selected(shost, channel, id, lun, 1);
scsi_host_put(shost);
return error;
}
{
struct proc_dir_entry *pde;
- proc_scsi = proc_mkdir("scsi", 0);
+ proc_scsi = proc_mkdir("scsi", NULL);
if (!proc_scsi)
goto err1;
return 0;
err2:
- remove_proc_entry("scsi", 0);
+ remove_proc_entry("scsi", NULL);
err1:
return -ENOMEM;
}
void scsi_exit_procfs(void)
{
- remove_proc_entry("scsi/scsi", 0);
- remove_proc_entry("scsi", 0);
+ remove_proc_entry("scsi/scsi", NULL);
+ remove_proc_entry("scsi", NULL);
}