diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2011-04-14 19:50:35 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-05-01 11:55:56 -0400 |
commit | 7c38c05b3ef1a8a9f7e0416072a8ea2730841c91 (patch) | |
tree | 673a2620a7e933b8d177734f7339d7ec87394e4d /drivers | |
parent | 61338a0b3493fddfca2980ece4423839748fcbab (diff) |
[SCSI] bfa: Move debugfs initialization before bfa init.
Move the initialization of debugfs before bfa init, to enable us to
collect driver/firmware traces if init fails. Also add a printk to
display message on bfa_init failure.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 22 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_debugfs.c | 33 |
2 files changed, 27 insertions, 28 deletions
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index d9360bf18d33..59b5e9b61d71 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -232,6 +232,9 @@ bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event) | |||
232 | if ((bfad->bfad_flags & BFAD_HAL_INIT_DONE)) { | 232 | if ((bfad->bfad_flags & BFAD_HAL_INIT_DONE)) { |
233 | bfa_sm_send_event(bfad, BFAD_E_INIT_SUCCESS); | 233 | bfa_sm_send_event(bfad, BFAD_E_INIT_SUCCESS); |
234 | } else { | 234 | } else { |
235 | printk(KERN_WARNING | ||
236 | "bfa %s: bfa init failed\n", | ||
237 | bfad->pci_name); | ||
235 | bfad->bfad_flags |= BFAD_HAL_INIT_FAIL; | 238 | bfad->bfad_flags |= BFAD_HAL_INIT_FAIL; |
236 | bfa_sm_send_event(bfad, BFAD_E_INIT_FAILED); | 239 | bfa_sm_send_event(bfad, BFAD_E_INIT_FAILED); |
237 | } | 240 | } |
@@ -1001,10 +1004,6 @@ bfad_cfg_pport(struct bfad_s *bfad, enum bfa_lport_role role) | |||
1001 | bfad->pport.roles |= BFA_LPORT_ROLE_FCP_IM; | 1004 | bfad->pport.roles |= BFA_LPORT_ROLE_FCP_IM; |
1002 | } | 1005 | } |
1003 | 1006 | ||
1004 | /* Setup the debugfs node for this scsi_host */ | ||
1005 | if (bfa_debugfs_enable) | ||
1006 | bfad_debugfs_init(&bfad->pport); | ||
1007 | |||
1008 | bfad->bfad_flags |= BFAD_CFG_PPORT_DONE; | 1007 | bfad->bfad_flags |= BFAD_CFG_PPORT_DONE; |
1009 | 1008 | ||
1010 | out: | 1009 | out: |
@@ -1014,10 +1013,6 @@ out: | |||
1014 | void | 1013 | void |
1015 | bfad_uncfg_pport(struct bfad_s *bfad) | 1014 | bfad_uncfg_pport(struct bfad_s *bfad) |
1016 | { | 1015 | { |
1017 | /* Remove the debugfs node for this scsi_host */ | ||
1018 | kfree(bfad->regdata); | ||
1019 | bfad_debugfs_exit(&bfad->pport); | ||
1020 | |||
1021 | if ((supported_fc4s & BFA_LPORT_ROLE_FCP_IM) && | 1016 | if ((supported_fc4s & BFA_LPORT_ROLE_FCP_IM) && |
1022 | (bfad->pport.roles & BFA_LPORT_ROLE_FCP_IM)) { | 1017 | (bfad->pport.roles & BFA_LPORT_ROLE_FCP_IM)) { |
1023 | bfad_im_scsi_host_free(bfad, bfad->pport.im_port); | 1018 | bfad_im_scsi_host_free(bfad, bfad->pport.im_port); |
@@ -1399,6 +1394,10 @@ bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1399 | bfad->pport.bfad = bfad; | 1394 | bfad->pport.bfad = bfad; |
1400 | INIT_LIST_HEAD(&bfad->pbc_vport_list); | 1395 | INIT_LIST_HEAD(&bfad->pbc_vport_list); |
1401 | 1396 | ||
1397 | /* Setup the debugfs node for this bfad */ | ||
1398 | if (bfa_debugfs_enable) | ||
1399 | bfad_debugfs_init(&bfad->pport); | ||
1400 | |||
1402 | retval = bfad_drv_init(bfad); | 1401 | retval = bfad_drv_init(bfad); |
1403 | if (retval != BFA_STATUS_OK) | 1402 | if (retval != BFA_STATUS_OK) |
1404 | goto out_drv_init_failure; | 1403 | goto out_drv_init_failure; |
@@ -1414,6 +1413,9 @@ out_bfad_sm_failure: | |||
1414 | bfa_detach(&bfad->bfa); | 1413 | bfa_detach(&bfad->bfa); |
1415 | bfad_hal_mem_release(bfad); | 1414 | bfad_hal_mem_release(bfad); |
1416 | out_drv_init_failure: | 1415 | out_drv_init_failure: |
1416 | /* Remove the debugfs node for this bfad */ | ||
1417 | kfree(bfad->regdata); | ||
1418 | bfad_debugfs_exit(&bfad->pport); | ||
1417 | mutex_lock(&bfad_mutex); | 1419 | mutex_lock(&bfad_mutex); |
1418 | bfad_inst--; | 1420 | bfad_inst--; |
1419 | list_del(&bfad->list_entry); | 1421 | list_del(&bfad->list_entry); |
@@ -1455,6 +1457,10 @@ bfad_pci_remove(struct pci_dev *pdev) | |||
1455 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 1457 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1456 | bfad_hal_mem_release(bfad); | 1458 | bfad_hal_mem_release(bfad); |
1457 | 1459 | ||
1460 | /* Remove the debugfs node for this bfad */ | ||
1461 | kfree(bfad->regdata); | ||
1462 | bfad_debugfs_exit(&bfad->pport); | ||
1463 | |||
1458 | /* Cleaning the BFAD instance */ | 1464 | /* Cleaning the BFAD instance */ |
1459 | mutex_lock(&bfad_mutex); | 1465 | mutex_lock(&bfad_mutex); |
1460 | bfad_inst--; | 1466 | bfad_inst--; |
diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c index c66e32eced7b..48be0c54f2de 100644 --- a/drivers/scsi/bfa/bfad_debugfs.c +++ b/drivers/scsi/bfa/bfad_debugfs.c | |||
@@ -28,10 +28,10 @@ | |||
28 | * mount -t debugfs none /sys/kernel/debug | 28 | * mount -t debugfs none /sys/kernel/debug |
29 | * | 29 | * |
30 | * BFA Hierarchy: | 30 | * BFA Hierarchy: |
31 | * - bfa/host# | 31 | * - bfa/pci_dev:<pci_name> |
32 | * where the host number corresponds to the one under /sys/class/scsi_host/host# | 32 | * where the pci_name corresponds to the one under /sys/bus/pci/drivers/bfa |
33 | * | 33 | * |
34 | * Debugging service available per host: | 34 | * Debugging service available per pci_dev: |
35 | * fwtrc: To collect current firmware trace. | 35 | * fwtrc: To collect current firmware trace. |
36 | * drvtrc: To collect current driver trace | 36 | * drvtrc: To collect current driver trace |
37 | * fwsave: To collect last saved fw trace as a result of firmware crash. | 37 | * fwsave: To collect last saved fw trace as a result of firmware crash. |
@@ -489,11 +489,9 @@ static atomic_t bfa_debugfs_port_count; | |||
489 | inline void | 489 | inline void |
490 | bfad_debugfs_init(struct bfad_port_s *port) | 490 | bfad_debugfs_init(struct bfad_port_s *port) |
491 | { | 491 | { |
492 | struct bfad_im_port_s *im_port = port->im_port; | 492 | struct bfad_s *bfad = port->bfad; |
493 | struct bfad_s *bfad = im_port->bfad; | ||
494 | struct Scsi_Host *shost = im_port->shost; | ||
495 | const struct bfad_debugfs_entry *file; | 493 | const struct bfad_debugfs_entry *file; |
496 | char name[16]; | 494 | char name[64]; |
497 | int i; | 495 | int i; |
498 | 496 | ||
499 | if (!bfa_debugfs_enable) | 497 | if (!bfa_debugfs_enable) |
@@ -510,17 +508,15 @@ bfad_debugfs_init(struct bfad_port_s *port) | |||
510 | } | 508 | } |
511 | } | 509 | } |
512 | 510 | ||
513 | /* | 511 | /* Setup the pci_dev debugfs directory for the port */ |
514 | * Setup the host# directory for the port, | 512 | snprintf(name, sizeof(name), "pci_dev:%s", bfad->pci_name); |
515 | * corresponds to the scsi_host num of this port. | ||
516 | */ | ||
517 | snprintf(name, sizeof(name), "host%d", shost->host_no); | ||
518 | if (!port->port_debugfs_root) { | 513 | if (!port->port_debugfs_root) { |
519 | port->port_debugfs_root = | 514 | port->port_debugfs_root = |
520 | debugfs_create_dir(name, bfa_debugfs_root); | 515 | debugfs_create_dir(name, bfa_debugfs_root); |
521 | if (!port->port_debugfs_root) { | 516 | if (!port->port_debugfs_root) { |
522 | printk(KERN_WARNING | 517 | printk(KERN_WARNING |
523 | "BFA host root dir creation failed\n"); | 518 | "bfa %s: debugfs root creation failed\n", |
519 | bfad->pci_name); | ||
524 | goto err; | 520 | goto err; |
525 | } | 521 | } |
526 | 522 | ||
@@ -536,8 +532,8 @@ bfad_debugfs_init(struct bfad_port_s *port) | |||
536 | file->fops); | 532 | file->fops); |
537 | if (!bfad->bfad_dentry_files[i]) { | 533 | if (!bfad->bfad_dentry_files[i]) { |
538 | printk(KERN_WARNING | 534 | printk(KERN_WARNING |
539 | "BFA host%d: create %s entry failed\n", | 535 | "bfa %s: debugfs %s creation failed\n", |
540 | shost->host_no, file->name); | 536 | bfad->pci_name, file->name); |
541 | goto err; | 537 | goto err; |
542 | } | 538 | } |
543 | } | 539 | } |
@@ -550,8 +546,7 @@ err: | |||
550 | inline void | 546 | inline void |
551 | bfad_debugfs_exit(struct bfad_port_s *port) | 547 | bfad_debugfs_exit(struct bfad_port_s *port) |
552 | { | 548 | { |
553 | struct bfad_im_port_s *im_port = port->im_port; | 549 | struct bfad_s *bfad = port->bfad; |
554 | struct bfad_s *bfad = im_port->bfad; | ||
555 | int i; | 550 | int i; |
556 | 551 | ||
557 | for (i = 0; i < ARRAY_SIZE(bfad_debugfs_files); i++) { | 552 | for (i = 0; i < ARRAY_SIZE(bfad_debugfs_files); i++) { |
@@ -562,9 +557,7 @@ bfad_debugfs_exit(struct bfad_port_s *port) | |||
562 | } | 557 | } |
563 | 558 | ||
564 | /* | 559 | /* |
565 | * Remove the host# directory for the port, | 560 | * Remove the pci_dev debugfs directory for the port */ |
566 | * corresponds to the scsi_host num of this port. | ||
567 | */ | ||
568 | if (port->port_debugfs_root) { | 561 | if (port->port_debugfs_root) { |
569 | debugfs_remove(port->port_debugfs_root); | 562 | debugfs_remove(port->port_debugfs_root); |
570 | port->port_debugfs_root = NULL; | 563 | port->port_debugfs_root = NULL; |