[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vf7o1g0FTAd+Zo6TMzDN3C2nGLhbDo0OJ9Cmwcxm=Kc8Q@mail.gmail.com>
Date: Sat, 8 Jan 2022 13:26:08 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: "Gabriel L. Somlo" <gsomlo@...il.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"ulf.hansson@...aro.org" <ulf.hansson@...aro.org>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
"kgugala@...micro.com" <kgugala@...micro.com>,
"mholenko@...micro.com" <mholenko@...micro.com>,
"krakoczy@...micro.com" <krakoczy@...micro.com>,
"mdudek@...ernships.antmicro.com" <mdudek@...ernships.antmicro.com>,
"paulus@...abs.org" <paulus@...abs.org>,
"joel@....id.au" <joel@....id.au>,
"shorne@...il.com" <shorne@...il.com>,
"geert@...ux-m68k.org" <geert@...ux-m68k.org>,
"david.abdurachmanov@...ive.com" <david.abdurachmanov@...ive.com>,
"florent@...oy-digital.fr" <florent@...oy-digital.fr>,
"rdunlap@...radead.org" <rdunlap@...radead.org>
Subject: Re: [PATCH v8 3/3] mmc: Add driver for LiteX's LiteSDCard interface
On Sat, Jan 8, 2022 at 3:57 AM Gabriel L. Somlo <gsomlo@...il.com> wrote:
> On Sat, Jan 08, 2022 at 01:54:07AM +0200, Andy Shevchenko wrote:
> > On Saturday, January 8, 2022, Gabriel Somlo <gsomlo@...il.com> wrote:
...
> > Almost
>
> That's encouraging! Thanks for your ongoing time and attention! :)
It's true from my perspective, but I'm not a maintainer here :-)
...
> > +#include <linux/of.h>
> >
> > Is it used anywhere? Or you meant mod_devicetable.h?
>
> Not used since I dropped `of_match_ptr()`, so I'm removing the
> include in v9 as well -- thanks for catching that!
Don't forget to use mod_devicetable.h, though.
...
> > + u32 div;
> > +
> > + div = freq ? host->ref_clk / freq : 256U;
> >
> > + div = roundup_pow_of_two(div);
> > + div = clamp(div, 2U, 256U);
> >
> > Logically seems to me that you may join these two together, because clamped
> > range is power-of-2 one.
>
> `div` needs to be a power-of-2 when written to the LITEX_PHY_CLOCKERDIV
> register (below). And clamp() will just enforce a min/max range, so if
> (div = ref_clk / freq) ends up e.g., 5, I need both roundup_pow_of_two()
> to bump it to 8, and clamp() to enforce that it's between 2 and 256.
>
> Unless you mean I should simply write it like:
>
> div = clamp(roundup_pow_of_two(div), 2U, 256U);
>
> ... as a single line?
Yes, that's what I meant.
...
> > + 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!
There are basically three options:
- switch to non-devm
- switch to devm: a) if there is an API, b) using
devm_add_action_or_reset() helper
- shuffle code around to make sure all devm followed by all non-devm.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists