All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"kgugala@antmicro.com" <kgugala@antmicro.com>,
	"mholenko@antmicro.com" <mholenko@antmicro.com>,
	"krakoczy@antmicro.com" <krakoczy@antmicro.com>,
	"mdudek@internships.antmicro.com"
	<mdudek@internships.antmicro.com>,
	"paulus@ozlabs.org" <paulus@ozlabs.org>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"shorne@gmail.com" <shorne@gmail.com>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>,
	"david.abdurachmanov@sifive.com" <david.abdurachmanov@sifive.com>,
	"florent@enjoy-digital.fr" <florent@enjoy-digital.fr>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>
Subject: Re: [PATCH v8 3/3] mmc: Add driver for LiteX's LiteSDCard interface
Date: Sat, 8 Jan 2022 13:29:05 +0200	[thread overview]
Message-ID: <CAHp75VcsdYtFiPaL-rS-a4t4mBRasatnDLc+7ig0qhZi6U4gsg@mail.gmail.com> (raw)
In-Reply-To: <Ydj3mmdWILBWHkAh@glsvmlin.ini.cmu.edu>

On Sat, Jan 8, 2022 at 4:32 AM Gabriel L. Somlo <gsomlo@gmail.com> wrote:
> On Fri, Jan 07, 2022 at 08:57:43PM -0500, Gabriel L. Somlo wrote:
> > On Sat, Jan 08, 2022 at 01:54:07AM +0200, Andy Shevchenko wrote:
> > > On Saturday, January 8, 2022, Gabriel Somlo <gsomlo@gmail.com> wrote:

...

> > >     +       mmc = mmc_alloc_host(sizeof(struct litex_mmc_host), &pdev->dev);
> > >
> > > Should be devm or you may not use devm at all. See hint in one of the previous
> > > messages in v7 discussion.
> >
> > And here I think I'm in trouble... :)
> >
> > None of the examples retrieved via
> >
> > `git log --no-merges --grep devm_add_action_or_reset`
> >
> > are from "drivers/mmc/host/*", and *all* of the mmc drivers there,
> > including the ones that make extensive use of devm_*, use
> > mmc_alloc_host(), and there doesn't appear to be a devm-ified version
> > of mmc_alloc_host() available! How do they all get away with it?
> >
> > I'm really confused now -- any additional clue(s) much appreciated!
>
> I found drivers/mmc/host/meson-mx-sdhc-mmc.c, which uses
> devm_add_action_or_reset() right after mmc_alloc_host() to enlist the
> subsequent call to mmc_free_host(), see here:
>
> https://github.com/torvalds/linux/blob/master/drivers/mmc/host/meson-mx-sdhc-mmc.c#L791
>
> This would mean that I no longer have to call mmc_free_host(), neither
> on probe()'s error path, nor during remove().
>
> Does that count as canonically correct, or am I still missing
> something?

Yes, this is one of the options you may use.

Since it will be a second (?) driver with the same idea, perhaps in
the future it would make sense to provide devm_mmc_alloc_host() or
analogue (in the latter it means more complex solution like the input
subsystem is using, see devm_input_... API implementations).

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2022-01-08 11:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 23:34 [PATCH v8 0/3] mmc: Add LiteSDCard mmc driver Gabriel Somlo
2022-01-07 23:34 ` [PATCH v8 1/3] MAINTAINERS: co-maintain LiteX platform Gabriel Somlo
2022-01-07 23:34 ` [PATCH v8 2/3] dt-bindings: mmc: Add bindings for LiteSDCard Gabriel Somlo
2022-01-07 23:34 ` [PATCH v8 3/3] mmc: Add driver for LiteX's LiteSDCard interface Gabriel Somlo
     [not found]   ` <CAHp75VcHnHpX1=ojmFnujqkf55aS1ePiVW4kKydTJQe=dXbwbQ@mail.gmail.com>
2022-01-08  1:57     ` Gabriel L. Somlo
2022-01-08  2:31       ` Gabriel L. Somlo
2022-01-08 11:29         ` Andy Shevchenko [this message]
2022-01-08 11:26       ` Andy Shevchenko
2022-01-08 13:20         ` Gabriel L. Somlo
2022-01-08 17:47           ` Andy Shevchenko
2022-01-08 23:51             ` Gabriel L. Somlo
2022-01-09 11:36               ` Andy Shevchenko

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=CAHp75VcsdYtFiPaL-rS-a4t4mBRasatnDLc+7ig0qhZi6U4gsg@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=david.abdurachmanov@sifive.com \
    --cc=devicetree@vger.kernel.org \
    --cc=florent@enjoy-digital.fr \
    --cc=geert@linux-m68k.org \
    --cc=gsomlo@gmail.com \
    --cc=joel@jms.id.au \
    --cc=kgugala@antmicro.com \
    --cc=krakoczy@antmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mdudek@internships.antmicro.com \
    --cc=mholenko@antmicro.com \
    --cc=paulus@ozlabs.org \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=shorne@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /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.