diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/hosts.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 89d41a424b33..5fd2da494d08 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "scsi_logging.h" | 40 | #include "scsi_logging.h" |
41 | 41 | ||
42 | 42 | ||
43 | static int scsi_host_next_hn; /* host_no for next new host */ | 43 | static atomic_t scsi_host_next_hn; /* host_no for next new host */ |
44 | 44 | ||
45 | 45 | ||
46 | static void scsi_host_cls_release(struct device *dev) | 46 | static void scsi_host_cls_release(struct device *dev) |
@@ -333,7 +333,11 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) | |||
333 | 333 | ||
334 | mutex_init(&shost->scan_mutex); | 334 | mutex_init(&shost->scan_mutex); |
335 | 335 | ||
336 | shost->host_no = scsi_host_next_hn++; /* XXX(hch): still racy */ | 336 | /* |
337 | * subtract one because we increment first then return, but we need to | ||
338 | * know what the next host number was before increment | ||
339 | */ | ||
340 | shost->host_no = atomic_inc_return(&scsi_host_next_hn) - 1; | ||
337 | shost->dma_channel = 0xff; | 341 | shost->dma_channel = 0xff; |
338 | 342 | ||
339 | /* These three are default values which can be overridden */ | 343 | /* These three are default values which can be overridden */ |