diff options
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 177 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 4 |
2 files changed, 98 insertions, 83 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 413d8cd6a324..d61df036910c 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -530,15 +530,17 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) | |||
530 | /* Scsi_Host attributes. */ | 530 | /* Scsi_Host attributes. */ |
531 | 531 | ||
532 | static ssize_t | 532 | static ssize_t |
533 | qla2x00_drvr_version_show(struct class_device *cdev, char *buf) | 533 | qla2x00_drvr_version_show(struct device *dev, |
534 | struct device_attribute *attr, char *buf) | ||
534 | { | 535 | { |
535 | return snprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str); | 536 | return snprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str); |
536 | } | 537 | } |
537 | 538 | ||
538 | static ssize_t | 539 | static ssize_t |
539 | qla2x00_fw_version_show(struct class_device *cdev, char *buf) | 540 | qla2x00_fw_version_show(struct device *dev, |
541 | struct device_attribute *attr, char *buf) | ||
540 | { | 542 | { |
541 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 543 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
542 | char fw_str[30]; | 544 | char fw_str[30]; |
543 | 545 | ||
544 | return snprintf(buf, PAGE_SIZE, "%s\n", | 546 | return snprintf(buf, PAGE_SIZE, "%s\n", |
@@ -546,9 +548,10 @@ qla2x00_fw_version_show(struct class_device *cdev, char *buf) | |||
546 | } | 548 | } |
547 | 549 | ||
548 | static ssize_t | 550 | static ssize_t |
549 | qla2x00_serial_num_show(struct class_device *cdev, char *buf) | 551 | qla2x00_serial_num_show(struct device *dev, struct device_attribute *attr, |
552 | char *buf) | ||
550 | { | 553 | { |
551 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 554 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
552 | uint32_t sn; | 555 | uint32_t sn; |
553 | 556 | ||
554 | if (IS_FWI2_CAPABLE(ha)) | 557 | if (IS_FWI2_CAPABLE(ha)) |
@@ -560,40 +563,45 @@ qla2x00_serial_num_show(struct class_device *cdev, char *buf) | |||
560 | } | 563 | } |
561 | 564 | ||
562 | static ssize_t | 565 | static ssize_t |
563 | qla2x00_isp_name_show(struct class_device *cdev, char *buf) | 566 | qla2x00_isp_name_show(struct device *dev, struct device_attribute *attr, |
567 | char *buf) | ||
564 | { | 568 | { |
565 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 569 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
566 | return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device); | 570 | return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device); |
567 | } | 571 | } |
568 | 572 | ||
569 | static ssize_t | 573 | static ssize_t |
570 | qla2x00_isp_id_show(struct class_device *cdev, char *buf) | 574 | qla2x00_isp_id_show(struct device *dev, struct device_attribute *attr, |
575 | char *buf) | ||
571 | { | 576 | { |
572 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 577 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
573 | return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n", | 578 | return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n", |
574 | ha->product_id[0], ha->product_id[1], ha->product_id[2], | 579 | ha->product_id[0], ha->product_id[1], ha->product_id[2], |
575 | ha->product_id[3]); | 580 | ha->product_id[3]); |
576 | } | 581 | } |
577 | 582 | ||
578 | static ssize_t | 583 | static ssize_t |
579 | qla2x00_model_name_show(struct class_device *cdev, char *buf) | 584 | qla2x00_model_name_show(struct device *dev, struct device_attribute *attr, |
585 | char *buf) | ||
580 | { | 586 | { |
581 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 587 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
582 | return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number); | 588 | return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number); |
583 | } | 589 | } |
584 | 590 | ||
585 | static ssize_t | 591 | static ssize_t |
586 | qla2x00_model_desc_show(struct class_device *cdev, char *buf) | 592 | qla2x00_model_desc_show(struct device *dev, struct device_attribute *attr, |
593 | char *buf) | ||
587 | { | 594 | { |
588 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 595 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
589 | return snprintf(buf, PAGE_SIZE, "%s\n", | 596 | return snprintf(buf, PAGE_SIZE, "%s\n", |
590 | ha->model_desc ? ha->model_desc: ""); | 597 | ha->model_desc ? ha->model_desc: ""); |
591 | } | 598 | } |
592 | 599 | ||
593 | static ssize_t | 600 | static ssize_t |
594 | qla2x00_pci_info_show(struct class_device *cdev, char *buf) | 601 | qla2x00_pci_info_show(struct device *dev, struct device_attribute *attr, |
602 | char *buf) | ||
595 | { | 603 | { |
596 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 604 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
597 | char pci_info[30]; | 605 | char pci_info[30]; |
598 | 606 | ||
599 | return snprintf(buf, PAGE_SIZE, "%s\n", | 607 | return snprintf(buf, PAGE_SIZE, "%s\n", |
@@ -601,9 +609,10 @@ qla2x00_pci_info_show(struct class_device *cdev, char *buf) | |||
601 | } | 609 | } |
602 | 610 | ||
603 | static ssize_t | 611 | static ssize_t |
604 | qla2x00_state_show(struct class_device *cdev, char *buf) | 612 | qla2x00_state_show(struct device *dev, struct device_attribute *attr, |
613 | char *buf) | ||
605 | { | 614 | { |
606 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 615 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
607 | int len = 0; | 616 | int len = 0; |
608 | 617 | ||
609 | if (atomic_read(&ha->loop_state) == LOOP_DOWN || | 618 | if (atomic_read(&ha->loop_state) == LOOP_DOWN || |
@@ -639,9 +648,10 @@ qla2x00_state_show(struct class_device *cdev, char *buf) | |||
639 | } | 648 | } |
640 | 649 | ||
641 | static ssize_t | 650 | static ssize_t |
642 | qla2x00_zio_show(struct class_device *cdev, char *buf) | 651 | qla2x00_zio_show(struct device *dev, struct device_attribute *attr, |
652 | char *buf) | ||
643 | { | 653 | { |
644 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 654 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
645 | int len = 0; | 655 | int len = 0; |
646 | 656 | ||
647 | switch (ha->zio_mode) { | 657 | switch (ha->zio_mode) { |
@@ -656,9 +666,10 @@ qla2x00_zio_show(struct class_device *cdev, char *buf) | |||
656 | } | 666 | } |
657 | 667 | ||
658 | static ssize_t | 668 | static ssize_t |
659 | qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) | 669 | qla2x00_zio_store(struct device *dev, struct device_attribute *attr, |
670 | const char *buf, size_t count) | ||
660 | { | 671 | { |
661 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 672 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
662 | int val = 0; | 673 | int val = 0; |
663 | uint16_t zio_mode; | 674 | uint16_t zio_mode; |
664 | 675 | ||
@@ -682,18 +693,19 @@ qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) | |||
682 | } | 693 | } |
683 | 694 | ||
684 | static ssize_t | 695 | static ssize_t |
685 | qla2x00_zio_timer_show(struct class_device *cdev, char *buf) | 696 | qla2x00_zio_timer_show(struct device *dev, struct device_attribute *attr, |
697 | char *buf) | ||
686 | { | 698 | { |
687 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 699 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
688 | 700 | ||
689 | return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); | 701 | return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); |
690 | } | 702 | } |
691 | 703 | ||
692 | static ssize_t | 704 | static ssize_t |
693 | qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, | 705 | qla2x00_zio_timer_store(struct device *dev, struct device_attribute *attr, |
694 | size_t count) | 706 | const char *buf, size_t count) |
695 | { | 707 | { |
696 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 708 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
697 | int val = 0; | 709 | int val = 0; |
698 | uint16_t zio_timer; | 710 | uint16_t zio_timer; |
699 | 711 | ||
@@ -709,9 +721,10 @@ qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, | |||
709 | } | 721 | } |
710 | 722 | ||
711 | static ssize_t | 723 | static ssize_t |
712 | qla2x00_beacon_show(struct class_device *cdev, char *buf) | 724 | qla2x00_beacon_show(struct device *dev, struct device_attribute *attr, |
725 | char *buf) | ||
713 | { | 726 | { |
714 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 727 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
715 | int len = 0; | 728 | int len = 0; |
716 | 729 | ||
717 | if (ha->beacon_blink_led) | 730 | if (ha->beacon_blink_led) |
@@ -722,10 +735,10 @@ qla2x00_beacon_show(struct class_device *cdev, char *buf) | |||
722 | } | 735 | } |
723 | 736 | ||
724 | static ssize_t | 737 | static ssize_t |
725 | qla2x00_beacon_store(struct class_device *cdev, const char *buf, | 738 | qla2x00_beacon_store(struct device *dev, struct device_attribute *attr, |
726 | size_t count) | 739 | const char *buf, size_t count) |
727 | { | 740 | { |
728 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 741 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
729 | int val = 0; | 742 | int val = 0; |
730 | int rval; | 743 | int rval; |
731 | 744 | ||
@@ -753,84 +766,86 @@ qla2x00_beacon_store(struct class_device *cdev, const char *buf, | |||
753 | } | 766 | } |
754 | 767 | ||
755 | static ssize_t | 768 | static ssize_t |
756 | qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf) | 769 | qla2x00_optrom_bios_version_show(struct device *dev, |
770 | struct device_attribute *attr, char *buf) | ||
757 | { | 771 | { |
758 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 772 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
759 | 773 | ||
760 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1], | 774 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1], |
761 | ha->bios_revision[0]); | 775 | ha->bios_revision[0]); |
762 | } | 776 | } |
763 | 777 | ||
764 | static ssize_t | 778 | static ssize_t |
765 | qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf) | 779 | qla2x00_optrom_efi_version_show(struct device *dev, |
780 | struct device_attribute *attr, char *buf) | ||
766 | { | 781 | { |
767 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 782 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
768 | 783 | ||
769 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1], | 784 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1], |
770 | ha->efi_revision[0]); | 785 | ha->efi_revision[0]); |
771 | } | 786 | } |
772 | 787 | ||
773 | static ssize_t | 788 | static ssize_t |
774 | qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf) | 789 | qla2x00_optrom_fcode_version_show(struct device *dev, |
790 | struct device_attribute *attr, char *buf) | ||
775 | { | 791 | { |
776 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 792 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
777 | 793 | ||
778 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1], | 794 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1], |
779 | ha->fcode_revision[0]); | 795 | ha->fcode_revision[0]); |
780 | } | 796 | } |
781 | 797 | ||
782 | static ssize_t | 798 | static ssize_t |
783 | qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf) | 799 | qla2x00_optrom_fw_version_show(struct device *dev, |
800 | struct device_attribute *attr, char *buf) | ||
784 | { | 801 | { |
785 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 802 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
786 | 803 | ||
787 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n", | 804 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n", |
788 | ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2], | 805 | ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2], |
789 | ha->fw_revision[3]); | 806 | ha->fw_revision[3]); |
790 | } | 807 | } |
791 | 808 | ||
792 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, | 809 | static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL); |
793 | NULL); | 810 | static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); |
794 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); | 811 | static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); |
795 | static CLASS_DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); | 812 | static DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); |
796 | static CLASS_DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); | 813 | static DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); |
797 | static CLASS_DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); | 814 | static DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); |
798 | static CLASS_DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); | 815 | static DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); |
799 | static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); | 816 | static DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); |
800 | static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); | 817 | static DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); |
801 | static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); | 818 | static DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, qla2x00_zio_store); |
802 | static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, | 819 | static DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, |
803 | qla2x00_zio_store); | 820 | qla2x00_zio_timer_store); |
804 | static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, | 821 | static DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, |
805 | qla2x00_zio_timer_store); | 822 | qla2x00_beacon_store); |
806 | static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, | 823 | static DEVICE_ATTR(optrom_bios_version, S_IRUGO, |
807 | qla2x00_beacon_store); | 824 | qla2x00_optrom_bios_version_show, NULL); |
808 | static CLASS_DEVICE_ATTR(optrom_bios_version, S_IRUGO, | 825 | static DEVICE_ATTR(optrom_efi_version, S_IRUGO, |
809 | qla2x00_optrom_bios_version_show, NULL); | 826 | qla2x00_optrom_efi_version_show, NULL); |
810 | static CLASS_DEVICE_ATTR(optrom_efi_version, S_IRUGO, | 827 | static DEVICE_ATTR(optrom_fcode_version, S_IRUGO, |
811 | qla2x00_optrom_efi_version_show, NULL); | 828 | qla2x00_optrom_fcode_version_show, NULL); |
812 | static CLASS_DEVICE_ATTR(optrom_fcode_version, S_IRUGO, | 829 | static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show, |
813 | qla2x00_optrom_fcode_version_show, NULL); | 830 | NULL); |
814 | static CLASS_DEVICE_ATTR(optrom_fw_version, S_IRUGO, | 831 | |
815 | qla2x00_optrom_fw_version_show, NULL); | 832 | struct device_attribute *qla2x00_host_attrs[] = { |
816 | 833 | &dev_attr_driver_version, | |
817 | struct class_device_attribute *qla2x00_host_attrs[] = { | 834 | &dev_attr_fw_version, |
818 | &class_device_attr_driver_version, | 835 | &dev_attr_serial_num, |
819 | &class_device_attr_fw_version, | 836 | &dev_attr_isp_name, |
820 | &class_device_attr_serial_num, | 837 | &dev_attr_isp_id, |
821 | &class_device_attr_isp_name, | 838 | &dev_attr_model_name, |
822 | &class_device_attr_isp_id, | 839 | &dev_attr_model_desc, |
823 | &class_device_attr_model_name, | 840 | &dev_attr_pci_info, |
824 | &class_device_attr_model_desc, | 841 | &dev_attr_state, |
825 | &class_device_attr_pci_info, | 842 | &dev_attr_zio, |
826 | &class_device_attr_state, | 843 | &dev_attr_zio_timer, |
827 | &class_device_attr_zio, | 844 | &dev_attr_beacon, |
828 | &class_device_attr_zio_timer, | 845 | &dev_attr_optrom_bios_version, |
829 | &class_device_attr_beacon, | 846 | &dev_attr_optrom_efi_version, |
830 | &class_device_attr_optrom_bios_version, | 847 | &dev_attr_optrom_fcode_version, |
831 | &class_device_attr_optrom_efi_version, | 848 | &dev_attr_optrom_fw_version, |
832 | &class_device_attr_optrom_fcode_version, | ||
833 | &class_device_attr_optrom_fw_version, | ||
834 | NULL, | 849 | NULL, |
835 | }; | 850 | }; |
836 | 851 | ||
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index a9571c214a9e..76eb4fecce65 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -347,8 +347,8 @@ extern void qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *); | |||
347 | /* | 347 | /* |
348 | * Global Function Prototypes in qla_attr.c source file. | 348 | * Global Function Prototypes in qla_attr.c source file. |
349 | */ | 349 | */ |
350 | struct class_device_attribute; | 350 | struct device_attribute; |
351 | extern struct class_device_attribute *qla2x00_host_attrs[]; | 351 | extern struct device_attribute *qla2x00_host_attrs[]; |
352 | struct fc_function_template; | 352 | struct fc_function_template; |
353 | extern struct fc_function_template qla2xxx_transport_functions; | 353 | extern struct fc_function_template qla2xxx_transport_functions; |
354 | extern struct fc_function_template qla2xxx_transport_vport_functions; | 354 | extern struct fc_function_template qla2xxx_transport_vport_functions; |