OF_finddevice.9 (ac32b99c2b90fc98766dd22f66f489a0b39688de) | OF_finddevice.9 (3d265fce43746c293ae826e9603adbfe09f93cf6) |
---|---|
1.\" 2.\" Copyright (c) 2018 Oleksandr Tymoshenko <gonzo@FreeBSD.org> 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 23 unchanged lines hidden (view full) --- 32.Nm OF_finddevice 33.Nd find node in device tree 34.Sh SYNOPSIS 35.In dev/ofw/ofw_bus.h 36.In dev/ofw/ofw_bus_subr.h 37.Ft phandle_t 38.Fn OF_finddevice "const char *path" 39.Sh DESCRIPTION | 1.\" 2.\" Copyright (c) 2018 Oleksandr Tymoshenko <gonzo@FreeBSD.org> 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 23 unchanged lines hidden (view full) --- 32.Nm OF_finddevice 33.Nd find node in device tree 34.Sh SYNOPSIS 35.In dev/ofw/ofw_bus.h 36.In dev/ofw/ofw_bus_subr.h 37.Ft phandle_t 38.Fn OF_finddevice "const char *path" 39.Sh DESCRIPTION |
40.Pp | |
41.Fn OF_finddevice 42returns the phandle for the node specified by the 43.Fa path . 44Returns -1 if the path cannot be found in the tree. | 40.Fn OF_finddevice 41returns the phandle for the node specified by the 42.Fa path . 43Returns -1 if the path cannot be found in the tree. |
45.Sh CAVEATS 46The return value should only be checked with equality 47operators (equal to, not equal to) and not relational comparison 48(less than, greater than ). 49There is a discrepancy between IEEE 1275 standard and 50.Fx Ns 's 51internal representation of a phandle: IEEE 1275 52requires the return value of this function to be -1 if the path 53is not found. 54But phandle_t is an unsigned type, so it cannot 55be relationally compared with -1 or 0, this comparison 56is always true or always false. | |
57.Sh EXAMPLES 58.Bd -literal 59 phandle_t root, i2c; 60 61 root = OF_finddevice("/"); 62 i2c = OF_finddevice("/soc/axi/i2c@a0e0000"); 63 if (i2c != -1) { 64 ... 65 } 66.Ed 67.Sh SEE ALSO 68.Xr OF_child 9 69.Xr OF_parent 9 70.Xr OF_peer 9 71.Sh AUTHORS 72.An -nosplit 73This manual page was written by 74.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . | 44.Sh EXAMPLES 45.Bd -literal 46 phandle_t root, i2c; 47 48 root = OF_finddevice("/"); 49 i2c = OF_finddevice("/soc/axi/i2c@a0e0000"); 50 if (i2c != -1) { 51 ... 52 } 53.Ed 54.Sh SEE ALSO 55.Xr OF_child 9 56.Xr OF_parent 9 57.Xr OF_peer 9 58.Sh AUTHORS 59.An -nosplit 60This manual page was written by 61.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . |
62.Sh CAVEATS 63The return value should only be checked with equality 64operators (equal to, not equal to) and not relational comparison 65(less than, greater than ). 66There is a discrepancy between IEEE 1275 standard and 67.Fx Ns 's 68internal representation of a phandle: IEEE 1275 69requires the return value of this function to be -1 if the path 70is not found. 71But phandle_t is an unsigned type, so it cannot 72be relationally compared with -1 or 0, this comparison 73is always true or always false. |
|