All of lore.kernel.org
 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 06:45:41 -0500	[thread overview]
Message-ID: <YchV5UvIq7xgkbF6@glsvmlin.ini.cmu.edu> (raw)
In-Reply-To: <CAHp75Vf7ktdoBoOHVE72LO19vxZiQ82eBg9_xP2ywB6c4yqXWQ@mail.gmail.com>

Hi Andy,

Thanks for the feedback!

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:
> >
> > LiteX (https://github.com/enjoy-digital/litex) is a SoC framework
> > that targets FPGAs. LiteSDCard is a small footprint, configurable
> > SDCard core commonly used in LiteX designs.
> >
> > The driver was first written in May 2020 and has been maintained
> > cooperatively by the LiteX community. Thanks to all contributors!
> 
> ...
> 
> > +       int ret;
> > +
> > +       host->irq = platform_get_irq_optional(host->dev, 0);
> > +       if (host->irq <= 0) {
> > +               dev_warn(dev, "Failed to get IRQ, using polling\n");
> > +               goto use_polling;
> > +       }
> 
> [Same comment as per v3.]

> 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...

> 
> ...
> 
> > +#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).

Do you think that would be cleaner?

Thanks,
--Gabriel

> > +       /* increase from default 32 on 64-bit-DMA capable architectures */
> > +       ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> > +       if (ret)
> > +               goto err;
> > +#endif
> 
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2021-12-26 11:45 UTC|newest]

Thread overview: 19+ 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 [this message]
2021-12-26 13:01       ` Andy Shevchenko
2021-12-26 13:13       ` Andy Shevchenko
2021-12-26 13:36         ` Gabriel L. Somlo
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
2021-12-21 10:46 kernel test robot

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=YchV5UvIq7xgkbF6@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 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.