// SPDX-License-Identifier: GPL-2.0+
 #include <linux/extcon.h>
 #include <linux/iio/consumer.h>
-#include <linux/iio/iio.h>
 #include <linux/input-event-codes.h>
 #include <linux/mfd/wm8994/registers.h>
 #include <linux/module.h>
        struct aries_wm8994_data *priv;
        struct snd_soc_dai_link *dai_link;
        const struct of_device_id *match;
+       enum iio_chan_type channel_type;
        int ret, i;
 
        if (!np)
                return dev_err_probe(dev, PTR_ERR(priv->adc),
                                     "Failed to get ADC channel");
 
-       if (priv->adc->channel->type != IIO_VOLTAGE)
+       ret = iio_get_channel_type(priv->adc, &channel_type);
+       if (ret)
+               return dev_err_probe(dev, ret,
+                                    "Failed to get ADC channel type");
+       if (channel_type != IIO_VOLTAGE)
                return -EINVAL;
 
        priv->gpio_headset_key = devm_gpiod_get(dev, "headset-key",