Commit 96d0d831 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'devprop-fix-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull device properties framework fix from Rafael Wysocki:
 "This fixes a problem with bool properties that could be seen as "true"
  when the property was not present at all by adding a special helper
  for bool properties with checks for all of the requisute conditions
  (Sakari Ailus)"

* tag 'devprop-fix-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  device property: Introduce fwnode_call_bool_op() for ops that return bool
parents 1ef27400 e8158b48
...@@ -253,10 +253,10 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname) ...@@ -253,10 +253,10 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
{ {
bool ret; bool ret;
ret = fwnode_call_int_op(fwnode, property_present, propname); ret = fwnode_call_bool_op(fwnode, property_present, propname);
if (ret == false && !IS_ERR_OR_NULL(fwnode) && if (ret == false && !IS_ERR_OR_NULL(fwnode) &&
!IS_ERR_OR_NULL(fwnode->secondary)) !IS_ERR_OR_NULL(fwnode->secondary))
ret = fwnode_call_int_op(fwnode->secondary, property_present, ret = fwnode_call_bool_op(fwnode->secondary, property_present,
propname); propname);
return ret; return ret;
} }
...@@ -1027,7 +1027,7 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put); ...@@ -1027,7 +1027,7 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put);
*/ */
bool fwnode_device_is_available(struct fwnode_handle *fwnode) bool fwnode_device_is_available(struct fwnode_handle *fwnode)
{ {
return fwnode_call_int_op(fwnode, device_is_available); return fwnode_call_bool_op(fwnode, device_is_available);
} }
EXPORT_SYMBOL_GPL(fwnode_device_is_available); EXPORT_SYMBOL_GPL(fwnode_device_is_available);
......
...@@ -99,6 +99,10 @@ struct fwnode_operations { ...@@ -99,6 +99,10 @@ struct fwnode_operations {
(fwnode ? (fwnode_has_op(fwnode, op) ? \ (fwnode ? (fwnode_has_op(fwnode, op) ? \
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \ (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \
-EINVAL) -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, ...) \ #define fwnode_call_ptr_op(fwnode, op, ...) \
(fwnode_has_op(fwnode, op) ? \ (fwnode_has_op(fwnode, op) ? \
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : NULL) (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : NULL)
......
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