| 860 | } |
| 861 | |
| 862 | rt_err_t rt_pci_bus_remove(struct rt_pci_bus *bus) |
| 863 | { |
| 864 | rt_err_t err = RT_EOK; |
| 865 | |
| 866 | if (bus) |
| 867 | { |
| 868 | spin_lock(&bus->lock); |
| 869 | |
| 870 | if (rt_list_isempty(&bus->children_nodes) && |
| 871 | rt_list_isempty(&bus->devices_nodes)) |
| 872 | { |
| 873 | rt_list_remove(&bus->list); |
| 874 | spin_unlock(&bus->lock); |
| 875 | |
| 876 | if (bus->ops->remove) |
| 877 | { |
| 878 | bus->ops->remove(bus); |
| 879 | } |
| 880 | |
| 881 | rt_pci_ofw_bus_free(bus); |
| 882 | rt_free(bus); |
| 883 | } |
| 884 | else |
| 885 | { |
| 886 | spin_unlock(&bus->lock); |
| 887 | |
| 888 | err = -RT_EBUSY; |
| 889 | } |
| 890 | } |
| 891 | else |
| 892 | { |
| 893 | err = -RT_EINVAL; |
| 894 | } |
| 895 | |
| 896 | return err; |
| 897 | } |
| 898 | |
| 899 | rt_err_t rt_pci_device_remove(struct rt_pci_device *pdev) |
| 900 | { |
no test coverage detected