| 897 | } |
| 898 | |
| 899 | rt_err_t rt_pci_device_remove(struct rt_pci_device *pdev) |
| 900 | { |
| 901 | rt_err_t err = RT_EOK; |
| 902 | |
| 903 | if (pdev) |
| 904 | { |
| 905 | struct rt_pci_bus *bus = pdev->bus; |
| 906 | |
| 907 | pci_procfs_detach(pdev); |
| 908 | |
| 909 | spin_lock(&bus->lock); |
| 910 | |
| 911 | while (pdev->parent.ref_count > 1) |
| 912 | { |
| 913 | spin_unlock(&bus->lock); |
| 914 | |
| 915 | rt_thread_yield(); |
| 916 | |
| 917 | spin_lock(&bus->lock); |
| 918 | } |
| 919 | rt_list_remove(&pdev->list); |
| 920 | |
| 921 | spin_unlock(&bus->lock); |
| 922 | |
| 923 | rt_free(pdev); |
| 924 | } |
| 925 | else |
| 926 | { |
| 927 | err = -RT_EINVAL; |
| 928 | } |
| 929 | |
| 930 | return err; |
| 931 | } |
no test coverage detected