mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-16 11:32:41 +00:00
device property: Introduce fwnode_call_bool_op() for ops that return bool
fwnode_call_int_op() isn't suitable for calling ops that return bool since it effectively causes the result returned to the user to be true when an op hasn't been defined or the fwnode is NULL. Address this by introducing fwnode_call_bool_op() for calling ops that return bool. Fixes:3708184afc
"device property: Move FW type specific functionality to FW specific files" Fixes:2294b3af05
"device property: Introduce fwnode_device_is_available()" Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
6a71d8d777
commit
e8158b486d
2 changed files with 7 additions and 3 deletions
|
@ -99,6 +99,10 @@ struct fwnode_operations {
|
|||
(fwnode ? (fwnode_has_op(fwnode, op) ? \
|
||||
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \
|
||||
-EINVAL)
|
||||
#define fwnode_call_bool_op(fwnode, op, ...) \
|
||||
(fwnode ? (fwnode_has_op(fwnode, op) ? \
|
||||
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : false) : \
|
||||
false)
|
||||
#define fwnode_call_ptr_op(fwnode, op, ...) \
|
||||
(fwnode_has_op(fwnode, op) ? \
|
||||
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue