[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFrBj2RO3jqgrQ5qhYpMOFfjufBnr2y8McdgJXR-Z_618g@mail.gmail.com>
Date: Tue, 25 Aug 2020 14:27:19 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Matthias Schiffer <matthias.schiffer@...tq-group.com>
Cc: Sascha Hauer <s.hauer@...gutronix.de>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: (EXT) Re: [PATCH mmc-next v2] mmc: allow setting slot index via
device tree alias
On Tue, 25 Aug 2020 at 14:00, Matthias Schiffer
<matthias.schiffer@...tq-group.com> wrote:
>
> On Tue, 2020-08-25 at 11:39 +0200, Matthias Schiffer wrote:
> > On Tue, 2020-08-25 at 11:14 +0200, Ulf Hansson wrote:
> > > On Thu, 20 Aug 2020 at 09:59, Matthias Schiffer
> > > <matthias.schiffer@...tq-group.com> wrote:
> > > > --- a/drivers/mmc/core/host.c
> > > > +++ b/drivers/mmc/core/host.c
> > > > @@ -387,6 +387,7 @@ struct mmc_host *mmc_alloc_host(int extra,
> > > > struct device *dev)
> > > > {
> > > > int err;
> > > > struct mmc_host *host;
> > > > + int alias_id, min_idx, max_idx;
> > > >
> > > > host = kzalloc(sizeof(struct mmc_host) + extra,
> > > > GFP_KERNEL);
> > > > if (!host)
> > > > @@ -395,7 +396,18 @@ struct mmc_host *mmc_alloc_host(int extra,
> > > > struct device *dev)
> > > > /* scanning will be enabled when we're ready */
> > > > host->rescan_disable = 1;
> > > >
> > > > - err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL);
> > > > + host->parent = dev;
> > > > +
> > > > + alias_id = mmc_get_reserved_index(host);
> > > > + if (alias_id >= 0) {
> > > > + min_idx = alias_id;
> > > > + max_idx = alias_id + 1;
> > > > + } else {
> > > > + min_idx = mmc_first_nonreserved_index();
> > > > + max_idx = 0;
> > > > + }
> > > > +
> > > > + err = ida_simple_get(&mmc_host_ida, min_idx, max_idx,
> > > > GFP_KERNEL);
>
>
> One more question I came across when reworking my patch: Do we need a
> fallback here for the case where the reserved index is already taken?
> To handle an SD card being replaced while still mounted?
Removal/insertion of an SD card should be fine, as that doesn't mean
that the host is removed. In other words, host->index remains the
same.
Although, for a bad DT configuration, where for example the same
aliases id is used twice, a fallback could make sense. On the other
hand, as such configuration would be wrong, we might as well just
print a message and return an error.
[...]
Kind regards
Uffe
Powered by blists - more mailing lists