ASoC: samsung: Use iio_get_channel_type() accessor.

struct iio_chan_spec is meant to be opaque to IIO consumer drivers
which should only use the interfaces in linux/iio/consumer.h.
Use the provided accessor function to find get the type of the
channel instead of directly reading it form the structure.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Link: https://lore.kernel.org/r/20220821160914.2207116-1-jic23@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jonathan Cameron 2022-08-21 17:09:14 +01:00 committed by Mark Brown
parent 4d45d944e8
commit 94f0727483
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1,7 +1,6 @@
// 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>
@ -543,6 +542,7 @@ static int aries_audio_probe(struct platform_device *pdev)
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)
@ -594,7 +594,11 @@ static int aries_audio_probe(struct platform_device *pdev)
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",