diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 15:16:07 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 15:16:07 -0500 |
| commit | 12dbf3fc4d06d2c0c4c44dc0612df04248b3cfd3 (patch) | |
| tree | 158610ef6c7711afb60d78956ab4b131bf6a08ef /drivers/scsi/scsi_proc.c | |
| parent | 61b7efddc5256225099d13185659e9ad9d8abc8a (diff) | |
| parent | fc091e03820bf67e543362bd40959701a71d0c27 (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
Diffstat (limited to 'drivers/scsi/scsi_proc.c')
| -rw-r--r-- | drivers/scsi/scsi_proc.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index a50958b1b6ee..07be62bbaaea 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c | |||
| @@ -25,11 +25,13 @@ | |||
| 25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
| 26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> |
| 27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
| 28 | #include <linux/mutex.h> | ||
| 28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
| 29 | 30 | ||
| 30 | #include <scsi/scsi.h> | 31 | #include <scsi/scsi.h> |
| 31 | #include <scsi/scsi_device.h> | 32 | #include <scsi/scsi_device.h> |
| 32 | #include <scsi/scsi_host.h> | 33 | #include <scsi/scsi_host.h> |
| 34 | #include <scsi/scsi_transport.h> | ||
| 33 | 35 | ||
| 34 | #include "scsi_priv.h" | 36 | #include "scsi_priv.h" |
| 35 | #include "scsi_logging.h" | 37 | #include "scsi_logging.h" |
| @@ -41,7 +43,7 @@ | |||
| 41 | static struct proc_dir_entry *proc_scsi; | 43 | static struct proc_dir_entry *proc_scsi; |
| 42 | 44 | ||
| 43 | /* Protect sht->present and sht->proc_dir */ | 45 | /* Protect sht->present and sht->proc_dir */ |
| 44 | static DECLARE_MUTEX(global_host_template_sem); | 46 | static DEFINE_MUTEX(global_host_template_mutex); |
| 45 | 47 | ||
| 46 | static int proc_scsi_read(char *buffer, char **start, off_t offset, | 48 | static int proc_scsi_read(char *buffer, char **start, off_t offset, |
| 47 | int length, int *eof, void *data) | 49 | int length, int *eof, void *data) |
| @@ -83,7 +85,7 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht) | |||
| 83 | if (!sht->proc_info) | 85 | if (!sht->proc_info) |
| 84 | return; | 86 | return; |
| 85 | 87 | ||
| 86 | down(&global_host_template_sem); | 88 | mutex_lock(&global_host_template_mutex); |
| 87 | if (!sht->present++) { | 89 | if (!sht->present++) { |
| 88 | sht->proc_dir = proc_mkdir(sht->proc_name, proc_scsi); | 90 | sht->proc_dir = proc_mkdir(sht->proc_name, proc_scsi); |
| 89 | if (!sht->proc_dir) | 91 | if (!sht->proc_dir) |
| @@ -92,7 +94,7 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht) | |||
| 92 | else | 94 | else |
| 93 | sht->proc_dir->owner = sht->module; | 95 | sht->proc_dir->owner = sht->module; |
| 94 | } | 96 | } |
| 95 | up(&global_host_template_sem); | 97 | mutex_unlock(&global_host_template_mutex); |
| 96 | } | 98 | } |
| 97 | 99 | ||
| 98 | void scsi_proc_hostdir_rm(struct scsi_host_template *sht) | 100 | void scsi_proc_hostdir_rm(struct scsi_host_template *sht) |
| @@ -100,12 +102,12 @@ void scsi_proc_hostdir_rm(struct scsi_host_template *sht) | |||
| 100 | if (!sht->proc_info) | 102 | if (!sht->proc_info) |
| 101 | return; | 103 | return; |
| 102 | 104 | ||
| 103 | down(&global_host_template_sem); | 105 | mutex_lock(&global_host_template_mutex); |
| 104 | if (!--sht->present && sht->proc_dir) { | 106 | if (!--sht->present && sht->proc_dir) { |
| 105 | remove_proc_entry(sht->proc_name, proc_scsi); | 107 | remove_proc_entry(sht->proc_name, proc_scsi); |
| 106 | sht->proc_dir = NULL; | 108 | sht->proc_dir = NULL; |
| 107 | } | 109 | } |
| 108 | up(&global_host_template_sem); | 110 | mutex_unlock(&global_host_template_mutex); |
| 109 | } | 111 | } |
| 110 | 112 | ||
| 111 | void scsi_proc_host_add(struct Scsi_Host *shost) | 113 | void scsi_proc_host_add(struct Scsi_Host *shost) |
| @@ -199,7 +201,10 @@ static int scsi_add_single_device(uint host, uint channel, uint id, uint lun) | |||
| 199 | if (IS_ERR(shost)) | 201 | if (IS_ERR(shost)) |
| 200 | return PTR_ERR(shost); | 202 | return PTR_ERR(shost); |
| 201 | 203 | ||
| 202 | error = scsi_scan_host_selected(shost, channel, id, lun, 1); | 204 | if (shost->transportt->user_scan) |
| 205 | error = shost->transportt->user_scan(shost, channel, id, lun); | ||
| 206 | else | ||
| 207 | error = scsi_scan_host_selected(shost, channel, id, lun, 1); | ||
| 203 | scsi_host_put(shost); | 208 | scsi_host_put(shost); |
| 204 | return error; | 209 | return error; |
| 205 | } | 210 | } |
