Re: [PATCH 19/25] ASoC: mediatek: Convert to generic PCM copy ops
From: Andy Shevchenko
Date: Tue Aug 15 2023 - 09:59:26 EST
On Mon, Aug 14, 2023 at 01:55:17PM +0200, Takashi Iwai wrote:
> This patch converts the mediatek BT SCO driver code to use the new
> unified PCM copy callback. It's a straightforward conversion from
> *_user() to *_iter() variants. As copy_form/to_iter() updates the
> internal offset at each read/write, we can drop the cur_*_idx counter
> in the loop, too.
>
> Note that copy_from/to_iter() returns the copied bytes, hence the
> error condition is inverted from copy_from/to_user().
...
> + if (!copy_to_iter(bt->rx_packet_buf + cur_read_idx,
!= read_size ?
> + read_size, buf)) {
> dev_warn(bt->dev, "%s(), copy_to_user fail\n",
Forgot to fix the message.
> __func__);
> return -EFAULT;
...
> + if (!copy_from_iter(bt->tx_packet_buf + cur_write_idx,
> + write_size, buf)) {
> dev_warn(bt->dev, "%s(), copy_from_user fail\n",
> __func__);
> return -EFAULT;
As per above.
--
With Best Regards,
Andy Shevchenko