devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gabriel L. Somlo" <gsomlo@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Karol Gugala <kgugala@antmicro.com>,
	Mateusz Holenko <mholenko@antmicro.com>,
	krakoczy@antmicro.com, mdudek@internships.antmicro.com,
	paulus@ozlabs.org, Joel Stanley <joel@jms.id.au>,
	Stafford Horne <shorne@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	david.abdurachmanov@sifive.com, florent@enjoy-digital.fr,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v5 3/3] mmc: Add driver for LiteX's LiteSDCard interface
Date: Sun, 26 Dec 2021 08:36:47 -0500	[thread overview]
Message-ID: <Ychv7z6ggZGRY08l@glsvmlin.ini.cmu.edu> (raw)
In-Reply-To: <CAHp75VfDq+QM30tmCy2Wg+fj+mqervh2=1LVD5BwyVmbm1PYgQ@mail.gmail.com>

On Sun, Dec 26, 2021 at 03:13:21PM +0200, Andy Shevchenko wrote:
> On Sun, Dec 26, 2021 at 1:45 PM Gabriel L. Somlo <gsomlo@gmail.com> wrote:
> > On Sat, Dec 25, 2021 at 06:43:22PM +0200, Andy Shevchenko wrote:
> > > On Wed, Dec 15, 2021 at 10:00 PM Gabriel Somlo <gsomlo@gmail.com> wrote:
> 
> ...
> 
> > > This is wrong. It missed the deferred probe, for example.
> > >
> > > The best approach is
> > >
> > > ret = platform_get_irq_optional(...);
> > > if (ret < 0 && ret != -ENXIO)
> > >   return ret;
> > > if (ret > 0)
> > >   ...we got it...
> > >
> > > It will allow the future API fix of platform_get_irq_optional() to be
> > > really optional.
> >
> > Thanks for the example. I still need to work in a decision to use
> > polling, though. How about something like this instead:
> >
> > ret = platform_get_irq_optional(...);
> > if (ret == -ENXIO)
> >   goto use_polling;
> > if (ret < 0)
> >   return ret; // deferred probe (-EAGAIN likely?)
> > if (ret > 0)
> >   ...we got it, keep going...
> 
> This doesn't define what you should do when you get 0.
> I suggest to take my variant with below modification
> 
> if (ret > 0)
>   ...we have IRQ...
> else
>   goto USE POLLING;
> 
> It will take care of the case.
 
OK, will do.

> ...
> 
> > > > +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> > >
> > > Why under ifdeffery?
> >
> > Because I only want to do it on 64-bit capable architectures.
> >
> > The alternative would be to call
> >
> >   dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> >
> > on *all* architectures, but ignore the returned error (-EIO,
> > presumably on architetures that only support 32-bit DMA).
> 
> I don't understand why you are supposed to ignore errors and why you
> expect to get such.

If I call `dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));`
on a machine where `CONFIG_ARCH_DMA_ADDR_T_64BIT` is *not* set, I
expect an error. The implicit default
(per Documentation/core-api/dma-api-howto.rst), is DMA_BIT_MASK(32).
I'm working under the impression that on machines with
CONFIG_ARCH_DMA_ADDR_T_64BIT I should increase that to DMA_BIT_MASK(64).

So if I don't #ifdef it, that call will fail on machines supporting
only 32-bits.

What am I missing?

Thanks,
--Gabriel
 
> > Do you think that would be cleaner?
> 
> -- 
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2021-12-26 13:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15 13:07 [PATCH v5 0/3] mmc: Add LiteSDCard mmc driver Gabriel Somlo
2021-12-15 13:07 ` [PATCH v5 1/3] MAINTAINERS: co-maintain LiteX platform Gabriel Somlo
2021-12-15 13:07 ` [PATCH v5 2/3] dt-bindings: mmc: Add bindings for LiteSDCard Gabriel Somlo
2021-12-15 13:07 ` [PATCH v5 3/3] mmc: Add driver for LiteX's LiteSDCard interface Gabriel Somlo
2021-12-25 16:43   ` Andy Shevchenko
2021-12-26 11:45     ` Gabriel L. Somlo
2021-12-26 13:01       ` Andy Shevchenko
2021-12-26 13:13       ` Andy Shevchenko
2021-12-26 13:36         ` Gabriel L. Somlo [this message]
2021-12-26 14:01           ` Andy Shevchenko
2021-12-26 22:37             ` Gabriel L. Somlo
2021-12-28 16:15   ` Ulf Hansson
2022-01-04  0:27     ` Gabriel L. Somlo
2022-01-06 17:08       ` Gabriel L. Somlo
2022-01-11 15:47       ` Ulf Hansson
2022-01-11 22:49         ` Gabriel L. Somlo
2022-01-12 10:24           ` Ulf Hansson
2022-01-12 18:08             ` Gabriel L. Somlo

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=Ychv7z6ggZGRY08l@glsvmlin.ini.cmu.edu \
    --to=gsomlo@gmail.com \
    --cc=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=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 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).