aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2011-12-20 15:34:12 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-01-15 12:37:21 -0500
commiteba9ebaaa26d60e07bc0aea585c13bc1d5a728c1 (patch)
tree7dfa6608c78f29eb3b1d183483e45f7f62814f6f /drivers/firewire
parent64d2172019dcfe46508593c561c9906de95df567 (diff)
firewire: sbp2: use dev_printk API
All messages are uniformly prefixed by driver name and device name now. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/sbp2.c93
1 files changed, 51 insertions, 42 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 68375bc3aef..32b3296a1c5 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -165,7 +165,6 @@ static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
165 */ 165 */
166struct sbp2_target { 166struct sbp2_target {
167 struct fw_unit *unit; 167 struct fw_unit *unit;
168 const char *bus_id;
169 struct list_head lu_list; 168 struct list_head lu_list;
170 169
171 u64 management_agent_address; 170 u64 management_agent_address;
@@ -181,11 +180,21 @@ struct sbp2_target {
181 int blocked; /* ditto */ 180 int blocked; /* ditto */
182}; 181};
183 182
184static struct fw_device *target_device(struct sbp2_target *tgt) 183static struct fw_device *target_parent_device(struct sbp2_target *tgt)
185{ 184{
186 return fw_parent_device(tgt->unit); 185 return fw_parent_device(tgt->unit);
187} 186}
188 187
188static const struct device *tgt_dev(const struct sbp2_target *tgt)
189{
190 return &tgt->unit->device;
191}
192
193static const struct device *lu_dev(const struct sbp2_logical_unit *lu)
194{
195 return &lu->tgt->unit->device;
196}
197
189/* Impossible login_id, to detect logout attempt before successful login */ 198/* Impossible login_id, to detect logout attempt before successful login */
190#define INVALID_LOGIN_ID 0x10000 199#define INVALID_LOGIN_ID 0x10000
191 200
@@ -430,7 +439,8 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
430 memcpy(status.data, payload + 8, length - 8); 439 memcpy(status.data, payload + 8, length - 8);
431 440
432 if (STATUS_GET_SOURCE(status) == 2 || STATUS_GET_SOURCE(status) == 3) { 441 if (STATUS_GET_SOURCE(status) == 2 || STATUS_GET_SOURCE(status) == 3) {
433 fw_notify("non-orb related status write, not handled\n"); 442 dev_notice(lu_dev(lu),
443 "non-ORB related status write, not handled\n");
434 fw_send_response(card, request, RCODE_COMPLETE); 444 fw_send_response(card, request, RCODE_COMPLETE);
435 return; 445 return;
436 } 446 }
@@ -451,7 +461,7 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
451 orb->callback(orb, &status); 461 orb->callback(orb, &status);
452 kref_put(&orb->kref, free_orb); /* orb callback reference */ 462 kref_put(&orb->kref, free_orb); /* orb callback reference */
453 } else { 463 } else {
454 fw_error("status write for unknown orb\n"); 464 dev_err(lu_dev(lu), "status write for unknown ORB\n");
455 } 465 }
456 466
457 fw_send_response(card, request, RCODE_COMPLETE); 467 fw_send_response(card, request, RCODE_COMPLETE);
@@ -492,7 +502,7 @@ static void complete_transaction(struct fw_card *card, int rcode,
492static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, 502static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
493 int node_id, int generation, u64 offset) 503 int node_id, int generation, u64 offset)
494{ 504{
495 struct fw_device *device = target_device(lu->tgt); 505 struct fw_device *device = target_parent_device(lu->tgt);
496 struct sbp2_pointer orb_pointer; 506 struct sbp2_pointer orb_pointer;
497 unsigned long flags; 507 unsigned long flags;
498 508
@@ -513,7 +523,7 @@ static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
513 523
514static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu) 524static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu)
515{ 525{
516 struct fw_device *device = target_device(lu->tgt); 526 struct fw_device *device = target_parent_device(lu->tgt);
517 struct sbp2_orb *orb, *next; 527 struct sbp2_orb *orb, *next;
518 struct list_head list; 528 struct list_head list;
519 unsigned long flags; 529 unsigned long flags;
@@ -552,7 +562,7 @@ static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
552 int generation, int function, 562 int generation, int function,
553 int lun_or_login_id, void *response) 563 int lun_or_login_id, void *response)
554{ 564{
555 struct fw_device *device = target_device(lu->tgt); 565 struct fw_device *device = target_parent_device(lu->tgt);
556 struct sbp2_management_orb *orb; 566 struct sbp2_management_orb *orb;
557 unsigned int timeout; 567 unsigned int timeout;
558 int retval = -ENOMEM; 568 int retval = -ENOMEM;
@@ -612,20 +622,20 @@ static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
612 622
613 retval = -EIO; 623 retval = -EIO;
614 if (sbp2_cancel_orbs(lu) == 0) { 624 if (sbp2_cancel_orbs(lu) == 0) {
615 fw_error("%s: orb reply timed out, rcode=0x%02x\n", 625 dev_err(lu_dev(lu), "ORB reply timed out, rcode 0x%02x\n",
616 lu->tgt->bus_id, orb->base.rcode); 626 orb->base.rcode);
617 goto out; 627 goto out;
618 } 628 }
619 629
620 if (orb->base.rcode != RCODE_COMPLETE) { 630 if (orb->base.rcode != RCODE_COMPLETE) {
621 fw_error("%s: management write failed, rcode 0x%02x\n", 631 dev_err(lu_dev(lu), "management write failed, rcode 0x%02x\n",
622 lu->tgt->bus_id, orb->base.rcode); 632 orb->base.rcode);
623 goto out; 633 goto out;
624 } 634 }
625 635
626 if (STATUS_GET_RESPONSE(orb->status) != 0 || 636 if (STATUS_GET_RESPONSE(orb->status) != 0 ||
627 STATUS_GET_SBP_STATUS(orb->status) != 0) { 637 STATUS_GET_SBP_STATUS(orb->status) != 0) {
628 fw_error("%s: error status: %d:%d\n", lu->tgt->bus_id, 638 dev_err(lu_dev(lu), "error status: %d:%d\n",
629 STATUS_GET_RESPONSE(orb->status), 639 STATUS_GET_RESPONSE(orb->status),
630 STATUS_GET_SBP_STATUS(orb->status)); 640 STATUS_GET_SBP_STATUS(orb->status));
631 goto out; 641 goto out;
@@ -648,7 +658,7 @@ static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
648 658
649static void sbp2_agent_reset(struct sbp2_logical_unit *lu) 659static void sbp2_agent_reset(struct sbp2_logical_unit *lu)
650{ 660{
651 struct fw_device *device = target_device(lu->tgt); 661 struct fw_device *device = target_parent_device(lu->tgt);
652 __be32 d = 0; 662 __be32 d = 0;
653 663
654 fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST, 664 fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
@@ -665,7 +675,7 @@ static void complete_agent_reset_write_no_wait(struct fw_card *card,
665 675
666static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu) 676static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu)
667{ 677{
668 struct fw_device *device = target_device(lu->tgt); 678 struct fw_device *device = target_parent_device(lu->tgt);
669 struct fw_transaction *t; 679 struct fw_transaction *t;
670 static __be32 d; 680 static __be32 d;
671 681
@@ -704,7 +714,7 @@ static inline void sbp2_allow_block(struct sbp2_logical_unit *lu)
704static void sbp2_conditionally_block(struct sbp2_logical_unit *lu) 714static void sbp2_conditionally_block(struct sbp2_logical_unit *lu)
705{ 715{
706 struct sbp2_target *tgt = lu->tgt; 716 struct sbp2_target *tgt = lu->tgt;
707 struct fw_card *card = target_device(tgt)->card; 717 struct fw_card *card = target_parent_device(tgt)->card;
708 struct Scsi_Host *shost = 718 struct Scsi_Host *shost =
709 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 719 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
710 unsigned long flags; 720 unsigned long flags;
@@ -728,7 +738,7 @@ static void sbp2_conditionally_block(struct sbp2_logical_unit *lu)
728static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu) 738static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
729{ 739{
730 struct sbp2_target *tgt = lu->tgt; 740 struct sbp2_target *tgt = lu->tgt;
731 struct fw_card *card = target_device(tgt)->card; 741 struct fw_card *card = target_parent_device(tgt)->card;
732 struct Scsi_Host *shost = 742 struct Scsi_Host *shost =
733 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 743 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
734 unsigned long flags; 744 unsigned long flags;
@@ -753,7 +763,7 @@ static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
753 */ 763 */
754static void sbp2_unblock(struct sbp2_target *tgt) 764static void sbp2_unblock(struct sbp2_target *tgt)
755{ 765{
756 struct fw_card *card = target_device(tgt)->card; 766 struct fw_card *card = target_parent_device(tgt)->card;
757 struct Scsi_Host *shost = 767 struct Scsi_Host *shost =
758 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 768 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
759 unsigned long flags; 769 unsigned long flags;
@@ -794,7 +804,7 @@ static int sbp2_lun2int(u16 lun)
794 */ 804 */
795static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu) 805static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu)
796{ 806{
797 struct fw_device *device = target_device(lu->tgt); 807 struct fw_device *device = target_parent_device(lu->tgt);
798 __be32 d = cpu_to_be32(SBP2_CYCLE_LIMIT | SBP2_RETRY_LIMIT); 808 __be32 d = cpu_to_be32(SBP2_CYCLE_LIMIT | SBP2_RETRY_LIMIT);
799 809
800 fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST, 810 fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
@@ -809,7 +819,7 @@ static void sbp2_login(struct work_struct *work)
809 struct sbp2_logical_unit *lu = 819 struct sbp2_logical_unit *lu =
810 container_of(work, struct sbp2_logical_unit, work.work); 820 container_of(work, struct sbp2_logical_unit, work.work);
811 struct sbp2_target *tgt = lu->tgt; 821 struct sbp2_target *tgt = lu->tgt;
812 struct fw_device *device = target_device(tgt); 822 struct fw_device *device = target_parent_device(tgt);
813 struct Scsi_Host *shost; 823 struct Scsi_Host *shost;
814 struct scsi_device *sdev; 824 struct scsi_device *sdev;
815 struct sbp2_login_response response; 825 struct sbp2_login_response response;
@@ -833,8 +843,8 @@ static void sbp2_login(struct work_struct *work)
833 if (lu->retries++ < 5) { 843 if (lu->retries++ < 5) {
834 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); 844 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
835 } else { 845 } else {
836 fw_error("%s: failed to login to LUN %04x\n", 846 dev_err(tgt_dev(tgt), "failed to login to LUN %04x\n",
837 tgt->bus_id, lu->lun); 847 lu->lun);
838 /* Let any waiting I/O fail from now on. */ 848 /* Let any waiting I/O fail from now on. */
839 sbp2_unblock(lu->tgt); 849 sbp2_unblock(lu->tgt);
840 } 850 }
@@ -851,8 +861,8 @@ static void sbp2_login(struct work_struct *work)
851 << 32) | be32_to_cpu(response.command_block_agent.low); 861 << 32) | be32_to_cpu(response.command_block_agent.low);
852 lu->login_id = be32_to_cpu(response.misc) & 0xffff; 862 lu->login_id = be32_to_cpu(response.misc) & 0xffff;
853 863
854 fw_notify("%s: logged in to LUN %04x (%d retries)\n", 864 dev_notice(tgt_dev(tgt), "logged in to LUN %04x (%d retries)\n",
855 tgt->bus_id, lu->lun, lu->retries); 865 lu->lun, lu->retries);
856 866
857 /* set appropriate retry limit(s) in BUSY_TIMEOUT register */ 867 /* set appropriate retry limit(s) in BUSY_TIMEOUT register */
858 sbp2_set_busy_timeout(lu); 868 sbp2_set_busy_timeout(lu);
@@ -919,7 +929,7 @@ static void sbp2_reconnect(struct work_struct *work)
919 struct sbp2_logical_unit *lu = 929 struct sbp2_logical_unit *lu =
920 container_of(work, struct sbp2_logical_unit, work.work); 930 container_of(work, struct sbp2_logical_unit, work.work);
921 struct sbp2_target *tgt = lu->tgt; 931 struct sbp2_target *tgt = lu->tgt;
922 struct fw_device *device = target_device(tgt); 932 struct fw_device *device = target_parent_device(tgt);
923 int generation, node_id, local_node_id; 933 int generation, node_id, local_node_id;
924 934
925 if (fw_device_is_shutdown(device)) 935 if (fw_device_is_shutdown(device))
@@ -943,7 +953,7 @@ static void sbp2_reconnect(struct work_struct *work)
943 smp_rmb(); /* get current card generation */ 953 smp_rmb(); /* get current card generation */
944 if (generation == device->card->generation || 954 if (generation == device->card->generation ||
945 lu->retries++ >= 5) { 955 lu->retries++ >= 5) {
946 fw_error("%s: failed to reconnect\n", tgt->bus_id); 956 dev_err(tgt_dev(tgt), "failed to reconnect\n");
947 lu->retries = 0; 957 lu->retries = 0;
948 PREPARE_DELAYED_WORK(&lu->work, sbp2_login); 958 PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
949 } 959 }
@@ -957,8 +967,8 @@ static void sbp2_reconnect(struct work_struct *work)
957 smp_wmb(); /* node IDs must not be older than generation */ 967 smp_wmb(); /* node IDs must not be older than generation */
958 lu->generation = generation; 968 lu->generation = generation;
959 969
960 fw_notify("%s: reconnected to LUN %04x (%d retries)\n", 970 dev_notice(tgt_dev(tgt), "reconnected to LUN %04x (%d retries)\n",
961 tgt->bus_id, lu->lun, lu->retries); 971 lu->lun, lu->retries);
962 972
963 sbp2_agent_reset(lu); 973 sbp2_agent_reset(lu);
964 sbp2_cancel_orbs(lu); 974 sbp2_cancel_orbs(lu);
@@ -1068,8 +1078,8 @@ static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt)
1068 unsigned int timeout = tgt->mgt_orb_timeout; 1078 unsigned int timeout = tgt->mgt_orb_timeout;
1069 1079
1070 if (timeout > 40000) 1080 if (timeout > 40000)
1071 fw_notify("%s: %ds mgt_ORB_timeout limited to 40s\n", 1081 dev_notice(tgt_dev(tgt), "%ds mgt_ORB_timeout limited to 40s\n",
1072 tgt->bus_id, timeout / 1000); 1082 timeout / 1000);
1073 1083
1074 tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000); 1084 tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000);
1075} 1085}
@@ -1081,9 +1091,9 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model,
1081 unsigned int w = sbp2_param_workarounds; 1091 unsigned int w = sbp2_param_workarounds;
1082 1092
1083 if (w) 1093 if (w)
1084 fw_notify("Please notify linux1394-devel@lists.sourceforge.net " 1094 dev_notice(tgt_dev(tgt),
1085 "if you need the workarounds parameter for %s\n", 1095 "Please notify linux1394-devel@lists.sf.net "
1086 tgt->bus_id); 1096 "if you need the workarounds parameter\n");
1087 1097
1088 if (w & SBP2_WORKAROUND_OVERRIDE) 1098 if (w & SBP2_WORKAROUND_OVERRIDE)
1089 goto out; 1099 goto out;
@@ -1103,9 +1113,9 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model,
1103 } 1113 }
1104 out: 1114 out:
1105 if (w) 1115 if (w)
1106 fw_notify("Workarounds for %s: 0x%x " 1116 dev_notice(tgt_dev(tgt), "workarounds 0x%x "
1107 "(firmware_revision 0x%06x, model_id 0x%06x)\n", 1117 "(firmware_revision 0x%06x, model_id 0x%06x)\n",
1108 tgt->bus_id, w, firmware_revision, model); 1118 w, firmware_revision, model);
1109 tgt->workarounds = w; 1119 tgt->workarounds = w;
1110} 1120}
1111 1121
@@ -1133,7 +1143,6 @@ static int sbp2_probe(struct device *dev)
1133 dev_set_drvdata(&unit->device, tgt); 1143 dev_set_drvdata(&unit->device, tgt);
1134 tgt->unit = unit; 1144 tgt->unit = unit;
1135 INIT_LIST_HEAD(&tgt->lu_list); 1145 INIT_LIST_HEAD(&tgt->lu_list);
1136 tgt->bus_id = dev_name(&unit->device);
1137 tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4]; 1146 tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4];
1138 1147
1139 if (fw_device_enable_phys_dma(device) < 0) 1148 if (fw_device_enable_phys_dma(device) < 0)
@@ -1239,7 +1248,7 @@ static int sbp2_remove(struct device *dev)
1239 kfree(lu); 1248 kfree(lu);
1240 } 1249 }
1241 scsi_remove_host(shost); 1250 scsi_remove_host(shost);
1242 fw_notify("released %s, target %d:0:0\n", tgt->bus_id, shost->host_no); 1251 dev_notice(dev, "released target %d:0:0\n", shost->host_no);
1243 1252
1244 scsi_host_put(shost); 1253 scsi_host_put(shost);
1245 return 0; 1254 return 0;
@@ -1325,7 +1334,7 @@ static void complete_command_orb(struct sbp2_orb *base_orb,
1325{ 1334{
1326 struct sbp2_command_orb *orb = 1335 struct sbp2_command_orb *orb =
1327 container_of(base_orb, struct sbp2_command_orb, base); 1336 container_of(base_orb, struct sbp2_command_orb, base);
1328 struct fw_device *device = target_device(orb->lu->tgt); 1337 struct fw_device *device = target_parent_device(orb->lu->tgt);
1329 int result; 1338 int result;
1330 1339
1331 if (status != NULL) { 1340 if (status != NULL) {
@@ -1433,7 +1442,7 @@ static int sbp2_scsi_queuecommand(struct Scsi_Host *shost,
1433 struct scsi_cmnd *cmd) 1442 struct scsi_cmnd *cmd)
1434{ 1443{
1435 struct sbp2_logical_unit *lu = cmd->device->hostdata; 1444 struct sbp2_logical_unit *lu = cmd->device->hostdata;
1436 struct fw_device *device = target_device(lu->tgt); 1445 struct fw_device *device = target_parent_device(lu->tgt);
1437 struct sbp2_command_orb *orb; 1446 struct sbp2_command_orb *orb;
1438 int generation, retval = SCSI_MLQUEUE_HOST_BUSY; 1447 int generation, retval = SCSI_MLQUEUE_HOST_BUSY;
1439 1448
@@ -1442,7 +1451,7 @@ static int sbp2_scsi_queuecommand(struct Scsi_Host *shost,
1442 * transfer direction not handled. 1451 * transfer direction not handled.
1443 */ 1452 */
1444 if (cmd->sc_data_direction == DMA_BIDIRECTIONAL) { 1453 if (cmd->sc_data_direction == DMA_BIDIRECTIONAL) {
1445 fw_error("Can't handle DMA_BIDIRECTIONAL, rejecting command\n"); 1454 dev_err(lu_dev(lu), "cannot handle bidirectional command\n");
1446 cmd->result = DID_ERROR << 16; 1455 cmd->result = DID_ERROR << 16;
1447 cmd->scsi_done(cmd); 1456 cmd->scsi_done(cmd);
1448 return 0; 1457 return 0;
@@ -1450,7 +1459,7 @@ static int sbp2_scsi_queuecommand(struct Scsi_Host *shost,
1450 1459
1451 orb = kzalloc(sizeof(*orb), GFP_ATOMIC); 1460 orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
1452 if (orb == NULL) { 1461 if (orb == NULL) {
1453 fw_notify("failed to alloc orb\n"); 1462 dev_notice(lu_dev(lu), "failed to alloc ORB\n");
1454 return SCSI_MLQUEUE_HOST_BUSY; 1463 return SCSI_MLQUEUE_HOST_BUSY;
1455 } 1464 }
1456 1465
@@ -1550,7 +1559,7 @@ static int sbp2_scsi_abort(struct scsi_cmnd *cmd)
1550{ 1559{
1551 struct sbp2_logical_unit *lu = cmd->device->hostdata; 1560 struct sbp2_logical_unit *lu = cmd->device->hostdata;
1552 1561
1553 fw_notify("%s: sbp2_scsi_abort\n", lu->tgt->bus_id); 1562 dev_notice(lu_dev(lu), "sbp2_scsi_abort\n");
1554 sbp2_agent_reset(lu); 1563 sbp2_agent_reset(lu);
1555 sbp2_cancel_orbs(lu); 1564 sbp2_cancel_orbs(lu);
1556 1565