aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2008-02-21 18:13:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:33 -0400
commitee959b00c335d7780136c5abda37809191fe52c3 (patch)
tree7775f3b274fd8caf5e7e5154fea89e96f2babd94 /drivers/scsi/qla2xxx
parent56d110e852b0b1c85ad6c9bfe1cb4473ceb16402 (diff)
SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c177
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
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
532static ssize_t 532static ssize_t
533qla2x00_drvr_version_show(struct class_device *cdev, char *buf) 533qla2x00_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
538static ssize_t 539static ssize_t
539qla2x00_fw_version_show(struct class_device *cdev, char *buf) 540qla2x00_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
548static ssize_t 550static ssize_t
549qla2x00_serial_num_show(struct class_device *cdev, char *buf) 551qla2x00_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
562static ssize_t 565static ssize_t
563qla2x00_isp_name_show(struct class_device *cdev, char *buf) 566qla2x00_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
569static ssize_t 573static ssize_t
570qla2x00_isp_id_show(struct class_device *cdev, char *buf) 574qla2x00_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
578static ssize_t 583static ssize_t
579qla2x00_model_name_show(struct class_device *cdev, char *buf) 584qla2x00_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
585static ssize_t 591static ssize_t
586qla2x00_model_desc_show(struct class_device *cdev, char *buf) 592qla2x00_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
593static ssize_t 600static ssize_t
594qla2x00_pci_info_show(struct class_device *cdev, char *buf) 601qla2x00_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
603static ssize_t 611static ssize_t
604qla2x00_state_show(struct class_device *cdev, char *buf) 612qla2x00_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
641static ssize_t 650static ssize_t
642qla2x00_zio_show(struct class_device *cdev, char *buf) 651qla2x00_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
658static ssize_t 668static ssize_t
659qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) 669qla2x00_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
684static ssize_t 695static ssize_t
685qla2x00_zio_timer_show(struct class_device *cdev, char *buf) 696qla2x00_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
692static ssize_t 704static ssize_t
693qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, 705qla2x00_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
711static ssize_t 723static ssize_t
712qla2x00_beacon_show(struct class_device *cdev, char *buf) 724qla2x00_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
724static ssize_t 737static ssize_t
725qla2x00_beacon_store(struct class_device *cdev, const char *buf, 738qla2x00_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
755static ssize_t 768static ssize_t
756qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf) 769qla2x00_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
764static ssize_t 778static ssize_t
765qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf) 779qla2x00_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
773static ssize_t 788static ssize_t
774qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf) 789qla2x00_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
782static ssize_t 798static ssize_t
783qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf) 799qla2x00_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
792static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, 809static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL);
793 NULL); 810static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL);
794static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); 811static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL);
795static CLASS_DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); 812static DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL);
796static CLASS_DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); 813static DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL);
797static CLASS_DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); 814static DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL);
798static CLASS_DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); 815static DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL);
799static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); 816static DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL);
800static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); 817static DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL);
801static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); 818static DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, qla2x00_zio_store);
802static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, 819static DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show,
803 qla2x00_zio_store); 820 qla2x00_zio_timer_store);
804static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, 821static DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show,
805 qla2x00_zio_timer_store); 822 qla2x00_beacon_store);
806static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, 823static DEVICE_ATTR(optrom_bios_version, S_IRUGO,
807 qla2x00_beacon_store); 824 qla2x00_optrom_bios_version_show, NULL);
808static CLASS_DEVICE_ATTR(optrom_bios_version, S_IRUGO, 825static DEVICE_ATTR(optrom_efi_version, S_IRUGO,
809 qla2x00_optrom_bios_version_show, NULL); 826 qla2x00_optrom_efi_version_show, NULL);
810static CLASS_DEVICE_ATTR(optrom_efi_version, S_IRUGO, 827static DEVICE_ATTR(optrom_fcode_version, S_IRUGO,
811 qla2x00_optrom_efi_version_show, NULL); 828 qla2x00_optrom_fcode_version_show, NULL);
812static CLASS_DEVICE_ATTR(optrom_fcode_version, S_IRUGO, 829static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show,
813 qla2x00_optrom_fcode_version_show, NULL); 830 NULL);
814static CLASS_DEVICE_ATTR(optrom_fw_version, S_IRUGO, 831
815 qla2x00_optrom_fw_version_show, NULL); 832struct device_attribute *qla2x00_host_attrs[] = {
816 833 &dev_attr_driver_version,
817struct 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 */
350struct class_device_attribute; 350struct device_attribute;
351extern struct class_device_attribute *qla2x00_host_attrs[]; 351extern struct device_attribute *qla2x00_host_attrs[];
352struct fc_function_template; 352struct fc_function_template;
353extern struct fc_function_template qla2xxx_transport_functions; 353extern struct fc_function_template qla2xxx_transport_functions;
354extern struct fc_function_template qla2xxx_transport_vport_functions; 354extern struct fc_function_template qla2xxx_transport_vport_functions;