diff options
author | Dan Williams <dan.j.williams@intel.com> | 2012-03-11 03:28:46 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2012-04-12 15:57:51 -0400 |
commit | 85d6725b7c0d7e3fa4261fdd4c020be4224fc9f1 (patch) | |
tree | 359e39a0982124c9f630ff3928aaf6f75d8b7dd3 /drivers/ata | |
parent | 99b80e97710ae2e53c951acfdd956e9f38e36646 (diff) |
libata: make ata_print_id atomic
This variable is incremented from multiple contexts (module_init via
libata-lldds and the libsas discovery thread). Make it atomic to head
off any chance of libsas and libata creating duplicate ids.
Acked-by: Jacek Danecki <jacek.danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 4 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 4 | ||||
-rw-r--r-- | drivers/ata/libata.h | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e0bda9ff89cd..28db50b57b91 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -95,7 +95,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev); | |||
95 | static void ata_dev_xfermask(struct ata_device *dev); | 95 | static void ata_dev_xfermask(struct ata_device *dev); |
96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); | 96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); |
97 | 97 | ||
98 | unsigned int ata_print_id = 1; | 98 | atomic_t ata_print_id = ATOMIC_INIT(1); |
99 | 99 | ||
100 | struct ata_force_param { | 100 | struct ata_force_param { |
101 | const char *name; | 101 | const char *name; |
@@ -6029,7 +6029,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6029 | 6029 | ||
6030 | /* give ports names and add SCSI hosts */ | 6030 | /* give ports names and add SCSI hosts */ |
6031 | for (i = 0; i < host->n_ports; i++) | 6031 | for (i = 0; i < host->n_ports; i++) |
6032 | host->ports[i]->print_id = ata_print_id++; | 6032 | host->ports[i]->print_id = atomic_inc_return(&ata_print_id); |
6033 | 6033 | ||
6034 | 6034 | ||
6035 | /* Create associated sysfs transport objects */ | 6035 | /* Create associated sysfs transport objects */ |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 1ee00c8b5b04..93dabdcd2cbe 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3843,7 +3843,7 @@ int ata_sas_async_port_init(struct ata_port *ap) | |||
3843 | int rc = ap->ops->port_start(ap); | 3843 | int rc = ap->ops->port_start(ap); |
3844 | 3844 | ||
3845 | if (!rc) { | 3845 | if (!rc) { |
3846 | ap->print_id = ata_print_id++; | 3846 | ap->print_id = atomic_inc_return(&ata_print_id); |
3847 | __ata_port_probe(ap); | 3847 | __ata_port_probe(ap); |
3848 | } | 3848 | } |
3849 | 3849 | ||
@@ -3867,7 +3867,7 @@ int ata_sas_port_init(struct ata_port *ap) | |||
3867 | int rc = ap->ops->port_start(ap); | 3867 | int rc = ap->ops->port_start(ap); |
3868 | 3868 | ||
3869 | if (!rc) { | 3869 | if (!rc) { |
3870 | ap->print_id = ata_print_id++; | 3870 | ap->print_id = atomic_inc_return(&ata_print_id); |
3871 | rc = ata_port_probe(ap); | 3871 | rc = ata_port_probe(ap); |
3872 | } | 3872 | } |
3873 | 3873 | ||
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 2e26fcaf635b..9d0fd0b71852 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -53,7 +53,7 @@ enum { | |||
53 | ATA_DNXFER_QUIET = (1 << 31), | 53 | ATA_DNXFER_QUIET = (1 << 31), |
54 | }; | 54 | }; |
55 | 55 | ||
56 | extern unsigned int ata_print_id; | 56 | extern atomic_t ata_print_id; |
57 | extern int atapi_passthru16; | 57 | extern int atapi_passthru16; |
58 | extern int libata_fua; | 58 | extern int libata_fua; |
59 | extern int libata_noacpi; | 59 | extern int libata_noacpi; |