[PATCH 5/7] driver: be explicit about supported #feature-cells

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A feature controller may control the activation of multiple devices.
This is represented by a single index argument in the API. Thus any
value higher than #feature-cells = <1>; is unsupported, so let's be
explicit about that. #feature-cells = <0>; specs will just be
interpreted as if the argument was a 0.

Signed-off-by: Ahmad Fatoum <ahmad@xxxxxx>
---
 drivers/base/featctrl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/base/featctrl.c b/drivers/base/featctrl.c
index abe21698ede7..f40b1f04bc1f 100644
--- a/drivers/base/featctrl.c
+++ b/drivers/base/featctrl.c
@@ -53,10 +53,13 @@ static struct feature_controller *featctrl_get_from_provider(struct of_phandle_a
 	if (ret < 0)
 		return ERR_PTR(ret);
 
+	if (spec->args_count > 1)
+		return ERR_PTR(-EINVAL);
+
 	/* Check if we have such a controller in our array */
 	list_for_each_entry(featctrl, &of_feature_controllers, list) {
 		if (dev_of_node(featctrl->dev) == spec->np) {
-			*gateid = spec->args[0];
+			*gateid = spec->args_count ? spec->args[0] : 0;
 			return featctrl;
 		}
 	}
-- 
2.38.4





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux