diff options
author | Warner Losh <imp@FreeBSD.org> | 2024-07-25 04:22:48 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2024-07-25 04:22:48 +0000 |
commit | 22ea1ec051c15659944bf3922c33ec4025d010ea (patch) | |
tree | 743971933a416dde78e710c929b0ddfb98725e13 /share | |
parent | 195a96f0b303345818e09ad1d79dc80122804de8 (diff) | |
download | src-22ea1ec051c15659944bf3922c33ec4025d010ea.tar.gz src-22ea1ec051c15659944bf3922c33ec4025d010ea.zip |
newbus: introduce DEVICE_UNIT_ANY
Right now we pass a bare -1 for situations where any unit number will do.
Instead, introduce a DEVICE_UNIT_ANY to use instead of the bare constant.
Update documentation and examples where -1 is currently used, though
additional doc updates may be needed.
Sponsored by: Netflix
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/DEVICE_IDENTIFY.9 | 2 | ||||
-rw-r--r-- | share/man/man9/devclass.9 | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/share/man/man9/DEVICE_IDENTIFY.9 b/share/man/man9/DEVICE_IDENTIFY.9 index 4892e66eb214..d75c1a91ce4a 100644 --- a/share/man/man9/DEVICE_IDENTIFY.9 +++ b/share/man/man9/DEVICE_IDENTIFY.9 @@ -73,7 +73,7 @@ foo_identify(driver_t *driver, device_t parent) retrieve_device_information; if (devices matches one of your supported devices && not already in device tree) { - child = BUS_ADD_CHILD(parent, 0, "foo", -1); + child = BUS_ADD_CHILD(parent, 0, "foo", DEVICE_UNIT_ANY); bus_set_resource(child, SYS_RES_IOPORT, 0, FOO_IOADDR, 1); } } diff --git a/share/man/man9/devclass.9 b/share/man/man9/devclass.9 index d3c83133ae17..cbf81f3b0fa3 100644 --- a/share/man/man9/devclass.9 +++ b/share/man/man9/devclass.9 @@ -46,10 +46,11 @@ Each has a name and there cannot be two devclasses with the same name. This ensures that unique unit numbers are allocated to device instances. +All instances with the same name are treated as being the same. .Pp -Beware that this means -.Vt devclass -must be the same for different bus attachments of the same device driver. +When no specific unit number is needed, +.Vt DEVICE_UNIT_ANY +is used. .Sh SEE ALSO .Xr devclass_add_driver 9 , .Xr devclass_delete_driver 9 , |