Commit 7c23fb2e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'device_is_big_endian-6.8-rc1' into driver-core-next

Tag for the device_is_big_endian() addition to property.h

For others to be able to pull from in a stable way.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parents 7c41da58 826a5d8c
...@@ -80,12 +80,38 @@ int fwnode_property_match_string(const struct fwnode_handle *fwnode, ...@@ -80,12 +80,38 @@ int fwnode_property_match_string(const struct fwnode_handle *fwnode,
bool fwnode_device_is_available(const struct fwnode_handle *fwnode); bool fwnode_device_is_available(const struct fwnode_handle *fwnode);
static inline bool fwnode_device_is_big_endian(const struct fwnode_handle *fwnode)
{
if (fwnode_property_present(fwnode, "big-endian"))
return true;
if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) &&
fwnode_property_present(fwnode, "native-endian"))
return true;
return false;
}
static inline static inline
bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat) bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat)
{ {
return fwnode_property_match_string(fwnode, "compatible", compat) >= 0; return fwnode_property_match_string(fwnode, "compatible", compat) >= 0;
} }
/**
* device_is_big_endian - check if a device has BE registers
* @dev: Pointer to the struct device
*
* Returns: true if the device has a "big-endian" property, or if the kernel
* was compiled for BE *and* the device has a "native-endian" property.
* Returns false otherwise.
*
* Callers would nominally use ioread32be/iowrite32be if
* device_is_big_endian() == true, or readl/writel otherwise.
*/
static inline bool device_is_big_endian(const struct device *dev)
{
return fwnode_device_is_big_endian(dev_fwnode(dev));
}
/** /**
* device_is_compatible - match 'compatible' property of the device with a given string * device_is_compatible - match 'compatible' property of the device with a given string
* @dev: Pointer to the struct device * @dev: Pointer to the struct device
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment