iio: adc: meson_saradc: Don't attach managed resource to IIO device object
It feels wrong and actually inconsistent to attach managed resources to the IIO device object, which is child of the physical device object. The rest of the ->probe() calls do that against physical device. Resolve this by reassigning managed resources to the physical device object. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20220603100004.70336-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
5a3ec28ada
commit
ec25bb6e84
|
@ -650,11 +650,11 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
|
||||||
void __iomem *base)
|
void __iomem *base)
|
||||||
{
|
{
|
||||||
struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
|
struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
|
||||||
|
struct device *dev = indio_dev->dev.parent;
|
||||||
struct clk_init_data init;
|
struct clk_init_data init;
|
||||||
const char *clk_parents[1];
|
const char *clk_parents[1];
|
||||||
|
|
||||||
init.name = devm_kasprintf(&indio_dev->dev, GFP_KERNEL, "%s#adc_div",
|
init.name = devm_kasprintf(dev, GFP_KERNEL, "%s#adc_div", dev_name(dev));
|
||||||
dev_name(indio_dev->dev.parent));
|
|
||||||
if (!init.name)
|
if (!init.name)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -670,13 +670,11 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
|
||||||
priv->clk_div.hw.init = &init;
|
priv->clk_div.hw.init = &init;
|
||||||
priv->clk_div.flags = 0;
|
priv->clk_div.flags = 0;
|
||||||
|
|
||||||
priv->adc_div_clk = devm_clk_register(&indio_dev->dev,
|
priv->adc_div_clk = devm_clk_register(dev, &priv->clk_div.hw);
|
||||||
&priv->clk_div.hw);
|
|
||||||
if (WARN_ON(IS_ERR(priv->adc_div_clk)))
|
if (WARN_ON(IS_ERR(priv->adc_div_clk)))
|
||||||
return PTR_ERR(priv->adc_div_clk);
|
return PTR_ERR(priv->adc_div_clk);
|
||||||
|
|
||||||
init.name = devm_kasprintf(&indio_dev->dev, GFP_KERNEL, "%s#adc_en",
|
init.name = devm_kasprintf(dev, GFP_KERNEL, "%s#adc_en", dev_name(dev));
|
||||||
dev_name(indio_dev->dev.parent));
|
|
||||||
if (!init.name)
|
if (!init.name)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -690,7 +688,7 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
|
||||||
priv->clk_gate.bit_idx = __ffs(MESON_SAR_ADC_REG3_CLK_EN);
|
priv->clk_gate.bit_idx = __ffs(MESON_SAR_ADC_REG3_CLK_EN);
|
||||||
priv->clk_gate.hw.init = &init;
|
priv->clk_gate.hw.init = &init;
|
||||||
|
|
||||||
priv->adc_clk = devm_clk_register(&indio_dev->dev, &priv->clk_gate.hw);
|
priv->adc_clk = devm_clk_register(dev, &priv->clk_gate.hw);
|
||||||
if (WARN_ON(IS_ERR(priv->adc_clk)))
|
if (WARN_ON(IS_ERR(priv->adc_clk)))
|
||||||
return PTR_ERR(priv->adc_clk);
|
return PTR_ERR(priv->adc_clk);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue