* @brief This function removes a previously registered device driver. * * @param dev is the pointer of device driver structure. * * @return the error code, RT_EOK on successfully. */
| 100 | * @return the error code, RT_EOK on successfully. |
| 101 | */ |
| 102 | rt_err_t rt_device_unregister(rt_device_t dev) |
| 103 | { |
| 104 | /* parameter check */ |
| 105 | RT_ASSERT(dev != RT_NULL); |
| 106 | RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device); |
| 107 | RT_ASSERT(rt_object_is_systemobject(&dev->parent)); |
| 108 | |
| 109 | rt_object_detach(&(dev->parent)); |
| 110 | |
| 111 | return RT_EOK; |
| 112 | } |
| 113 | RTM_EXPORT(rt_device_unregister); |
| 114 | |
| 115 | /** |