mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-06 15:26:58 +02:00
dm: core: use s32 instead of int for dev_read_s32_default
dev_read_s32_default is for getting an s32 from a Device Tree property
and allows to take a default value if that property is missing.
Considering it calls ofnode_read_u32_default which takes a u32 and
returns a u32, it should do the same instead of using an int, especially
considering that int size is typically architecture-specific, as opposed
to s32/u32.
s32 and u32 being the same size, dev_read_s32* functions calling
ofnode_read_u32_default shouldn't be an issue (at the type level at
least) as the information will be stored appropriately in 4B regardless
of the sign.
This incidentally matches all other dev_read_*_default functions.
Fixes: a1b17e4f4c
("dm: core: Add a function to read into a unsigned int")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
b4b66e2f29
commit
ad03050e26
@ -62,8 +62,8 @@ int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp)
|
||||
return ofnode_read_u32(dev_ofnode(dev), propname, (u32 *)outp);
|
||||
}
|
||||
|
||||
int dev_read_s32_default(const struct udevice *dev, const char *propname,
|
||||
int def)
|
||||
s32 dev_read_s32_default(const struct udevice *dev, const char *propname,
|
||||
s32 def)
|
||||
{
|
||||
return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp);
|
||||
* @def: default value to return if the property has no value
|
||||
* Return: property value, or @def if not found
|
||||
*/
|
||||
int dev_read_s32_default(const struct udevice *dev, const char *propname,
|
||||
int def);
|
||||
s32 dev_read_s32_default(const struct udevice *dev, const char *propname,
|
||||
s32 def);
|
||||
|
||||
/**
|
||||
* dev_read_u32u() - read a 32-bit integer from a device's DT property
|
||||
@ -921,8 +921,8 @@ static inline int dev_read_s32(const struct udevice *dev,
|
||||
return ofnode_read_s32(dev_ofnode(dev), propname, outp);
|
||||
}
|
||||
|
||||
static inline int dev_read_s32_default(const struct udevice *dev,
|
||||
const char *propname, int def)
|
||||
static inline s32 dev_read_s32_default(const struct udevice *dev,
|
||||
const char *propname, s32 def)
|
||||
{
|
||||
return ofnode_read_s32_default(dev_ofnode(dev), propname, def);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user