aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-device.c22
-rw-r--r--drivers/firewire/net.c6
-rw-r--r--drivers/firewire/ohci.c15
-rw-r--r--drivers/firewire/sbp2.c17
4 files changed, 33 insertions, 27 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index de4aa409abe2..2c6d5e118ac1 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -916,7 +916,7 @@ static int lookup_existing_device(struct device *dev, void *data)
916 old->config_rom_retries = 0; 916 old->config_rom_retries = 0;
917 fw_notice(card, "rediscovered device %s\n", dev_name(dev)); 917 fw_notice(card, "rediscovered device %s\n", dev_name(dev));
918 918
919 PREPARE_DELAYED_WORK(&old->work, fw_device_update); 919 old->workfn = fw_device_update;
920 fw_schedule_device_work(old, 0); 920 fw_schedule_device_work(old, 0);
921 921
922 if (current_node == card->root_node) 922 if (current_node == card->root_node)
@@ -1075,7 +1075,7 @@ static void fw_device_init(struct work_struct *work)
1075 if (atomic_cmpxchg(&device->state, 1075 if (atomic_cmpxchg(&device->state,
1076 FW_DEVICE_INITIALIZING, 1076 FW_DEVICE_INITIALIZING,
1077 FW_DEVICE_RUNNING) == FW_DEVICE_GONE) { 1077 FW_DEVICE_RUNNING) == FW_DEVICE_GONE) {
1078 PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); 1078 device->workfn = fw_device_shutdown;
1079 fw_schedule_device_work(device, SHUTDOWN_DELAY); 1079 fw_schedule_device_work(device, SHUTDOWN_DELAY);
1080 } else { 1080 } else {
1081 fw_notice(card, "created device %s: GUID %08x%08x, S%d00\n", 1081 fw_notice(card, "created device %s: GUID %08x%08x, S%d00\n",
@@ -1196,13 +1196,20 @@ static void fw_device_refresh(struct work_struct *work)
1196 dev_name(&device->device), fw_rcode_string(ret)); 1196 dev_name(&device->device), fw_rcode_string(ret));
1197 gone: 1197 gone:
1198 atomic_set(&device->state, FW_DEVICE_GONE); 1198 atomic_set(&device->state, FW_DEVICE_GONE);
1199 PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); 1199 device->workfn = fw_device_shutdown;
1200 fw_schedule_device_work(device, SHUTDOWN_DELAY); 1200 fw_schedule_device_work(device, SHUTDOWN_DELAY);
1201 out: 1201 out:
1202 if (node_id == card->root_node->node_id) 1202 if (node_id == card->root_node->node_id)
1203 fw_schedule_bm_work(card, 0); 1203 fw_schedule_bm_work(card, 0);
1204} 1204}
1205 1205
1206static void fw_device_workfn(struct work_struct *work)
1207{
1208 struct fw_device *device = container_of(to_delayed_work(work),
1209 struct fw_device, work);
1210 device->workfn(work);
1211}
1212
1206void fw_node_event(struct fw_card *card, struct fw_node *node, int event) 1213void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
1207{ 1214{
1208 struct fw_device *device; 1215 struct fw_device *device;
@@ -1252,7 +1259,8 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
1252 * power-up after getting plugged in. We schedule the 1259 * power-up after getting plugged in. We schedule the
1253 * first config rom scan half a second after bus reset. 1260 * first config rom scan half a second after bus reset.
1254 */ 1261 */
1255 INIT_DELAYED_WORK(&device->work, fw_device_init); 1262 device->workfn = fw_device_init;
1263 INIT_DELAYED_WORK(&device->work, fw_device_workfn);
1256 fw_schedule_device_work(device, INITIAL_DELAY); 1264 fw_schedule_device_work(device, INITIAL_DELAY);
1257 break; 1265 break;
1258 1266
@@ -1268,7 +1276,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
1268 if (atomic_cmpxchg(&device->state, 1276 if (atomic_cmpxchg(&device->state,
1269 FW_DEVICE_RUNNING, 1277 FW_DEVICE_RUNNING,
1270 FW_DEVICE_INITIALIZING) == FW_DEVICE_RUNNING) { 1278 FW_DEVICE_INITIALIZING) == FW_DEVICE_RUNNING) {
1271 PREPARE_DELAYED_WORK(&device->work, fw_device_refresh); 1279 device->workfn = fw_device_refresh;
1272 fw_schedule_device_work(device, 1280 fw_schedule_device_work(device,
1273 device->is_local ? 0 : INITIAL_DELAY); 1281 device->is_local ? 0 : INITIAL_DELAY);
1274 } 1282 }
@@ -1283,7 +1291,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
1283 smp_wmb(); /* update node_id before generation */ 1291 smp_wmb(); /* update node_id before generation */
1284 device->generation = card->generation; 1292 device->generation = card->generation;
1285 if (atomic_read(&device->state) == FW_DEVICE_RUNNING) { 1293 if (atomic_read(&device->state) == FW_DEVICE_RUNNING) {
1286 PREPARE_DELAYED_WORK(&device->work, fw_device_update); 1294 device->workfn = fw_device_update;
1287 fw_schedule_device_work(device, 0); 1295 fw_schedule_device_work(device, 0);
1288 } 1296 }
1289 break; 1297 break;
@@ -1308,7 +1316,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
1308 device = node->data; 1316 device = node->data;
1309 if (atomic_xchg(&device->state, 1317 if (atomic_xchg(&device->state,
1310 FW_DEVICE_GONE) == FW_DEVICE_RUNNING) { 1318 FW_DEVICE_GONE) == FW_DEVICE_RUNNING) {
1311 PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); 1319 device->workfn = fw_device_shutdown;
1312 fw_schedule_device_work(device, 1320 fw_schedule_device_work(device,
1313 list_empty(&card->link) ? 0 : SHUTDOWN_DELAY); 1321 list_empty(&card->link) ? 0 : SHUTDOWN_DELAY);
1314 } 1322 }
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 6b895986dc22..4af0a7bad7f2 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -929,8 +929,6 @@ static void fwnet_write_complete(struct fw_card *card, int rcode,
929 if (rcode == RCODE_COMPLETE) { 929 if (rcode == RCODE_COMPLETE) {
930 fwnet_transmit_packet_done(ptask); 930 fwnet_transmit_packet_done(ptask);
931 } else { 931 } else {
932 fwnet_transmit_packet_failed(ptask);
933
934 if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { 932 if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) {
935 dev_err(&ptask->dev->netdev->dev, 933 dev_err(&ptask->dev->netdev->dev,
936 "fwnet_write_complete failed: %x (skipped %d)\n", 934 "fwnet_write_complete failed: %x (skipped %d)\n",
@@ -938,8 +936,10 @@ static void fwnet_write_complete(struct fw_card *card, int rcode,
938 936
939 errors_skipped = 0; 937 errors_skipped = 0;
940 last_rcode = rcode; 938 last_rcode = rcode;
941 } else 939 } else {
942 errors_skipped++; 940 errors_skipped++;
941 }
942 fwnet_transmit_packet_failed(ptask);
943 } 943 }
944} 944}
945 945
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 6f74d8d3f700..8db663219560 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -290,7 +290,6 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
290#define QUIRK_NO_MSI 0x10 290#define QUIRK_NO_MSI 0x10
291#define QUIRK_TI_SLLZ059 0x20 291#define QUIRK_TI_SLLZ059 0x20
292#define QUIRK_IR_WAKE 0x40 292#define QUIRK_IR_WAKE 0x40
293#define QUIRK_PHY_LCTRL_TIMEOUT 0x80
294 293
295/* In case of multiple matches in ohci_quirks[], only the first one is used. */ 294/* In case of multiple matches in ohci_quirks[], only the first one is used. */
296static const struct { 295static const struct {
@@ -303,10 +302,7 @@ static const struct {
303 QUIRK_BE_HEADERS}, 302 QUIRK_BE_HEADERS},
304 303
305 {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, 304 {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6,
306 QUIRK_PHY_LCTRL_TIMEOUT | QUIRK_NO_MSI}, 305 QUIRK_NO_MSI},
307
308 {PCI_VENDOR_ID_ATT, PCI_ANY_ID, PCI_ANY_ID,
309 QUIRK_PHY_LCTRL_TIMEOUT},
310 306
311 {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, 307 {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID,
312 QUIRK_RESET_PACKET}, 308 QUIRK_RESET_PACKET},
@@ -353,7 +349,6 @@ MODULE_PARM_DESC(quirks, "Chip quirks (default = 0"
353 ", disable MSI = " __stringify(QUIRK_NO_MSI) 349 ", disable MSI = " __stringify(QUIRK_NO_MSI)
354 ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059) 350 ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059)
355 ", IR wake unreliable = " __stringify(QUIRK_IR_WAKE) 351 ", IR wake unreliable = " __stringify(QUIRK_IR_WAKE)
356 ", phy LCtrl timeout = " __stringify(QUIRK_PHY_LCTRL_TIMEOUT)
357 ")"); 352 ")");
358 353
359#define OHCI_PARAM_DEBUG_AT_AR 1 354#define OHCI_PARAM_DEBUG_AT_AR 1
@@ -2299,9 +2294,6 @@ static int ohci_enable(struct fw_card *card,
2299 * TI TSB82AA2 + TSB81BA3(A) cards signal LPS enabled early but 2294 * TI TSB82AA2 + TSB81BA3(A) cards signal LPS enabled early but
2300 * cannot actually use the phy at that time. These need tens of 2295 * cannot actually use the phy at that time. These need tens of
2301 * millisecods pause between LPS write and first phy access too. 2296 * millisecods pause between LPS write and first phy access too.
2302 *
2303 * But do not wait for 50msec on Agere/LSI cards. Their phy
2304 * arbitration state machine may time out during such a long wait.
2305 */ 2297 */
2306 2298
2307 reg_write(ohci, OHCI1394_HCControlSet, 2299 reg_write(ohci, OHCI1394_HCControlSet,
@@ -2309,11 +2301,8 @@ static int ohci_enable(struct fw_card *card,
2309 OHCI1394_HCControl_postedWriteEnable); 2301 OHCI1394_HCControl_postedWriteEnable);
2310 flush_writes(ohci); 2302 flush_writes(ohci);
2311 2303
2312 if (!(ohci->quirks & QUIRK_PHY_LCTRL_TIMEOUT)) 2304 for (lps = 0, i = 0; !lps && i < 3; i++) {
2313 msleep(50); 2305 msleep(50);
2314
2315 for (lps = 0, i = 0; !lps && i < 150; i++) {
2316 msleep(1);
2317 lps = reg_read(ohci, OHCI1394_HCControlSet) & 2306 lps = reg_read(ohci, OHCI1394_HCControlSet) &
2318 OHCI1394_HCControl_LPS; 2307 OHCI1394_HCControl_LPS;
2319 } 2308 }
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 281029daf98c..7aef911fdc71 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -146,6 +146,7 @@ struct sbp2_logical_unit {
146 */ 146 */
147 int generation; 147 int generation;
148 int retries; 148 int retries;
149 work_func_t workfn;
149 struct delayed_work work; 150 struct delayed_work work;
150 bool has_sdev; 151 bool has_sdev;
151 bool blocked; 152 bool blocked;
@@ -864,7 +865,7 @@ static void sbp2_login(struct work_struct *work)
864 /* set appropriate retry limit(s) in BUSY_TIMEOUT register */ 865 /* set appropriate retry limit(s) in BUSY_TIMEOUT register */
865 sbp2_set_busy_timeout(lu); 866 sbp2_set_busy_timeout(lu);
866 867
867 PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); 868 lu->workfn = sbp2_reconnect;
868 sbp2_agent_reset(lu); 869 sbp2_agent_reset(lu);
869 870
870 /* This was a re-login. */ 871 /* This was a re-login. */
@@ -918,7 +919,7 @@ static void sbp2_login(struct work_struct *work)
918 * If a bus reset happened, sbp2_update will have requeued 919 * If a bus reset happened, sbp2_update will have requeued
919 * lu->work already. Reset the work from reconnect to login. 920 * lu->work already. Reset the work from reconnect to login.
920 */ 921 */
921 PREPARE_DELAYED_WORK(&lu->work, sbp2_login); 922 lu->workfn = sbp2_login;
922} 923}
923 924
924static void sbp2_reconnect(struct work_struct *work) 925static void sbp2_reconnect(struct work_struct *work)
@@ -952,7 +953,7 @@ static void sbp2_reconnect(struct work_struct *work)
952 lu->retries++ >= 5) { 953 lu->retries++ >= 5) {
953 dev_err(tgt_dev(tgt), "failed to reconnect\n"); 954 dev_err(tgt_dev(tgt), "failed to reconnect\n");
954 lu->retries = 0; 955 lu->retries = 0;
955 PREPARE_DELAYED_WORK(&lu->work, sbp2_login); 956 lu->workfn = sbp2_login;
956 } 957 }
957 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); 958 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
958 959
@@ -972,6 +973,13 @@ static void sbp2_reconnect(struct work_struct *work)
972 sbp2_conditionally_unblock(lu); 973 sbp2_conditionally_unblock(lu);
973} 974}
974 975
976static void sbp2_lu_workfn(struct work_struct *work)
977{
978 struct sbp2_logical_unit *lu = container_of(to_delayed_work(work),
979 struct sbp2_logical_unit, work);
980 lu->workfn(work);
981}
982
975static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) 983static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
976{ 984{
977 struct sbp2_logical_unit *lu; 985 struct sbp2_logical_unit *lu;
@@ -998,7 +1006,8 @@ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
998 lu->blocked = false; 1006 lu->blocked = false;
999 ++tgt->dont_block; 1007 ++tgt->dont_block;
1000 INIT_LIST_HEAD(&lu->orb_list); 1008 INIT_LIST_HEAD(&lu->orb_list);
1001 INIT_DELAYED_WORK(&lu->work, sbp2_login); 1009 lu->workfn = sbp2_login;
1010 INIT_DELAYED_WORK(&lu->work, sbp2_lu_workfn);
1002 1011
1003 list_add_tail(&lu->link, &tgt->lu_list); 1012 list_add_tail(&lu->link, &tgt->lu_list);
1004 return 0; 1013 return 0;