Skip to content

Commit 2ca42c3

Browse files
mwallerobherring
authored andcommitted
of: property: define of_property_read_u{8,16,32,64}_array() unconditionally
We can get rid of all the empty stubs because all these functions call of_property_read_variable_u{8,16,32,64}_array() which already have an empty stub if CONFIG_OF is not defined. Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220118173504.2867523-3-michael@walle.cc
1 parent 66a8f7f commit 2ca42c3

File tree

1 file changed

+124
-150
lines changed

1 file changed

+124
-150
lines changed

include/linux/of.h

Lines changed: 124 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -410,130 +410,6 @@ extern int of_detach_node(struct device_node *);
410410

411411
#define of_match_ptr(_ptr) (_ptr)
412412

413-
/**
414-
* of_property_read_u8_array - Find and read an array of u8 from a property.
415-
*
416-
* @np: device node from which the property value is to be read.
417-
* @propname: name of the property to be searched.
418-
* @out_values: pointer to return value, modified only if return value is 0.
419-
* @sz: number of array elements to read
420-
*
421-
* Search for a property in a device node and read 8-bit value(s) from
422-
* it.
423-
*
424-
* dts entry of array should be like:
425-
* ``property = /bits/ 8 <0x50 0x60 0x70>;``
426-
*
427-
* Return: 0 on success, -EINVAL if the property does not exist,
428-
* -ENODATA if property does not have a value, and -EOVERFLOW if the
429-
* property data isn't large enough.
430-
*
431-
* The out_values is modified only if a valid u8 value can be decoded.
432-
*/
433-
static inline int of_property_read_u8_array(const struct device_node *np,
434-
const char *propname,
435-
u8 *out_values, size_t sz)
436-
{
437-
int ret = of_property_read_variable_u8_array(np, propname, out_values,
438-
sz, 0);
439-
if (ret >= 0)
440-
return 0;
441-
else
442-
return ret;
443-
}
444-
445-
/**
446-
* of_property_read_u16_array - Find and read an array of u16 from a property.
447-
*
448-
* @np: device node from which the property value is to be read.
449-
* @propname: name of the property to be searched.
450-
* @out_values: pointer to return value, modified only if return value is 0.
451-
* @sz: number of array elements to read
452-
*
453-
* Search for a property in a device node and read 16-bit value(s) from
454-
* it.
455-
*
456-
* dts entry of array should be like:
457-
* ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
458-
*
459-
* Return: 0 on success, -EINVAL if the property does not exist,
460-
* -ENODATA if property does not have a value, and -EOVERFLOW if the
461-
* property data isn't large enough.
462-
*
463-
* The out_values is modified only if a valid u16 value can be decoded.
464-
*/
465-
static inline int of_property_read_u16_array(const struct device_node *np,
466-
const char *propname,
467-
u16 *out_values, size_t sz)
468-
{
469-
int ret = of_property_read_variable_u16_array(np, propname, out_values,
470-
sz, 0);
471-
if (ret >= 0)
472-
return 0;
473-
else
474-
return ret;
475-
}
476-
477-
/**
478-
* of_property_read_u32_array - Find and read an array of 32 bit integers
479-
* from a property.
480-
*
481-
* @np: device node from which the property value is to be read.
482-
* @propname: name of the property to be searched.
483-
* @out_values: pointer to return value, modified only if return value is 0.
484-
* @sz: number of array elements to read
485-
*
486-
* Search for a property in a device node and read 32-bit value(s) from
487-
* it.
488-
*
489-
* Return: 0 on success, -EINVAL if the property does not exist,
490-
* -ENODATA if property does not have a value, and -EOVERFLOW if the
491-
* property data isn't large enough.
492-
*
493-
* The out_values is modified only if a valid u32 value can be decoded.
494-
*/
495-
static inline int of_property_read_u32_array(const struct device_node *np,
496-
const char *propname,
497-
u32 *out_values, size_t sz)
498-
{
499-
int ret = of_property_read_variable_u32_array(np, propname, out_values,
500-
sz, 0);
501-
if (ret >= 0)
502-
return 0;
503-
else
504-
return ret;
505-
}
506-
507-
/**
508-
* of_property_read_u64_array - Find and read an array of 64 bit integers
509-
* from a property.
510-
*
511-
* @np: device node from which the property value is to be read.
512-
* @propname: name of the property to be searched.
513-
* @out_values: pointer to return value, modified only if return value is 0.
514-
* @sz: number of array elements to read
515-
*
516-
* Search for a property in a device node and read 64-bit value(s) from
517-
* it.
518-
*
519-
* Return: 0 on success, -EINVAL if the property does not exist,
520-
* -ENODATA if property does not have a value, and -EOVERFLOW if the
521-
* property data isn't large enough.
522-
*
523-
* The out_values is modified only if a valid u64 value can be decoded.
524-
*/
525-
static inline int of_property_read_u64_array(const struct device_node *np,
526-
const char *propname,
527-
u64 *out_values, size_t sz)
528-
{
529-
int ret = of_property_read_variable_u64_array(np, propname, out_values,
530-
sz, 0);
531-
if (ret >= 0)
532-
return 0;
533-
else
534-
return ret;
535-
}
536-
537413
/*
538414
* struct property *prop;
539415
* const __be32 *p;
@@ -728,32 +604,6 @@ static inline int of_property_count_elems_of_size(const struct device_node *np,
728604
return -ENOSYS;
729605
}
730606

731-
static inline int of_property_read_u8_array(const struct device_node *np,
732-
const char *propname, u8 *out_values, size_t sz)
733-
{
734-
return -ENOSYS;
735-
}
736-
737-
static inline int of_property_read_u16_array(const struct device_node *np,
738-
const char *propname, u16 *out_values, size_t sz)
739-
{
740-
return -ENOSYS;
741-
}
742-
743-
static inline int of_property_read_u32_array(const struct device_node *np,
744-
const char *propname,
745-
u32 *out_values, size_t sz)
746-
{
747-
return -ENOSYS;
748-
}
749-
750-
static inline int of_property_read_u64_array(const struct device_node *np,
751-
const char *propname,
752-
u64 *out_values, size_t sz)
753-
{
754-
return -ENOSYS;
755-
}
756-
757607
static inline int of_property_read_u32_index(const struct device_node *np,
758608
const char *propname, u32 index, u32 *out_value)
759609
{
@@ -1328,6 +1178,130 @@ static inline bool of_property_read_bool(const struct device_node *np,
13281178
return prop ? true : false;
13291179
}
13301180

1181+
/**
1182+
* of_property_read_u8_array - Find and read an array of u8 from a property.
1183+
*
1184+
* @np: device node from which the property value is to be read.
1185+
* @propname: name of the property to be searched.
1186+
* @out_values: pointer to return value, modified only if return value is 0.
1187+
* @sz: number of array elements to read
1188+
*
1189+
* Search for a property in a device node and read 8-bit value(s) from
1190+
* it.
1191+
*
1192+
* dts entry of array should be like:
1193+
* ``property = /bits/ 8 <0x50 0x60 0x70>;``
1194+
*
1195+
* Return: 0 on success, -EINVAL if the property does not exist,
1196+
* -ENODATA if property does not have a value, and -EOVERFLOW if the
1197+
* property data isn't large enough.
1198+
*
1199+
* The out_values is modified only if a valid u8 value can be decoded.
1200+
*/
1201+
static inline int of_property_read_u8_array(const struct device_node *np,
1202+
const char *propname,
1203+
u8 *out_values, size_t sz)
1204+
{
1205+
int ret = of_property_read_variable_u8_array(np, propname, out_values,
1206+
sz, 0);
1207+
if (ret >= 0)
1208+
return 0;
1209+
else
1210+
return ret;
1211+
}
1212+
1213+
/**
1214+
* of_property_read_u16_array - Find and read an array of u16 from a property.
1215+
*
1216+
* @np: device node from which the property value is to be read.
1217+
* @propname: name of the property to be searched.
1218+
* @out_values: pointer to return value, modified only if return value is 0.
1219+
* @sz: number of array elements to read
1220+
*
1221+
* Search for a property in a device node and read 16-bit value(s) from
1222+
* it.
1223+
*
1224+
* dts entry of array should be like:
1225+
* ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
1226+
*
1227+
* Return: 0 on success, -EINVAL if the property does not exist,
1228+
* -ENODATA if property does not have a value, and -EOVERFLOW if the
1229+
* property data isn't large enough.
1230+
*
1231+
* The out_values is modified only if a valid u16 value can be decoded.
1232+
*/
1233+
static inline int of_property_read_u16_array(const struct device_node *np,
1234+
const char *propname,
1235+
u16 *out_values, size_t sz)
1236+
{
1237+
int ret = of_property_read_variable_u16_array(np, propname, out_values,
1238+
sz, 0);
1239+
if (ret >= 0)
1240+
return 0;
1241+
else
1242+
return ret;
1243+
}
1244+
1245+
/**
1246+
* of_property_read_u32_array - Find and read an array of 32 bit integers
1247+
* from a property.
1248+
*
1249+
* @np: device node from which the property value is to be read.
1250+
* @propname: name of the property to be searched.
1251+
* @out_values: pointer to return value, modified only if return value is 0.
1252+
* @sz: number of array elements to read
1253+
*
1254+
* Search for a property in a device node and read 32-bit value(s) from
1255+
* it.
1256+
*
1257+
* Return: 0 on success, -EINVAL if the property does not exist,
1258+
* -ENODATA if property does not have a value, and -EOVERFLOW if the
1259+
* property data isn't large enough.
1260+
*
1261+
* The out_values is modified only if a valid u32 value can be decoded.
1262+
*/
1263+
static inline int of_property_read_u32_array(const struct device_node *np,
1264+
const char *propname,
1265+
u32 *out_values, size_t sz)
1266+
{
1267+
int ret = of_property_read_variable_u32_array(np, propname, out_values,
1268+
sz, 0);
1269+
if (ret >= 0)
1270+
return 0;
1271+
else
1272+
return ret;
1273+
}
1274+
1275+
/**
1276+
* of_property_read_u64_array - Find and read an array of 64 bit integers
1277+
* from a property.
1278+
*
1279+
* @np: device node from which the property value is to be read.
1280+
* @propname: name of the property to be searched.
1281+
* @out_values: pointer to return value, modified only if return value is 0.
1282+
* @sz: number of array elements to read
1283+
*
1284+
* Search for a property in a device node and read 64-bit value(s) from
1285+
* it.
1286+
*
1287+
* Return: 0 on success, -EINVAL if the property does not exist,
1288+
* -ENODATA if property does not have a value, and -EOVERFLOW if the
1289+
* property data isn't large enough.
1290+
*
1291+
* The out_values is modified only if a valid u64 value can be decoded.
1292+
*/
1293+
static inline int of_property_read_u64_array(const struct device_node *np,
1294+
const char *propname,
1295+
u64 *out_values, size_t sz)
1296+
{
1297+
int ret = of_property_read_variable_u64_array(np, propname, out_values,
1298+
sz, 0);
1299+
if (ret >= 0)
1300+
return 0;
1301+
else
1302+
return ret;
1303+
}
1304+
13311305
static inline int of_property_read_u8(const struct device_node *np,
13321306
const char *propname,
13331307
u8 *out_value)

0 commit comments

Comments
 (0)