From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: ezequiel@vanguardiasur.com.ar, mchehab@kernel.org,
laurent.pinchart@ideasonboard.com, hdegoede@redhat.com,
gregkh@linuxfoundation.org, mingo@kernel.org, tglx@linutronix.de,
viro@zeniv.linux.org.uk, thomas.weissschuh@linutronix.de,
dafna.hirschfeld@collabora.com, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
imx@lists.linux.dev, jun.li@nxp.com
Subject: Re: [PATCH v3 1/3] usb: core: add dma-noncoherent buffer alloc and free API
Date: Wed, 2 Jul 2025 15:20:33 +0300 [thread overview]
Message-ID: <aGUkEbaSOzrtILkZ@smile.fi.intel.com> (raw)
In-Reply-To: <20250702110222.3926355-2-xu.yang_2@nxp.com>
On Wed, Jul 02, 2025 at 07:02:20PM +0800, Xu Yang wrote:
> This will add usb_alloc_noncoherent() and usb_free_noncoherent()
> functions to support alloc and free buffer in a dma-noncoherent way.
>
> To explicit manage the memory ownership for the kernel and device,
> this will also add usb_dma_noncoherent_sync_for_cpu/device() functions
> and call it at proper time. The management requires the user save
> sg_table returned by usb_alloc_noncoherent() to urb->sgt.
...
> + if ((urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) &&
> + urb->sgt) {
Something weird with the indentation. Here you wrapped, but the very next line
is not, and they both satisfy 80 limit (even though we have it relaxed now).
> + dma_sync_sgtable_for_cpu(hcd->self.sysdev, urb->sgt, dir);
> + if (dir == DMA_FROM_DEVICE)
> + invalidate_kernel_vmap_range(urb->transfer_buffer,
> + urb->transfer_buffer_length);
> + }
...
> +
> + return ret;
> }
> +
> + if ((urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) &&
> + urb->sgt) {
Why not
} else if {
and drop the above return ret; ?
> + if (dir == DMA_TO_DEVICE)
> + flush_kernel_vmap_range(urb->transfer_buffer,
> + urb->transfer_buffer_length);
> + dma_sync_sgtable_for_device(hcd->self.sysdev, urb->sgt, dir);
> + }
> +
> return ret;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-07-02 12:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 11:02 [PATCH v3 0/3] add dma noncoherent API Xu Yang
2025-07-02 11:02 ` [PATCH v3 1/3] usb: core: add dma-noncoherent buffer alloc and free API Xu Yang
2025-07-02 12:20 ` Andy Shevchenko [this message]
2025-07-03 8:40 ` Xu Yang
2025-07-02 14:32 ` Alan Stern
2025-07-03 8:42 ` Xu Yang
2025-07-02 11:02 ` [PATCH v3 2/3] media: uvcvideo: use usb_alloc_noncoherent/usb_free_noncoherent() Xu Yang
2025-07-02 12:30 ` Ricardo Ribalda
2025-07-03 8:46 ` Xu Yang
2025-07-03 11:32 ` Ricardo Ribalda
2025-07-02 11:02 ` [PATCH v3 3/3] media: stk1160: " Xu Yang
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=aGUkEbaSOzrtILkZ@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dafna.hirschfeld@collabora.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=imx@lists.linux.dev \
--cc=jun.li@nxp.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=thomas.weissschuh@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
--cc=xu.yang_2@nxp.com \
/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.