linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@pengutronix.de,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 1/3] spi: fix resource leak for drivers without .remove callback
Date: Thu, 19 Nov 2020 15:24:16 +0000	[thread overview]
Message-ID: <20201119152416.GB5554@sirena.org.uk> (raw)
In-Reply-To: <20201119152059.2631650-1-u.kleine-koenig@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

On Thu, Nov 19, 2020 at 04:20:57PM +0100, Uwe Kleine-König wrote:
> Consider an spi driver with a .probe but without a .remove callback (e.g.
> rtc-ds1347). The function spi_drv_probe() is called to bind a device and
> so some init routines like dev_pm_domain_attach() are used. As there is
> no remove callback spi_drv_remove() isn't called at unbind time however
> and so calling dev_pm_domain_detach() is missed and the pm domain keeps
> active.

> To fix this always use either both or none of the functions and make
> them handle the callback not being set.

Why would we want to tie configuring PM domains to either of these
functions?  We certainly don't want to force drivers to have empty
remove functions to trigger cleanup of domains, this would be
counterintuitive and this stuff should be transparent to the driver.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2020-11-19 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 15:20 [PATCH 1/3] spi: fix resource leak for drivers without .remove callback Uwe Kleine-König
2020-11-19 15:20 ` [PATCH 2/3] spi: Use bus_type functions for probe, remove and shutdown Uwe Kleine-König
2020-11-19 15:20 ` [PATCH 3/3] spi: Warn when a driver's remove callback returns an error Uwe Kleine-König
2020-11-19 15:24 ` Mark Brown [this message]
2020-11-19 15:35   ` [PATCH 1/3] spi: fix resource leak for drivers without .remove callback Uwe Kleine-König
2020-11-19 15:41     ` Mark Brown
2020-11-19 16:04       ` Uwe Kleine-König
2020-11-19 16:09         ` Mark Brown

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=20201119152416.GB5554@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).