From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Felix Fietkau <nbd@nbd.name>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 1/3] mt76usb: allow mt76u_bulk_msg be used for reads
Date: Wed, 20 Feb 2019 11:31:37 +0100 [thread overview]
Message-ID: <20190220103136.GB2626@localhost.localdomain> (raw)
In-Reply-To: <1550657565-7263-1-git-send-email-sgruszka@redhat.com>
> Extend mt76u_bulk_msg() such it can be used for synchronous bulk reads.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> drivers/net/wireless/mediatek/mt76/mt76.h | 13 ++++++++++---
> drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c | 4 ++--
> 2 files changed, 12 insertions(+), 5 deletions(-)
>
[...]
> @@ -737,8 +738,14 @@ mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int timeout)
> unsigned int pipe;
> int sent;
>
> - pipe = usb_sndbulkpipe(udev, usb->out_ep[MT_EP_OUT_INBAND_CMD]);
> - return usb_bulk_msg(udev, pipe, data, len, &sent, timeout);
> + if (actual_len) {
> + pipe = usb_rcvbulkpipe(udev, usb->in_ep[MT_EP_IN_CMD_RESP]);
> + } else {
> + actual_len = &sent;
> + pipe = usb_sndbulkpipe(udev, usb->out_ep[MT_EP_OUT_INBAND_CMD]);
Hi Stanislaw,
I guess you can drop sent here since even if actual_len is NULL it will be managed
by usb_start_wait_urb()
Regards,
Lorenzo
> + }
> +
> + return usb_bulk_msg(udev, pipe, data, len, actual_len, timeout);
> }
>
> int mt76u_vendor_request(struct mt76_dev *dev, u8 req,
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
> index e469e383cb88..f497c8e4332a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
> @@ -126,7 +126,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
> if (ret)
> return ret;
>
> - ret = mt76u_bulk_msg(dev, skb->data, skb->len, 500);
> + ret = mt76u_bulk_msg(dev, skb->data, skb->len, NULL, 500);
> if (ret)
> return ret;
>
> @@ -271,7 +271,7 @@ __mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, u8 *data,
>
> data_len = MT_CMD_HDR_LEN + len + sizeof(info);
>
> - err = mt76u_bulk_msg(&dev->mt76, data, data_len, 1000);
> + err = mt76u_bulk_msg(&dev->mt76, data, data_len, NULL, 1000);
> if (err) {
> dev_err(dev->mt76.dev, "firmware upload failed: %d\n", err);
> return err;
> --
> 2.7.5
>
next prev parent reply other threads:[~2019-02-20 10:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 10:12 [PATCH 1/3] mt76usb: allow mt76u_bulk_msg be used for reads Stanislaw Gruszka
2019-02-20 10:12 ` [PATCH 2/3] mt76usb: use synchronous msg for mcu command responses Stanislaw Gruszka
2019-02-20 10:38 ` Lorenzo Bianconi
2019-02-20 10:12 ` [PATCH 3/3] mt76usb: remove usb_mcu.c Stanislaw Gruszka
2019-02-20 10:41 ` Lorenzo Bianconi
2019-02-20 10:31 ` Lorenzo Bianconi [this message]
2019-02-20 11:28 ` [PATCH 1/3] mt76usb: allow mt76u_bulk_msg be used for reads Lorenzo Bianconi
2019-02-20 12:01 ` Stanislaw Gruszka
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=20190220103136.GB2626@localhost.localdomain \
--to=lorenzo.bianconi@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
--cc=sgruszka@redhat.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 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).