All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	linux-amlogic <linux-amlogic@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH v2 3/3] iio: adc: meson_saradc: Use temporary variable for struct device
Date: Fri, 3 Jun 2022 17:18:52 +0100	[thread overview]
Message-ID: <20220603171852.1f4c727f@jic23-huawei> (raw)
In-Reply-To: <CAHp75VcSFr+E7_woyw6jx7e9wCeFUUouV_7xJXYO26_y6=fwTQ@mail.gmail.com>

On Thu, 2 Jun 2022 15:45:27 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Thu, Jun 2, 2022 at 2:08 PM Lars-Peter Clausen <lars@metafoo.de> wrote:
> > On 6/2/22 13:42, Andy Shevchenko wrote:  
> 
> ...
> 
> > > -     priv->adc_clk = devm_clk_register(&indio_dev->dev, &priv->clk_gate.hw);
> > > +     priv->adc_clk = devm_clk_register(idev, &priv->clk_gate.hw);  
> >
> > You are not changing anything here.  
> 
> The scope of patch is supposed not to change the current behaviour :-)
> 
> > But we shouldn't be devm'ing on the
> > IIO device. It will get freed eventually, but only when the last
> > reference to the iio device has been dropped, which might be long after
> > the platform device has been removed. devm'ing should happen on the
> > platform_device's device. Might be worth fixing.  
> 
> Thanks for confirming my suspicions (as I mentioned to Martin, using
> an IIO device there feels wrong).
> I will add another patch to v3.
> 

I thought that the iio_dev ends up holding a reference to the platform
device dev so the parent would only be released if the child had already been,
but I may well be wrong on that. 

Either way I don't mind it being tidied up.

Jonathan



WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	linux-amlogic <linux-amlogic@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH v2 3/3] iio: adc: meson_saradc: Use temporary variable for struct device
Date: Fri, 3 Jun 2022 17:18:52 +0100	[thread overview]
Message-ID: <20220603171852.1f4c727f@jic23-huawei> (raw)
In-Reply-To: <CAHp75VcSFr+E7_woyw6jx7e9wCeFUUouV_7xJXYO26_y6=fwTQ@mail.gmail.com>

On Thu, 2 Jun 2022 15:45:27 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Thu, Jun 2, 2022 at 2:08 PM Lars-Peter Clausen <lars@metafoo.de> wrote:
> > On 6/2/22 13:42, Andy Shevchenko wrote:  
> 
> ...
> 
> > > -     priv->adc_clk = devm_clk_register(&indio_dev->dev, &priv->clk_gate.hw);
> > > +     priv->adc_clk = devm_clk_register(idev, &priv->clk_gate.hw);  
> >
> > You are not changing anything here.  
> 
> The scope of patch is supposed not to change the current behaviour :-)
> 
> > But we shouldn't be devm'ing on the
> > IIO device. It will get freed eventually, but only when the last
> > reference to the iio device has been dropped, which might be long after
> > the platform device has been removed. devm'ing should happen on the
> > platform_device's device. Might be worth fixing.  
> 
> Thanks for confirming my suspicions (as I mentioned to Martin, using
> an IIO device there feels wrong).
> I will add another patch to v3.
> 

I thought that the iio_dev ends up holding a reference to the platform
device dev so the parent would only be released if the child had already been,
but I may well be wrong on that. 

Either way I don't mind it being tidied up.

Jonathan



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	linux-amlogic <linux-amlogic@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH v2 3/3] iio: adc: meson_saradc: Use temporary variable for struct device
Date: Fri, 3 Jun 2022 17:18:52 +0100	[thread overview]
Message-ID: <20220603171852.1f4c727f@jic23-huawei> (raw)
In-Reply-To: <CAHp75VcSFr+E7_woyw6jx7e9wCeFUUouV_7xJXYO26_y6=fwTQ@mail.gmail.com>

On Thu, 2 Jun 2022 15:45:27 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Thu, Jun 2, 2022 at 2:08 PM Lars-Peter Clausen <lars@metafoo.de> wrote:
> > On 6/2/22 13:42, Andy Shevchenko wrote:  
> 
> ...
> 
> > > -     priv->adc_clk = devm_clk_register(&indio_dev->dev, &priv->clk_gate.hw);
> > > +     priv->adc_clk = devm_clk_register(idev, &priv->clk_gate.hw);  
> >
> > You are not changing anything here.  
> 
> The scope of patch is supposed not to change the current behaviour :-)
> 
> > But we shouldn't be devm'ing on the
> > IIO device. It will get freed eventually, but only when the last
> > reference to the iio device has been dropped, which might be long after
> > the platform device has been removed. devm'ing should happen on the
> > platform_device's device. Might be worth fixing.  
> 
> Thanks for confirming my suspicions (as I mentioned to Martin, using
> an IIO device there feels wrong).
> I will add another patch to v3.
> 

I thought that the iio_dev ends up holding a reference to the platform
device dev so the parent would only be released if the child had already been,
but I may well be wrong on that. 

Either way I don't mind it being tidied up.

Jonathan



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-06-03 16:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 11:42 [PATCH v2 1/3] iio: adc: meson_saradc: Convert to use dev_err_probe() Andy Shevchenko
2022-06-02 11:42 ` Andy Shevchenko
2022-06-02 11:42 ` Andy Shevchenko
2022-06-02 11:42 ` [PATCH v2 2/3] iio: adc: meson_saradc: Use devm_clk_get_optional() Andy Shevchenko
2022-06-02 11:42   ` Andy Shevchenko
2022-06-02 11:42   ` Andy Shevchenko
2022-06-02 11:42 ` [PATCH v2 3/3] iio: adc: meson_saradc: Use temporary variable for struct device Andy Shevchenko
2022-06-02 11:42   ` Andy Shevchenko
2022-06-02 11:42   ` Andy Shevchenko
2022-06-02 11:53   ` Lars-Peter Clausen
2022-06-02 11:53     ` Lars-Peter Clausen
2022-06-02 11:53     ` Lars-Peter Clausen
2022-06-02 13:45     ` Andy Shevchenko
2022-06-02 13:45       ` Andy Shevchenko
2022-06-02 13:45       ` Andy Shevchenko
2022-06-03 16:18       ` Jonathan Cameron [this message]
2022-06-03 16:18         ` Jonathan Cameron
2022-06-03 16:18         ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220603171852.1f4c727f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=narmstrong@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.