aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-sbp2.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-10-26 06:04:20 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-01-04 17:50:36 -0500
commit621f6dd715209d3c3c27841943ae71fc2c75c9f5 (patch)
tree469765325836481fc06d1954ed8265e0020149d9 /drivers/firewire/fw-sbp2.c
parentc82cdea1e1cb3790788d04ef5cab33488e1455c9 (diff)
firewire: fw-sbp2: remove unnecessary locking
What was I thinking when I added sbp2_set_generation()? Its locking did nothing (except for implicitly providing the necessary barrier between node IDs update and generation update). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r--drivers/firewire/fw-sbp2.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index e54403ee59e7..e88d5067448c 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -670,17 +670,6 @@ static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu)
670 &d, sizeof(d), complete_agent_reset_write_no_wait, t); 670 &d, sizeof(d), complete_agent_reset_write_no_wait, t);
671} 671}
672 672
673static void sbp2_set_generation(struct sbp2_logical_unit *lu, int generation)
674{
675 struct fw_card *card = fw_device(lu->tgt->unit->device.parent)->card;
676 unsigned long flags;
677
678 /* serialize with comparisons of lu->generation and card->generation */
679 spin_lock_irqsave(&card->lock, flags);
680 lu->generation = generation;
681 spin_unlock_irqrestore(&card->lock, flags);
682}
683
684static inline void sbp2_allow_block(struct sbp2_logical_unit *lu) 673static inline void sbp2_allow_block(struct sbp2_logical_unit *lu)
685{ 674{
686 /* 675 /*
@@ -884,7 +873,7 @@ static void sbp2_login(struct work_struct *work)
884 goto out; 873 goto out;
885 874
886 generation = device->generation; 875 generation = device->generation;
887 smp_rmb(); /* node_id must not be older than generation */ 876 smp_rmb(); /* node IDs must not be older than generation */
888 node_id = device->node_id; 877 node_id = device->node_id;
889 local_node_id = device->card->node_id; 878 local_node_id = device->card->node_id;
890 879
@@ -908,7 +897,8 @@ static void sbp2_login(struct work_struct *work)
908 897
909 tgt->node_id = node_id; 898 tgt->node_id = node_id;
910 tgt->address_high = local_node_id << 16; 899 tgt->address_high = local_node_id << 16;
911 sbp2_set_generation(lu, generation); 900 smp_wmb(); /* node IDs must not be older than generation */
901 lu->generation = generation;
912 902
913 lu->command_block_agent_address = 903 lu->command_block_agent_address =
914 ((u64)(be32_to_cpu(response.command_block_agent.high) & 0xffff) 904 ((u64)(be32_to_cpu(response.command_block_agent.high) & 0xffff)
@@ -1201,7 +1191,7 @@ static void sbp2_reconnect(struct work_struct *work)
1201 goto out; 1191 goto out;
1202 1192
1203 generation = device->generation; 1193 generation = device->generation;
1204 smp_rmb(); /* node_id must not be older than generation */ 1194 smp_rmb(); /* node IDs must not be older than generation */
1205 node_id = device->node_id; 1195 node_id = device->node_id;
1206 local_node_id = device->card->node_id; 1196 local_node_id = device->card->node_id;
1207 1197
@@ -1228,7 +1218,8 @@ static void sbp2_reconnect(struct work_struct *work)
1228 1218
1229 tgt->node_id = node_id; 1219 tgt->node_id = node_id;
1230 tgt->address_high = local_node_id << 16; 1220 tgt->address_high = local_node_id << 16;
1231 sbp2_set_generation(lu, generation); 1221 smp_wmb(); /* node IDs must not be older than generation */
1222 lu->generation = generation;
1232 1223
1233 fw_notify("%s: reconnected to LUN %04x (%d retries)\n", 1224 fw_notify("%s: reconnected to LUN %04x (%d retries)\n",
1234 tgt->bus_id, lu->lun, lu->retries); 1225 tgt->bus_id, lu->lun, lu->retries);