git: e554a6d0ce3b - stable/13 - bus_if: provide a default null rescan method
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Aug 2022 14:32:45 UTC
The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=e554a6d0ce3bdbeb65ea5b5fdf0bdf8c1095c3df commit e554a6d0ce3bdbeb65ea5b5fdf0bdf8c1095c3df Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2022-06-21 13:29:53 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2022-08-11 14:18:21 +0000 bus_if: provide a default null rescan method There is an existing helper function, bus_null_rescan(), but most drivers won't use it except to override an inherited rescan method. It also returns the same error as an empty method. Make this the default rescan method in bus_if.m and return a more sensible error code. This gives a slightly more meaningful error message when attempting 'devctl rescan' on buses and devices alike: "Device not configured" --> "Operation not supported by device" Reviewed by: imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35501 (cherry picked from commit 36a8572ee8f5db7ecb64bedc5738a363ec7cad36) (cherry picked from commit 29afffb942b159511ad7d5ea5d086851f65ef4a0) --- sys/kern/bus_if.m | 8 +++++--- sys/kern/subr_bus.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index fa6d1d85c412..dbc738abb1f5 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -67,12 +67,14 @@ CODE { panic("bus_add_child is not implemented"); } - static int null_reset_post(device_t bus, device_t dev) + static int + null_reset_post(device_t bus, device_t dev) { return (0); } - static int null_reset_prepare(device_t bus, device_t dev) + static int + null_reset_prepare(device_t bus, device_t dev) { return (0); } @@ -264,7 +266,7 @@ METHOD device_t add_child { */ METHOD int rescan { device_t _dev; -} +} DEFAULT bus_null_rescan; /** * @brief Allocate a system resource diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index f7e55e7f48d8..c70e0e7b5ec1 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -4613,7 +4613,7 @@ bus_generic_get_domain(device_t dev, device_t child, int *domain) int bus_null_rescan(device_t dev) { - return (ENXIO); + return (ENODEV); } /*