Re: [PATCH 3/8] iio: add child nodes support in iio backend framework

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

 





On 6/19/24 07:31, Nuno Sá wrote:
On Tue, 2024-06-18 at 18:08 +0200, Olivier Moysan wrote:
Add an API to support IIO generic channels binding:
http://devicetree.org/schemas/iio/adc/adc.yaml#
This new API is needed, as generic channel DT node
isn't populated as a device.
Add devm_iio_backend_subnode_get() to allow an IIO device
backend consumer to configure backend phandles in its
child nodes.

Signed-off-by: Olivier Moysan <olivier.moysan@xxxxxxxxxxx>
---

Again small notes nits. With it:

Reviewed-by: Nuno Sa <nuno.sa@xxxxxxxxxx>

  drivers/iio/industrialio-backend.c | 48 ++++++++++++++++++++++--------
  include/linux/iio/backend.h        |  2 ++
  2 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-
backend.c
index d3db048c086b..e9d29131634d 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -575,17 +575,8 @@ static int __devm_iio_backend_get(struct device *dev, struct
iio_backend *back)
  	return 0;
  }
-/**
- * devm_iio_backend_get - Device managed backend device get
- * @dev: Consumer device for the backend
- * @name: Backend name
- *
- * Get's the backend associated with @dev.
- *
- * RETURNS:
- * A backend pointer, negative error pointer otherwise.
- */
-struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name)
+static struct iio_backend *__devm_iio_backend_node_get(struct device *dev, const
char *name,
+						       struct fwnode_handle *node)

I would call it __devm_iio_backend_fwnode_get(). Also the parameter node -> fwnode.

  {
  	struct fwnode_handle *fwnode;
  	struct iio_backend *back;
@@ -602,7 +593,7 @@ struct iio_backend *devm_iio_backend_get(struct device *dev,
const char *name)
  		index = 0;
  	}
- fwnode = fwnode_find_reference(dev_fwnode(dev), "io-backends", index);
+	fwnode = fwnode_find_reference(node, "io-backends", index);
  	if (IS_ERR(fwnode)) {
  		dev_err_probe(dev, PTR_ERR(fwnode),
  			      "Cannot get Firmware reference\n");
@@ -625,8 +616,41 @@ struct iio_backend *devm_iio_backend_get(struct device *dev,
const char *name)
  	fwnode_handle_put(fwnode);
  	return ERR_PTR(-EPROBE_DEFER);
  }
+
+/**
+ * devm_iio_backend_get - Device managed backend device get
+ * @dev: Consumer device for the backend
+ * @name: Backend name
+ *
+ * Get's the backend associated with @dev.
+ *
+ * RETURNS:
+ * A backend pointer, negative error pointer otherwise.
+ */
+struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name)
+{
+	return __devm_iio_backend_node_get(dev, name, dev_fwnode(dev));
+}
  EXPORT_SYMBOL_NS_GPL(devm_iio_backend_get, IIO_BACKEND);
+/**
+ * devm_iio_backend_subnode_get - Device managed backend device get
+ * @dev: Consumer device for the backend
+ * @name: Backend name
+ * @node: Firmware node of the backend consumer
+ *
+ * Get's the backend associated with @dev.
+ *
+ * RETURNS:
+ * A backend pointer, negative error pointer otherwise.
+ */
+struct iio_backend *devm_iio_backend_subnode_get(struct device *dev, const char
*name,
+						 struct fwnode_handle *node)

Again, for consistency devm_iio_backend_fwnode_get(). And node -> fwnode


Done.
Thanks
Olivier

- Nuno Sá






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux