sbp2: misc debug logging cleanups

- move call of scsi_print_command from sbp2_send_command to the beginning of
sbp2_queue_command to show also commands which are not sent
- put sbp2's name into scsi_print_sense
- use __FUNCTION__ in log messages
- remove a few less useful log messages and comments

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jody McIntyre <scjody@modernduck.com>

authored by Stefan Richter and committed by Jody McIntyre d024ebc6 8f0525ff

+33 -77
+33 -77
drivers/ieee1394/sbp2.c
··· 214 214 #endif 215 215 216 216 #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) 217 + #define SBP2_DEBUG_ENTER() SBP2_DEBUG("%s", __FUNCTION__) 217 218 218 219 /* 219 220 * Globals ··· 536 535 command->Current_SCpnt = Current_SCpnt; 537 536 list_add_tail(&command->list, &scsi_id->sbp2_command_orb_inuse); 538 537 } else { 539 - SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); 538 + SBP2_ERR("%s: no orbs available", __FUNCTION__); 540 539 } 541 540 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 542 541 return command; ··· 550 549 struct hpsb_host *host; 551 550 552 551 if (!scsi_id) { 553 - printk(KERN_ERR "%s: scsi_id == NULL\n", __FUNCTION__); 552 + SBP2_ERR("%s: scsi_id == NULL", __FUNCTION__); 554 553 return; 555 554 } 556 555 ··· 611 610 struct unit_directory *ud; 612 611 struct scsi_id_instance_data *scsi_id; 613 612 614 - SBP2_DEBUG("sbp2_probe"); 613 + SBP2_DEBUG_ENTER(); 615 614 616 615 ud = container_of(dev, struct unit_directory, device); 617 616 ··· 636 635 struct scsi_id_instance_data *scsi_id; 637 636 struct scsi_device *sdev; 638 637 639 - SBP2_DEBUG("sbp2_remove"); 638 + SBP2_DEBUG_ENTER(); 640 639 641 640 ud = container_of(dev, struct unit_directory, device); 642 641 scsi_id = ud->device.driver_data; ··· 668 667 { 669 668 struct scsi_id_instance_data *scsi_id = ud->device.driver_data; 670 669 671 - SBP2_DEBUG("sbp2_update"); 670 + SBP2_DEBUG_ENTER(); 672 671 673 672 if (sbp2_reconnect_device(scsi_id)) { 674 673 ··· 716 715 struct Scsi_Host *scsi_host = NULL; 717 716 struct scsi_id_instance_data *scsi_id = NULL; 718 717 719 - SBP2_DEBUG("sbp2_alloc_device"); 718 + SBP2_DEBUG_ENTER(); 720 719 721 720 scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL); 722 721 if (!scsi_id) { ··· 827 826 struct sbp2scsi_host_info *hi = scsi_id->hi; 828 827 int error; 829 828 830 - SBP2_DEBUG("sbp2_start_device"); 829 + SBP2_DEBUG_ENTER(); 831 830 832 831 /* Login FIFO DMA */ 833 832 scsi_id->login_response = ··· 902 901 * allows someone else to login instead. One second makes sense. */ 903 902 msleep_interruptible(1000); 904 903 if (signal_pending(current)) { 905 - SBP2_WARN("aborting sbp2_start_device due to event"); 906 904 sbp2_remove_device(scsi_id); 907 905 return -EINTR; 908 906 } ··· 954 954 { 955 955 struct sbp2scsi_host_info *hi; 956 956 957 - SBP2_DEBUG("sbp2_remove_device"); 957 + SBP2_DEBUG_ENTER(); 958 958 959 959 if (!scsi_id) 960 960 return; ··· 1086 1086 int max_logins; 1087 1087 int active_logins; 1088 1088 1089 - SBP2_DEBUG("sbp2_query_logins"); 1089 + SBP2_DEBUG_ENTER(); 1090 1090 1091 1091 scsi_id->query_logins_orb->reserved1 = 0x0; 1092 1092 scsi_id->query_logins_orb->reserved2 = 0x0; 1093 1093 1094 1094 scsi_id->query_logins_orb->query_response_lo = scsi_id->query_logins_response_dma; 1095 1095 scsi_id->query_logins_orb->query_response_hi = ORB_SET_NODE_ID(hi->host->node_id); 1096 - SBP2_DEBUG("sbp2_query_logins: query_response_hi/lo initialized"); 1097 1096 1098 1097 scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); 1099 1098 scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); 1100 1099 scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); 1101 - SBP2_DEBUG("sbp2_query_logins: lun_misc initialized"); 1102 1100 1103 1101 scsi_id->query_logins_orb->reserved_resp_length = 1104 1102 ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response)); 1105 - SBP2_DEBUG("sbp2_query_logins: reserved_resp_length initialized"); 1106 1103 1107 1104 scsi_id->query_logins_orb->status_fifo_hi = 1108 1105 ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); ··· 1108 1111 1109 1112 sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); 1110 1113 1111 - SBP2_DEBUG("sbp2_query_logins: orb byte-swapped"); 1112 - 1113 1114 sbp2util_packet_dump(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb), 1114 1115 "sbp2 query logins orb", scsi_id->query_logins_orb_dma); 1115 1116 1116 1117 memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response)); 1117 1118 memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); 1118 - 1119 - SBP2_DEBUG("sbp2_query_logins: query_logins_response/status FIFO memset"); 1120 1119 1121 1120 data[0] = ORB_SET_NODE_ID(hi->host->node_id); 1122 1121 data[1] = scsi_id->query_logins_orb_dma; ··· 1120 1127 1121 1128 atomic_set(&scsi_id->sbp2_login_complete, 0); 1122 1129 1123 - SBP2_DEBUG("sbp2_query_logins: prepared to write"); 1124 1130 hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); 1125 - SBP2_DEBUG("sbp2_query_logins: written"); 1126 1131 1127 1132 if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) { 1128 1133 SBP2_INFO("Error querying logins to SBP-2 device - timed out"); ··· 1169 1178 struct sbp2scsi_host_info *hi = scsi_id->hi; 1170 1179 quadlet_t data[2]; 1171 1180 1172 - SBP2_DEBUG("sbp2_login_device"); 1181 + SBP2_DEBUG_ENTER(); 1173 1182 1174 1183 if (!scsi_id->login_orb) { 1175 - SBP2_DEBUG("sbp2_login_device: login_orb not alloc'd!"); 1184 + SBP2_DEBUG("%s: login_orb not alloc'd!", __FUNCTION__); 1176 1185 return -EIO; 1177 1186 } 1178 1187 ··· 1186 1195 /* Set-up login ORB, assume no password */ 1187 1196 scsi_id->login_orb->password_hi = 0; 1188 1197 scsi_id->login_orb->password_lo = 0; 1189 - SBP2_DEBUG("sbp2_login_device: password_hi/lo initialized"); 1190 1198 1191 1199 scsi_id->login_orb->login_response_lo = scsi_id->login_response_dma; 1192 1200 scsi_id->login_orb->login_response_hi = ORB_SET_NODE_ID(hi->host->node_id); 1193 - SBP2_DEBUG("sbp2_login_device: login_response_hi/lo initialized"); 1194 1201 1195 1202 scsi_id->login_orb->lun_misc = ORB_SET_FUNCTION(SBP2_LOGIN_REQUEST); 1196 1203 scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */ 1197 1204 scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */ 1198 1205 scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */ 1199 1206 scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); 1200 - SBP2_DEBUG("sbp2_login_device: lun_misc initialized"); 1201 1207 1202 1208 scsi_id->login_orb->passwd_resp_lengths = 1203 1209 ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response)); 1204 - SBP2_DEBUG("sbp2_login_device: passwd_resp_lengths initialized"); 1205 1210 1206 1211 scsi_id->login_orb->status_fifo_hi = 1207 1212 ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); 1208 1213 scsi_id->login_orb->status_fifo_lo = 1209 1214 ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); 1210 1215 1211 - /* 1212 - * Byte swap ORB if necessary 1213 - */ 1214 1216 sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb)); 1215 - 1216 - SBP2_DEBUG("sbp2_login_device: orb byte-swapped"); 1217 1217 1218 1218 sbp2util_packet_dump(scsi_id->login_orb, sizeof(struct sbp2_login_orb), 1219 1219 "sbp2 login orb", scsi_id->login_orb_dma); 1220 1220 1221 - /* 1222 - * Initialize login response and status fifo 1223 - */ 1224 1221 memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response)); 1225 1222 memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); 1226 1223 1227 - SBP2_DEBUG("sbp2_login_device: login_response/status FIFO memset"); 1228 - 1229 - /* 1230 - * Ok, let's write to the target's management agent register 1231 - */ 1232 1224 data[0] = ORB_SET_NODE_ID(hi->host->node_id); 1233 1225 data[1] = scsi_id->login_orb_dma; 1234 1226 sbp2util_cpu_to_be32_buffer(data, 8); 1235 1227 1236 1228 atomic_set(&scsi_id->sbp2_login_complete, 0); 1237 1229 1238 - SBP2_DEBUG("sbp2_login_device: prepared to write to %08x", 1239 - (unsigned int)scsi_id->sbp2_management_agent_addr); 1240 1230 hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); 1241 - SBP2_DEBUG("sbp2_login_device: written"); 1242 1231 1243 1232 /* 1244 1233 * Wait for login status (up to 20 seconds)... ··· 1282 1311 quadlet_t data[2]; 1283 1312 int error; 1284 1313 1285 - SBP2_DEBUG("sbp2_logout_device"); 1314 + SBP2_DEBUG_ENTER(); 1286 1315 1287 1316 /* 1288 1317 * Set-up logout ORB ··· 1346 1375 quadlet_t data[2]; 1347 1376 int error; 1348 1377 1349 - SBP2_DEBUG("sbp2_reconnect_device"); 1378 + SBP2_DEBUG_ENTER(); 1350 1379 1351 1380 /* 1352 1381 * Set-up reconnect ORB ··· 1437 1466 { 1438 1467 quadlet_t data; 1439 1468 1440 - SBP2_DEBUG("sbp2_set_busy_timeout"); 1469 + SBP2_DEBUG_ENTER(); 1441 1470 1442 - /* 1443 - * Ok, let's write to the target's busy timeout register 1444 - */ 1445 1471 data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE); 1446 - 1447 - if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) { 1448 - SBP2_ERR("sbp2_set_busy_timeout error"); 1449 - } 1450 - 1472 + if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) 1473 + SBP2_ERR("%s error", __FUNCTION__); 1451 1474 return 0; 1452 1475 } 1453 1476 ··· 1460 1495 firmware_revision, workarounds; 1461 1496 int i; 1462 1497 1463 - SBP2_DEBUG("sbp2_parse_unit_directory"); 1498 + SBP2_DEBUG_ENTER(); 1464 1499 1465 1500 management_agent_addr = 0x0; 1466 1501 command_set_spec_id = 0x0; ··· 1593 1628 { 1594 1629 struct sbp2scsi_host_info *hi = scsi_id->hi; 1595 1630 1596 - SBP2_DEBUG("sbp2_max_speed_and_size"); 1631 + SBP2_DEBUG_ENTER(); 1597 1632 1598 1633 /* Initial setting comes from the hosts speed map */ 1599 1634 scsi_id->speed_code = ··· 1630 1665 u64 addr; 1631 1666 int retval; 1632 1667 1633 - SBP2_DEBUG("sbp2_agent_reset"); 1668 + SBP2_DEBUG_ENTER(); 1634 1669 1635 - /* 1636 - * Ok, let's write to the target's management agent register 1637 - */ 1638 1670 data = ntohl(SBP2_AGENT_RESET_DATA); 1639 1671 addr = scsi_id->sbp2_command_block_agent_addr + SBP2_AGENT_RESET_OFFSET; 1640 1672 ··· 1979 2017 unsigned int request_bufflen = SCpnt->request_bufflen; 1980 2018 struct sbp2_command_info *command; 1981 2019 1982 - SBP2_DEBUG("sbp2_send_command"); 1983 - #if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP) 1984 - printk("[scsi command]\n "); 1985 - scsi_print_command(SCpnt); 1986 - #endif 2020 + SBP2_DEBUG_ENTER(); 1987 2021 SBP2_DEBUG("SCSI transfer size = %x", request_bufflen); 1988 2022 SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg); 1989 2023 ··· 2019 2061 */ 2020 2062 static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) 2021 2063 { 2022 - SBP2_DEBUG("sbp2_status_to_sense_data"); 2064 + SBP2_DEBUG_ENTER(); 2023 2065 2024 2066 /* 2025 2067 * Ok, it's pretty ugly... ;-) ··· 2053 2095 { 2054 2096 u8 *scsi_buf = SCpnt->request_buffer; 2055 2097 2056 - SBP2_DEBUG("sbp2_check_sbp2_response"); 2098 + SBP2_DEBUG_ENTER(); 2057 2099 2058 2100 if (SCpnt->cmnd[0] == INQUIRY && (SCpnt->cmnd[1] & 3) == 0) { 2059 2101 /* ··· 2084 2126 struct sbp2_command_info *command; 2085 2127 unsigned long flags; 2086 2128 2087 - SBP2_DEBUG("sbp2_handle_status_write"); 2129 + SBP2_DEBUG_ENTER(); 2088 2130 2089 2131 sbp2util_packet_dump(data, length, "sbp2 status write by device", (u32)addr); 2090 2132 ··· 2231 2273 struct sbp2scsi_host_info *hi; 2232 2274 int result = DID_NO_CONNECT << 16; 2233 2275 2234 - SBP2_DEBUG("sbp2scsi_queuecommand"); 2276 + SBP2_DEBUG_ENTER(); 2277 + #if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP) 2278 + scsi_print_command(SCpnt); 2279 + #endif 2235 2280 2236 2281 if (!sbp2util_node_is_available(scsi_id)) 2237 2282 goto done; ··· 2312 2351 struct sbp2_command_info *command; 2313 2352 unsigned long flags; 2314 2353 2315 - SBP2_DEBUG("sbp2scsi_complete_all_commands"); 2354 + SBP2_DEBUG_ENTER(); 2316 2355 2317 2356 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 2318 2357 while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { ··· 2345 2384 u32 scsi_status, struct scsi_cmnd *SCpnt, 2346 2385 void (*done)(struct scsi_cmnd *)) 2347 2386 { 2348 - SBP2_DEBUG("sbp2scsi_complete_command"); 2387 + SBP2_DEBUG_ENTER(); 2349 2388 2350 2389 /* 2351 2390 * Sanity ··· 2382 2421 case SBP2_SCSI_STATUS_CHECK_CONDITION: 2383 2422 SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION"); 2384 2423 SCpnt->result = CHECK_CONDITION << 1 | DID_OK << 16; 2385 - 2386 - /* 2387 - * Debug stuff 2388 - */ 2389 2424 #if CONFIG_IEEE1394_SBP2_DEBUG >= 1 2390 2425 scsi_print_command(SCpnt); 2391 - scsi_print_sense("bh", SCpnt); 2426 + scsi_print_sense(SBP2_DEVICE_NAME, SCpnt); 2392 2427 #endif 2393 - 2394 2428 break; 2395 2429 2396 2430 case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: ··· 2595 2639 { 2596 2640 int ret; 2597 2641 2598 - SBP2_DEBUG("sbp2_module_init"); 2642 + SBP2_DEBUG_ENTER(); 2599 2643 2600 2644 /* Module load debug option to force one command at a time (serializing I/O) */ 2601 2645 if (serialize_io) { ··· 2623 2667 2624 2668 static void __exit sbp2_module_exit(void) 2625 2669 { 2626 - SBP2_DEBUG("sbp2_module_exit"); 2670 + SBP2_DEBUG_ENTER(); 2627 2671 2628 2672 hpsb_unregister_protocol(&sbp2_driver); 2629 2673