iio: inkern: remove OF dependencies
authorNuno Sá <nuno.sa@analog.com>
Fri, 15 Jul 2022 12:29:02 +0000 (14:29 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 15 Aug 2022 21:30:00 +0000 (22:30 +0100)
Since all users of the OF dependendent API are now converted to use the
firmware agnostic alternative, we can drop OF dependencies from the IIO
in kernel interface.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-15-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/inkern.c
include/linux/iio/consumer.h
include/linux/iio/iio.h

index 9cfa66ef9536cbb9fba7e29236aa1d9e2a28d171..b667790b6df97d022cecdfc9ed4f977d3f3f8e1f 100644 (file)
@@ -8,7 +8,6 @@
 #include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
-#include <linux/of.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/iio-opaque.h>
@@ -143,26 +142,6 @@ static int __fwnode_iio_simple_xlate(struct iio_dev *indio_dev,
        return iiospec->args[0];
 }
 
-/*
- * Simple helper to copy fwnode_reference_args into of_phandle_args so we
- * can pass it to of_xlate(). Ultimate goal is to drop this together with
- * of_xlate().
- */
-static int __fwnode_to_of_xlate(struct iio_dev *indio_dev,
-                               const struct fwnode_reference_args *iiospec)
-{
-       struct of_phandle_args of_args;
-       unsigned int i;
-
-       of_args.args_count = iiospec->nargs;
-       of_args.np = to_of_node(iiospec->fwnode);
-
-       for (i = 0; i < MAX_PHANDLE_ARGS; i++)
-               of_args.args[i] = i < iiospec->nargs ? iiospec->args[i] : 0;
-
-       return indio_dev->info->of_xlate(indio_dev, &of_args);
-}
-
 static int __fwnode_iio_channel_get(struct iio_channel *channel,
                                    struct fwnode_handle *fwnode, int index)
 {
@@ -185,9 +164,7 @@ static int __fwnode_iio_channel_get(struct iio_channel *channel,
 
        indio_dev = dev_to_iio_dev(idev);
        channel->indio_dev = indio_dev;
-       if (indio_dev->info->of_xlate)
-               index = __fwnode_to_of_xlate(indio_dev, &iiospec);
-       else if (indio_dev->info->fwnode_xlate)
+       if (indio_dev->info->fwnode_xlate)
                index = indio_dev->info->fwnode_xlate(indio_dev, &iiospec);
        else
                index = __fwnode_iio_simple_xlate(indio_dev, &iiospec);
index 2adb1306da3ef0abb03f457d888aa3d530343e79..6802596b017c9cd57f4b94dc649898bbcdf2db1c 100644 (file)
@@ -7,14 +7,12 @@
 #ifndef _IIO_INKERN_CONSUMER_H_
 #define _IIO_INKERN_CONSUMER_H_
 
-#include <linux/of.h>
 #include <linux/types.h>
 #include <linux/iio/types.h>
 
 struct iio_dev;
 struct iio_chan_spec;
 struct device;
-struct device_node;
 struct fwnode_handle;
 
 /**
@@ -129,14 +127,6 @@ struct iio_channel *devm_fwnode_iio_channel_get_by_name(struct device *dev,
                                                        struct fwnode_handle *fwnode,
                                                        const char *consumer_channel);
 
-static inline struct iio_channel
-*devm_of_iio_channel_get_by_name(struct device *dev, struct device_node *np,
-                                const char *consumer_channel)
-{
-       return devm_fwnode_iio_channel_get_by_name(dev, of_fwnode_handle(np),
-                                                  consumer_channel);
-}
-
 struct iio_cb_buffer;
 /**
  * iio_channel_get_all_cb() - register callback for triggered capture
index 6002f8a0baf1cc56bda4818641d82239e65f7f03..f0ec8a5e5a7a9cd7ea1a8ff887460925444e4d39 100644 (file)
@@ -17,7 +17,6 @@
  * Currently assumes nano seconds.
  */
 
-struct of_phandle_args;
 struct fwnode_reference_args;
 
 enum iio_shared_by {
@@ -511,8 +510,6 @@ struct iio_info {
        int (*debugfs_reg_access)(struct iio_dev *indio_dev,
                                  unsigned reg, unsigned writeval,
                                  unsigned *readval);
-       int (*of_xlate)(struct iio_dev *indio_dev,
-                       const struct of_phandle_args *iiospec);
        int (*fwnode_xlate)(struct iio_dev *indio_dev,
                            const struct fwnode_reference_args *iiospec);
        int (*hwfifo_set_watermark)(struct iio_dev *indio_dev, unsigned val);