mbox series

[v3,00/10] ACPI / utils: Replace leaky function

Message ID 20190328171729.44002-1-andriy.shevchenko@linux.intel.com (mailing list archive)
Headers show
Series ACPI / utils: Replace leaky function | expand

Message

Andy Shevchenko March 28, 2019, 5:17 p.m. UTC
The acpi_dev_get_first_match_name() is missing put_device() call
and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users
one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Andy Shevchenko (10):
  ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
  extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
  gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
  ASoC: Intel: bytcht_da7213: Convert to use
    acpi_dev_get_first_match_dev()
  ASoC: Intel: bytcht_es8316: Convert to use
    acpi_dev_get_first_match_dev()
  ASoC: Intel: bytcr_rt5640: Convert to use
    acpi_dev_get_first_match_dev()
  ASoC: Intel: bytcr_rt5651: Convert to use
    acpi_dev_get_first_match_dev()
  ASoC: Intel: cht_bsw_rt5645: Convert to use
    acpi_dev_get_first_match_dev()
  ASoC: Intel: cht_bsw_rt5672: Convert to use
    acpi_dev_get_first_match_dev()
  ACPI / utils: Remove deprecated function since no user left

 drivers/acpi/utils.c                    | 16 ++++++++++------
 drivers/extcon/extcon-axp288.c          |  9 +++++----
 drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
 include/acpi/acpi_bus.h                 |  4 ++--
 include/linux/acpi.h                    |  4 ++--
 sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
 sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
 sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
 sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
 sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
 sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
 11 files changed, 66 insertions(+), 45 deletions(-)

Comments

Pierre-Louis Bossart March 28, 2019, 6:31 p.m. UTC | #1
On 3/28/19 1:17 PM, Andy Shevchenko wrote:
> The acpi_dev_get_first_match_name() is missing put_device() call
> and thus keeping reference counting unbalanced.
> 
> In order to fix the issue introduce a new helper to convert existing users
> one-by-one to a better API.
> 
> Since v3:
> - convert all existing users and drop old API (Mika)
> - add Hans' tag
> 
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Patches 4..9 for the Intel machine drivers:

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Is this going to be merged through the ACPI or ASoC tree? The changes 
will conflict with cleanups I started to use the 'modern' dailinks 
(codec_name -> codecs[0].name), so some level of coordination is needed.

> 
> Andy Shevchenko (10):
>    ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
>    extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
>    gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
>    ASoC: Intel: bytcht_da7213: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: bytcht_es8316: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: bytcr_rt5640: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: bytcr_rt5651: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: cht_bsw_rt5645: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: cht_bsw_rt5672: Convert to use
>      acpi_dev_get_first_match_dev()
>    ACPI / utils: Remove deprecated function since no user left
> 
>   drivers/acpi/utils.c                    | 16 ++++++++++------
>   drivers/extcon/extcon-axp288.c          |  9 +++++----
>   drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
>   include/acpi/acpi_bus.h                 |  4 ++--
>   include/linux/acpi.h                    |  4 ++--
>   sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
>   sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
>   sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
>   sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
>   sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
>   sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
>   11 files changed, 66 insertions(+), 45 deletions(-)
>
Andy Shevchenko March 28, 2019, 9:40 p.m. UTC | #2
On Thu, Mar 28, 2019 at 02:31:28PM -0400, Pierre-Louis Bossart wrote:
> On 3/28/19 1:17 PM, Andy Shevchenko wrote:
> > The acpi_dev_get_first_match_name() is missing put_device() call
> > and thus keeping reference counting unbalanced.
> > 
> > In order to fix the issue introduce a new helper to convert existing users
> > one-by-one to a better API.
> > 
> > Since v3:
> > - convert all existing users and drop old API (Mika)
> > - add Hans' tag
> > 
> > Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> > Cc: Chanwoo Choi <cw00.choi@samsung.com>
> > Cc: Chen-Yu Tsai <wens@csie.org>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Patches 4..9 for the Intel machine drivers:
> 
> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Thank you!

> Is this going to be merged through the ACPI or ASoC tree? The changes will
> conflict with cleanups I started to use the 'modern' dailinks (codec_name ->
> codecs[0].name), so some level of coordination is needed.

I suppose via ACPI.

> 
> > 
> > Andy Shevchenko (10):
> >    ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
> >    extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
> >    gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
> >    ASoC: Intel: bytcht_da7213: Convert to use
> >      acpi_dev_get_first_match_dev()
> >    ASoC: Intel: bytcht_es8316: Convert to use
> >      acpi_dev_get_first_match_dev()
> >    ASoC: Intel: bytcr_rt5640: Convert to use
> >      acpi_dev_get_first_match_dev()
> >    ASoC: Intel: bytcr_rt5651: Convert to use
> >      acpi_dev_get_first_match_dev()
> >    ASoC: Intel: cht_bsw_rt5645: Convert to use
> >      acpi_dev_get_first_match_dev()
> >    ASoC: Intel: cht_bsw_rt5672: Convert to use
> >      acpi_dev_get_first_match_dev()
> >    ACPI / utils: Remove deprecated function since no user left
> > 
> >   drivers/acpi/utils.c                    | 16 ++++++++++------
> >   drivers/extcon/extcon-axp288.c          |  9 +++++----
> >   drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
> >   include/acpi/acpi_bus.h                 |  4 ++--
> >   include/linux/acpi.h                    |  4 ++--
> >   sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
> >   sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
> >   sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
> >   sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
> >   sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
> >   sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
> >   11 files changed, 66 insertions(+), 45 deletions(-)
> > 
>
Hans de Goede March 28, 2019, 10:29 p.m. UTC | #3
Hi,

On 28-03-19 18:17, Andy Shevchenko wrote:
> The acpi_dev_get_first_match_name() is missing put_device() call
> and thus keeping reference counting unbalanced.
> 
> In order to fix the issue introduce a new helper to convert existing users
> one-by-one to a better API.
> 
> Since v3:
> - convert all existing users and drop old API (Mika)
> - add Hans' tag
> 
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>

> Andy Shevchenko (10):
>    ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
>    extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
>    gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
>    ASoC: Intel: bytcht_da7213: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: bytcht_es8316: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: bytcr_rt5640: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: bytcr_rt5651: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: cht_bsw_rt5645: Convert to use
>      acpi_dev_get_first_match_dev()
>    ASoC: Intel: cht_bsw_rt5672: Convert to use
>      acpi_dev_get_first_match_dev()
>    ACPI / utils: Remove deprecated function since no user left

The entire series looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

For the entire series.

Regards,

Hans



> 
>   drivers/acpi/utils.c                    | 16 ++++++++++------
>   drivers/extcon/extcon-axp288.c          |  9 +++++----
>   drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
>   include/acpi/acpi_bus.h                 |  4 ++--
>   include/linux/acpi.h                    |  4 ++--
>   sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
>   sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
>   sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
>   sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
>   sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
>   sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
>   11 files changed, 66 insertions(+), 45 deletions(-)
>
Rafael J. Wysocki March 28, 2019, 11:33 p.m. UTC | #4
On Thu, Mar 28, 2019 at 10:40 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Mar 28, 2019 at 02:31:28PM -0400, Pierre-Louis Bossart wrote:
> > On 3/28/19 1:17 PM, Andy Shevchenko wrote:
> > > The acpi_dev_get_first_match_name() is missing put_device() call
> > > and thus keeping reference counting unbalanced.
> > >
> > > In order to fix the issue introduce a new helper to convert existing users
> > > one-by-one to a better API.
> > >
> > > Since v3:
> > > - convert all existing users and drop old API (Mika)
> > > - add Hans' tag
> > >
> > > Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> > > Cc: Chanwoo Choi <cw00.choi@samsung.com>
> > > Cc: Chen-Yu Tsai <wens@csie.org>
> > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > > Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > Patches 4..9 for the Intel machine drivers:
> >
> > Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>
> Thank you!
>
> > Is this going to be merged through the ACPI or ASoC tree? The changes will
> > conflict with cleanups I started to use the 'modern' dailinks (codec_name ->
> > codecs[0].name), so some level of coordination is needed.
>
> I suppose via ACPI.

I can expose a non-volatile branch with this material, would that work?
Mika Westerberg March 29, 2019, 9:29 a.m. UTC | #5
On Thu, Mar 28, 2019 at 07:17:19PM +0200, Andy Shevchenko wrote:
> The acpi_dev_get_first_match_name() is missing put_device() call
> and thus keeping reference counting unbalanced.
> 
> In order to fix the issue introduce a new helper to convert existing users
> one-by-one to a better API.

For the entire series,

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Mark Brown April 1, 2019, 7:24 a.m. UTC | #6
On Fri, Mar 29, 2019 at 12:33:33AM +0100, Rafael J. Wysocki wrote:
> On Thu, Mar 28, 2019 at 10:40 PM Andy Shevchenko

> > > Is this going to be merged through the ACPI or ASoC tree? The changes will
> > > conflict with cleanups I started to use the 'modern' dailinks (codec_name ->
> > > codecs[0].name), so some level of coordination is needed.

> > I suppose via ACPI.

> I can expose a non-volatile branch with this material, would that work?

That would be very helpful, please - there's a lot of work going on with
the ASoC Intel drivers in order to add SoF support so there's likely to
be some kind of overlaps.
Rafael J. Wysocki April 2, 2019, 8:57 a.m. UTC | #7
On Thursday, March 28, 2019 6:17:19 PM CEST Andy Shevchenko wrote:
> The acpi_dev_get_first_match_name() is missing put_device() call
> and thus keeping reference counting unbalanced.
> 
> In order to fix the issue introduce a new helper to convert existing users
> one-by-one to a better API.
> 
> Since v3:
> - convert all existing users and drop old API (Mika)
> - add Hans' tag
> 
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Andy Shevchenko (10):
>   ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
>   extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
>   gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
>   ASoC: Intel: bytcht_da7213: Convert to use
>     acpi_dev_get_first_match_dev()
>   ASoC: Intel: bytcht_es8316: Convert to use
>     acpi_dev_get_first_match_dev()
>   ASoC: Intel: bytcr_rt5640: Convert to use
>     acpi_dev_get_first_match_dev()
>   ASoC: Intel: bytcr_rt5651: Convert to use
>     acpi_dev_get_first_match_dev()
>   ASoC: Intel: cht_bsw_rt5645: Convert to use
>     acpi_dev_get_first_match_dev()
>   ASoC: Intel: cht_bsw_rt5672: Convert to use
>     acpi_dev_get_first_match_dev()
>   ACPI / utils: Remove deprecated function since no user left
> 
>  drivers/acpi/utils.c                    | 16 ++++++++++------
>  drivers/extcon/extcon-axp288.c          |  9 +++++----
>  drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
>  include/acpi/acpi_bus.h                 |  4 ++--
>  include/linux/acpi.h                    |  4 ++--
>  sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
>  sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
>  sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
>  sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
>  sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
>  sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
>  11 files changed, 66 insertions(+), 45 deletions(-)
> 
> 

All applied (with the tags selected so far), thanks!
Rafael J. Wysocki April 2, 2019, 9:02 a.m. UTC | #8
On Monday, April 1, 2019 9:24:35 AM CEST Mark Brown wrote:
> 
> --cYtjc4pxslFTELvY
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> On Fri, Mar 29, 2019 at 12:33:33AM +0100, Rafael J. Wysocki wrote:
> > On Thu, Mar 28, 2019 at 10:40 PM Andy Shevchenko
> 
> > > > Is this going to be merged through the ACPI or ASoC tree? The changes will
> > > > conflict with cleanups I started to use the 'modern' dailinks (codec_name ->
> > > > codecs[0].name), so some level of coordination is needed.
> 
> > > I suppose via ACPI.
> 
> > I can expose a non-volatile branch with this material, would that work?
> 
> That would be very helpful, please - there's a lot of work going on with
> the ASoC Intel drivers in order to add SoF support so there's likely to
> be some kind of overlaps.

The series is available for pulling in the git branch at

 git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \
 acpi-utils

on top of 5.1-rc3 with top-most commit 257f9053c0204ea47491aa236004fd1226f75fa8

 ACPI / utils: Remove deprecated function since no user left

Thanks!
Rafael J. Wysocki April 2, 2019, 9:17 a.m. UTC | #9
On Tue, Apr 2, 2019 at 10:59 AM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> On Thursday, March 28, 2019 6:17:19 PM CEST Andy Shevchenko wrote:
> > The acpi_dev_get_first_match_name() is missing put_device() call
> > and thus keeping reference counting unbalanced.
> >
> > In order to fix the issue introduce a new helper to convert existing users
> > one-by-one to a better API.
> >
> > Since v3:
> > - convert all existing users and drop old API (Mika)
> > - add Hans' tag
> >
> > Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> > Cc: Chanwoo Choi <cw00.choi@samsung.com>
> > Cc: Chen-Yu Tsai <wens@csie.org>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > Andy Shevchenko (10):
> >   ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
> >   extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
> >   gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
> >   ASoC: Intel: bytcht_da7213: Convert to use
> >     acpi_dev_get_first_match_dev()
> >   ASoC: Intel: bytcht_es8316: Convert to use
> >     acpi_dev_get_first_match_dev()
> >   ASoC: Intel: bytcr_rt5640: Convert to use
> >     acpi_dev_get_first_match_dev()
> >   ASoC: Intel: bytcr_rt5651: Convert to use
> >     acpi_dev_get_first_match_dev()
> >   ASoC: Intel: cht_bsw_rt5645: Convert to use
> >     acpi_dev_get_first_match_dev()
> >   ASoC: Intel: cht_bsw_rt5672: Convert to use
> >     acpi_dev_get_first_match_dev()
> >   ACPI / utils: Remove deprecated function since no user left
> >
> >  drivers/acpi/utils.c                    | 16 ++++++++++------
> >  drivers/extcon/extcon-axp288.c          |  9 +++++----
> >  drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
> >  include/acpi/acpi_bus.h                 |  4 ++--
> >  include/linux/acpi.h                    |  4 ++--
> >  sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
> >  sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
> >  sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
> >  sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
> >  sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
> >  sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
> >  11 files changed, 66 insertions(+), 45 deletions(-)
> >
> >
>
> All applied (with the tags selected so far), thanks!

s/selected/collected/

Strange ...
Andy Shevchenko April 2, 2019, 10:37 a.m. UTC | #10
On Tue, Apr 02, 2019 at 11:17:06AM +0200, Rafael J. Wysocki wrote:
> On Tue, Apr 2, 2019 at 10:59 AM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> >
> > On Thursday, March 28, 2019 6:17:19 PM CEST Andy Shevchenko wrote:
> > > The acpi_dev_get_first_match_name() is missing put_device() call
> > > and thus keeping reference counting unbalanced.
> > >
> > > In order to fix the issue introduce a new helper to convert existing users
> > > one-by-one to a better API.
> > >
> > > Since v3:
> > > - convert all existing users and drop old API (Mika)
> > > - add Hans' tag

> > All applied (with the tags selected so far), thanks!
> 
> s/selected/collected/
> 
> Strange ...

Thank you, Rafael!