Skip to content

Commit 96d0d83

Browse files
committed
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
2 parents 1ef2740 + e8158b4 commit 96d0d83

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

drivers/base/property.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
253253
{
254254
bool ret;
255255

256-
ret = fwnode_call_int_op(fwnode, property_present, propname);
256+
ret = fwnode_call_bool_op(fwnode, property_present, propname);
257257
if (ret == false && !IS_ERR_OR_NULL(fwnode) &&
258258
!IS_ERR_OR_NULL(fwnode->secondary))
259-
ret = fwnode_call_int_op(fwnode->secondary, property_present,
259+
ret = fwnode_call_bool_op(fwnode->secondary, property_present,
260260
propname);
261261
return ret;
262262
}
@@ -1027,7 +1027,7 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put);
10271027
*/
10281028
bool fwnode_device_is_available(struct fwnode_handle *fwnode)
10291029
{
1030-
return fwnode_call_int_op(fwnode, device_is_available);
1030+
return fwnode_call_bool_op(fwnode, device_is_available);
10311031
}
10321032
EXPORT_SYMBOL_GPL(fwnode_device_is_available);
10331033

include/linux/fwnode.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ struct fwnode_operations {
9999
(fwnode ? (fwnode_has_op(fwnode, op) ? \
100100
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \
101101
-EINVAL)
102+
#define fwnode_call_bool_op(fwnode, op, ...) \
103+
(fwnode ? (fwnode_has_op(fwnode, op) ? \
104+
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : false) : \
105+
false)
102106
#define fwnode_call_ptr_op(fwnode, op, ...) \
103107
(fwnode_has_op(fwnode, op) ? \
104108
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : NULL)

0 commit comments

Comments
 (0)