public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Sven Peter <sven@svenpeter.dev>
Cc: linux-usb@vger.kernel.org, Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] usb: dwc3: support 64 bit DMA in platform driver
Date: Mon, 7 Jun 2021 10:24:38 +0100	[thread overview]
Message-ID: <YL3l1upzyU83+iL/@infradead.org> (raw)
In-Reply-To: <20210606093629.69786-1-sven@svenpeter.dev>

On Sun, Jun 06, 2021 at 11:36:29AM +0200, Sven Peter wrote:
> +	/* Try to set 64-bit DMA first */
> +	if (WARN_ON(!dwc->sysdev->dma_mask))
> +		/* Platform did not initialize dma_mask */
> +		ret = dma_coerce_mask_and_coherent(dwc->sysdev,
> +						   DMA_BIT_MASK(64));
> +	else
> +		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));

WARN_ON + fallback seems weird.  I'd suggest to just error out for the
warn case.

> +	/* If seting 64-bit DMA mask fails, fall back to 32-bit DMA mask */
> +	if (ret) {
> +		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(32));
> +		if (ret)
> +			return ret;
> +	}

Setting a 64-bit mask will not fail.  No need for the fallback.

      parent reply	other threads:[~2021-06-07  9:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06  9:36 [PATCH] usb: dwc3: support 64 bit DMA in platform driver Sven Peter
2021-06-06  9:52 ` Greg Kroah-Hartman
2021-06-06 10:08   ` Sven Peter
2021-06-07  9:24 ` Christoph Hellwig [this message]

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=YL3l1upzyU83+iL/@infradead.org \
    --to=hch@infradead.org \
    --cc=arnd@arndb.de \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sven@svenpeter.dev \
    /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