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/libata-scsi.c | |
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/libata-scsi.c')
-rw-r--r-- | drivers/ata/libata-scsi.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 | ||