Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: inkern: remove OF dependencies

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>

authored by

Nuno Sá and committed by
Jonathan Cameron
b22bc4d6 d7705f35

+1 -37
+1 -24
drivers/iio/inkern.c
··· 8 8 #include <linux/property.h> 9 9 #include <linux/slab.h> 10 10 #include <linux/mutex.h> 11 - #include <linux/of.h> 12 11 13 12 #include <linux/iio/iio.h> 14 13 #include <linux/iio/iio-opaque.h> ··· 142 143 return iiospec->args[0]; 143 144 } 144 145 145 - /* 146 - * Simple helper to copy fwnode_reference_args into of_phandle_args so we 147 - * can pass it to of_xlate(). Ultimate goal is to drop this together with 148 - * of_xlate(). 149 - */ 150 - static int __fwnode_to_of_xlate(struct iio_dev *indio_dev, 151 - const struct fwnode_reference_args *iiospec) 152 - { 153 - struct of_phandle_args of_args; 154 - unsigned int i; 155 - 156 - of_args.args_count = iiospec->nargs; 157 - of_args.np = to_of_node(iiospec->fwnode); 158 - 159 - for (i = 0; i < MAX_PHANDLE_ARGS; i++) 160 - of_args.args[i] = i < iiospec->nargs ? iiospec->args[i] : 0; 161 - 162 - return indio_dev->info->of_xlate(indio_dev, &of_args); 163 - } 164 - 165 146 static int __fwnode_iio_channel_get(struct iio_channel *channel, 166 147 struct fwnode_handle *fwnode, int index) 167 148 { ··· 164 185 165 186 indio_dev = dev_to_iio_dev(idev); 166 187 channel->indio_dev = indio_dev; 167 - if (indio_dev->info->of_xlate) 168 - index = __fwnode_to_of_xlate(indio_dev, &iiospec); 169 - else if (indio_dev->info->fwnode_xlate) 188 + if (indio_dev->info->fwnode_xlate) 170 189 index = indio_dev->info->fwnode_xlate(indio_dev, &iiospec); 171 190 else 172 191 index = __fwnode_iio_simple_xlate(indio_dev, &iiospec);
-10
include/linux/iio/consumer.h
··· 7 7 #ifndef _IIO_INKERN_CONSUMER_H_ 8 8 #define _IIO_INKERN_CONSUMER_H_ 9 9 10 - #include <linux/of.h> 11 10 #include <linux/types.h> 12 11 #include <linux/iio/types.h> 13 12 14 13 struct iio_dev; 15 14 struct iio_chan_spec; 16 15 struct device; 17 - struct device_node; 18 16 struct fwnode_handle; 19 17 20 18 /** ··· 126 128 struct iio_channel *devm_fwnode_iio_channel_get_by_name(struct device *dev, 127 129 struct fwnode_handle *fwnode, 128 130 const char *consumer_channel); 129 - 130 - static inline struct iio_channel 131 - *devm_of_iio_channel_get_by_name(struct device *dev, struct device_node *np, 132 - const char *consumer_channel) 133 - { 134 - return devm_fwnode_iio_channel_get_by_name(dev, of_fwnode_handle(np), 135 - consumer_channel); 136 - } 137 131 138 132 struct iio_cb_buffer; 139 133 /**
-3
include/linux/iio/iio.h
··· 17 17 * Currently assumes nano seconds. 18 18 */ 19 19 20 - struct of_phandle_args; 21 20 struct fwnode_reference_args; 22 21 23 22 enum iio_shared_by { ··· 510 511 int (*debugfs_reg_access)(struct iio_dev *indio_dev, 511 512 unsigned reg, unsigned writeval, 512 513 unsigned *readval); 513 - int (*of_xlate)(struct iio_dev *indio_dev, 514 - const struct of_phandle_args *iiospec); 515 514 int (*fwnode_xlate)(struct iio_dev *indio_dev, 516 515 const struct fwnode_reference_args *iiospec); 517 516 int (*hwfifo_set_watermark)(struct iio_dev *indio_dev, unsigned val);