* @brief Probe a device and attach a driver if possible * * calls device_probe() and attaches if that was successful. */
| 2893 | * calls device_probe() and attaches if that was successful. |
| 2894 | */ |
| 2895 | int |
| 2896 | device_probe_and_attach(device_t dev) |
| 2897 | { |
| 2898 | int error; |
| 2899 | |
| 2900 | GIANT_REQUIRED; |
| 2901 | |
| 2902 | error = device_probe(dev); |
| 2903 | if (error == -1) |
| 2904 | return (0); |
| 2905 | else if (error != 0) |
| 2906 | return (error); |
| 2907 | |
| 2908 | CURVNET_SET_QUIET(vnet0); |
| 2909 | error = device_attach(dev); |
| 2910 | CURVNET_RESTORE(); |
| 2911 | return error; |
| 2912 | } |
| 2913 | |
| 2914 | /** |
| 2915 | * @brief Attach a device driver to a device |
no test coverage detected