| .. | .. |
|---|
| 666 | 666 | struct slot *slot; |
|---|
| 667 | 667 | int rc = 0; |
|---|
| 668 | 668 | |
|---|
| 669 | | - if (!hotplug_slot || !hotplug_slot->private) |
|---|
| 670 | | - return -EINVAL; |
|---|
| 671 | | - |
|---|
| 672 | | - slot = hotplug_slot->private; |
|---|
| 669 | + slot = to_slot(hotplug_slot); |
|---|
| 673 | 670 | rc = ibmphp_hpc_readslot(slot, READ_ALLSTAT, NULL); |
|---|
| 674 | | - if (rc) |
|---|
| 675 | | - return rc; |
|---|
| 676 | | - |
|---|
| 677 | | - // power - enabled:1 not:0 |
|---|
| 678 | | - hotplug_slot->info->power_status = SLOT_POWER(slot->status); |
|---|
| 679 | | - |
|---|
| 680 | | - // attention - off:0, on:1, blinking:2 |
|---|
| 681 | | - hotplug_slot->info->attention_status = SLOT_ATTN(slot->status, slot->ext_status); |
|---|
| 682 | | - |
|---|
| 683 | | - // latch - open:1 closed:0 |
|---|
| 684 | | - hotplug_slot->info->latch_status = SLOT_LATCH(slot->status); |
|---|
| 685 | | - |
|---|
| 686 | | - // pci board - present:1 not:0 |
|---|
| 687 | | - if (SLOT_PRESENT(slot->status)) |
|---|
| 688 | | - hotplug_slot->info->adapter_status = 1; |
|---|
| 689 | | - else |
|---|
| 690 | | - hotplug_slot->info->adapter_status = 0; |
|---|
| 691 | | -/* |
|---|
| 692 | | - if (slot->bus_on->supported_bus_mode |
|---|
| 693 | | - && (slot->bus_on->supported_speed == BUS_SPEED_66)) |
|---|
| 694 | | - hotplug_slot->info->max_bus_speed_status = BUS_SPEED_66PCIX; |
|---|
| 695 | | - else |
|---|
| 696 | | - hotplug_slot->info->max_bus_speed_status = slot->bus_on->supported_speed; |
|---|
| 697 | | -*/ |
|---|
| 698 | | - |
|---|
| 699 | 671 | return rc; |
|---|
| 700 | 672 | } |
|---|
| 701 | 673 | |
|---|
| .. | .. |
|---|
| 712 | 684 | u8 ctlr_id, temp, bus_index; |
|---|
| 713 | 685 | u16 ctlr, slot, bus; |
|---|
| 714 | 686 | u16 slot_num, bus_num, index; |
|---|
| 715 | | - struct hotplug_slot *hp_slot_ptr; |
|---|
| 716 | 687 | struct controller *hpc_ptr; |
|---|
| 717 | 688 | struct ebda_hpc_bus *bus_ptr; |
|---|
| 718 | 689 | struct ebda_hpc_slot *slot_ptr; |
|---|
| .. | .. |
|---|
| 743 | 714 | /* init hpc structure */ |
|---|
| 744 | 715 | hpc_ptr = alloc_ebda_hpc(slot_num, bus_num); |
|---|
| 745 | 716 | if (!hpc_ptr) { |
|---|
| 746 | | - rc = -ENOMEM; |
|---|
| 747 | | - goto error_no_hpc; |
|---|
| 717 | + return -ENOMEM; |
|---|
| 748 | 718 | } |
|---|
| 749 | 719 | hpc_ptr->ctlr_id = ctlr_id; |
|---|
| 750 | 720 | hpc_ptr->ctlr_relative_id = ctlr; |
|---|
| .. | .. |
|---|
| 771 | 741 | bus_info_ptr1 = kzalloc(sizeof(struct bus_info), GFP_KERNEL); |
|---|
| 772 | 742 | if (!bus_info_ptr1) { |
|---|
| 773 | 743 | rc = -ENOMEM; |
|---|
| 774 | | - goto error_no_hp_slot; |
|---|
| 744 | + goto error_no_slot; |
|---|
| 775 | 745 | } |
|---|
| 776 | 746 | bus_info_ptr1->slot_min = slot_ptr->slot_num; |
|---|
| 777 | 747 | bus_info_ptr1->slot_max = slot_ptr->slot_num; |
|---|
| .. | .. |
|---|
| 842 | 812 | (hpc_ptr->u.isa_ctlr.io_end - hpc_ptr->u.isa_ctlr.io_start + 1), |
|---|
| 843 | 813 | "ibmphp")) { |
|---|
| 844 | 814 | rc = -ENODEV; |
|---|
| 845 | | - goto error_no_hp_slot; |
|---|
| 815 | + goto error_no_slot; |
|---|
| 846 | 816 | } |
|---|
| 847 | 817 | hpc_ptr->irq = readb(io_mem + addr + 4); |
|---|
| 848 | 818 | addr += 5; |
|---|
| .. | .. |
|---|
| 857 | 827 | break; |
|---|
| 858 | 828 | default: |
|---|
| 859 | 829 | rc = -ENODEV; |
|---|
| 860 | | - goto error_no_hp_slot; |
|---|
| 830 | + goto error_no_slot; |
|---|
| 861 | 831 | } |
|---|
| 862 | 832 | |
|---|
| 863 | 833 | //reorganize chassis' linked list |
|---|
| .. | .. |
|---|
| 870 | 840 | |
|---|
| 871 | 841 | // register slots with hpc core as well as create linked list of ibm slot |
|---|
| 872 | 842 | for (index = 0; index < hpc_ptr->slot_count; index++) { |
|---|
| 873 | | - |
|---|
| 874 | | - hp_slot_ptr = kzalloc(sizeof(*hp_slot_ptr), GFP_KERNEL); |
|---|
| 875 | | - if (!hp_slot_ptr) { |
|---|
| 876 | | - rc = -ENOMEM; |
|---|
| 877 | | - goto error_no_hp_slot; |
|---|
| 878 | | - } |
|---|
| 879 | | - |
|---|
| 880 | | - hp_slot_ptr->info = kzalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL); |
|---|
| 881 | | - if (!hp_slot_ptr->info) { |
|---|
| 882 | | - rc = -ENOMEM; |
|---|
| 883 | | - goto error_no_hp_info; |
|---|
| 884 | | - } |
|---|
| 885 | | - |
|---|
| 886 | 843 | tmp_slot = kzalloc(sizeof(*tmp_slot), GFP_KERNEL); |
|---|
| 887 | 844 | if (!tmp_slot) { |
|---|
| 888 | 845 | rc = -ENOMEM; |
|---|
| .. | .. |
|---|
| 909 | 866 | |
|---|
| 910 | 867 | bus_info_ptr1 = ibmphp_find_same_bus_num(hpc_ptr->slots[index].slot_bus_num); |
|---|
| 911 | 868 | if (!bus_info_ptr1) { |
|---|
| 912 | | - kfree(tmp_slot); |
|---|
| 913 | 869 | rc = -ENODEV; |
|---|
| 914 | 870 | goto error; |
|---|
| 915 | 871 | } |
|---|
| .. | .. |
|---|
| 919 | 875 | |
|---|
| 920 | 876 | tmp_slot->ctlr_index = hpc_ptr->slots[index].ctl_index; |
|---|
| 921 | 877 | tmp_slot->number = hpc_ptr->slots[index].slot_num; |
|---|
| 922 | | - tmp_slot->hotplug_slot = hp_slot_ptr; |
|---|
| 923 | 878 | |
|---|
| 924 | | - hp_slot_ptr->private = tmp_slot; |
|---|
| 925 | | - |
|---|
| 926 | | - rc = fillslotinfo(hp_slot_ptr); |
|---|
| 879 | + rc = fillslotinfo(&tmp_slot->hotplug_slot); |
|---|
| 927 | 880 | if (rc) |
|---|
| 928 | 881 | goto error; |
|---|
| 929 | 882 | |
|---|
| 930 | | - rc = ibmphp_init_devno((struct slot **) &hp_slot_ptr->private); |
|---|
| 883 | + rc = ibmphp_init_devno(&tmp_slot); |
|---|
| 931 | 884 | if (rc) |
|---|
| 932 | 885 | goto error; |
|---|
| 933 | | - hp_slot_ptr->ops = &ibmphp_hotplug_slot_ops; |
|---|
| 886 | + tmp_slot->hotplug_slot.ops = &ibmphp_hotplug_slot_ops; |
|---|
| 934 | 887 | |
|---|
| 935 | 888 | // end of registering ibm slot with hotplug core |
|---|
| 936 | 889 | |
|---|
| 937 | | - list_add(&((struct slot *)(hp_slot_ptr->private))->ibm_slot_list, &ibmphp_slot_head); |
|---|
| 890 | + list_add(&tmp_slot->ibm_slot_list, &ibmphp_slot_head); |
|---|
| 938 | 891 | } |
|---|
| 939 | 892 | |
|---|
| 940 | 893 | print_bus_info(); |
|---|
| .. | .. |
|---|
| 944 | 897 | |
|---|
| 945 | 898 | list_for_each_entry(tmp_slot, &ibmphp_slot_head, ibm_slot_list) { |
|---|
| 946 | 899 | snprintf(name, SLOT_NAME_SIZE, "%s", create_file_name(tmp_slot)); |
|---|
| 947 | | - pci_hp_register(tmp_slot->hotplug_slot, |
|---|
| 900 | + pci_hp_register(&tmp_slot->hotplug_slot, |
|---|
| 948 | 901 | pci_find_bus(0, tmp_slot->bus), tmp_slot->device, name); |
|---|
| 949 | 902 | } |
|---|
| 950 | 903 | |
|---|
| .. | .. |
|---|
| 953 | 906 | return 0; |
|---|
| 954 | 907 | |
|---|
| 955 | 908 | error: |
|---|
| 956 | | - kfree(hp_slot_ptr->private); |
|---|
| 909 | + kfree(tmp_slot); |
|---|
| 957 | 910 | error_no_slot: |
|---|
| 958 | | - kfree(hp_slot_ptr->info); |
|---|
| 959 | | -error_no_hp_info: |
|---|
| 960 | | - kfree(hp_slot_ptr); |
|---|
| 961 | | -error_no_hp_slot: |
|---|
| 962 | 911 | free_ebda_hpc(hpc_ptr); |
|---|
| 963 | | -error_no_hpc: |
|---|
| 964 | | - iounmap(io_mem); |
|---|
| 965 | 912 | return rc; |
|---|
| 966 | 913 | } |
|---|
| 967 | 914 | |
|---|