All of lore.kernel.org
 help / color / mirror / Atom feed
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 12:28:38 +0100	[thread overview]
Message-ID: <20190220112837.GE2626@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>
> ---

Hi Stanislaw,

testing this series I got the following error:

[    3.448267] mt76x0u 1-1:1.0: ASIC revision: 76100002 MAC revision: 76502000
[    3.451220] INFO: trying to register non-static key.
[    3.452055] the code is fine but needs lockdep annotation.
[    3.452945] turning off the locking correctness validator.
[    3.453590] CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 5.0.0-rc4+ #2963
[    3.454390] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
?-20180724_192412-buildhw-07.phx2.fedoraproject.org-1.fc29 04/01/2014
[    3.455973] Workqueue: usb_hub_wq hub_event
[    3.456642] Call Trace:
[    3.456989]  register_lock_class+0x4fd/0x510
[    3.457619]  ? mark_held_locks+0x4f/0x80
[    3.458172]  __lock_acquire+0x6c/0x1580
[    3.458675]  ? __mt76u_vendor_request+0xc0/0x110
[    3.459302]  ? find_held_lock+0x2d/0x90
[    3.459802]  lock_acquire+0x88/0x120
[    3.460283]  ? mt76u_queues_deinit+0x4e/0x120
[    3.460875]  _raw_spin_lock_bh+0x38/0x80
[    3.461412]  ? mt76u_queues_deinit+0x4e/0x120
[    3.461999]  mt76u_queues_deinit+0x4e/0x120
[    3.462565]  mt76x0u_probe+0x1e6/0x220
[    3.463070]  usb_probe_interface+0xa7/0x1d0
[    3.463639]  ? __driver_attach+0xd0/0xd0
[    3.464167]  really_probe+0xda/0x250
[    3.464754]  ? __driver_attach+0xd0/0xd0
[    3.465285]  bus_for_each_drv+0x66/0x90
[    3.465801]  __device_attach+0xa8/0xe0
[    3.466309]  bus_probe_device+0x9f/0xb0
[    3.466880]  device_add+0x3a2/0x5f0
[    3.467338]  usb_set_configuration+0x471/0x7d0
[    3.467942]  ? __driver_attach+0xd0/0xd0
[    3.468454]  generic_probe+0x48/0x70
[    3.468929]  really_probe+0xda/0x250
[    3.469411]  ? __driver_attach+0xd0/0xd0
[    3.469931]  bus_for_each_drv+0x66/0x90
[    3.470433]  __device_attach+0xa8/0xe0
[    3.470920]  bus_probe_device+0x9f/0xb0
[    3.471420]  device_add+0x3a2/0x5f0
[    3.471875]  usb_new_device+0x193/0x320
[    3.472382]  hub_event+0xbf7/0x1160
[    3.472840]  process_one_work+0x2a4/0x580
[    3.473367]  ? process_one_work+0x580/0x580
[    3.473912]  worker_thread+0x2d/0x3d0
[    3.474390]  ? process_one_work+0x580/0x580
[    3.474940]  kthread+0x115/0x130
[    3.475392]  ? kthread_create_on_node+0x40/0x40
[    3.475968]  ret_from_fork+0x3a/0x50
[    3.476492] mt76x0u: probe of 1-1:1.0 failed with error -12

Regards,
Lorenzo

>  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(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
> index f55dc621e060..45e44bcaa523 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> @@ -729,7 +729,8 @@ static inline u8 q2ep(u8 qid)
>  }
>  
>  static inline int
> -mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int timeout)
> +mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len,
> +	       int timeout)
>  {
>  	struct usb_interface *intf = to_usb_interface(dev->dev);
>  	struct usb_device *udev = interface_to_usbdev(intf);
> @@ -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]);
> +	}
> +
> +	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
> 

  parent reply	other threads:[~2019-02-20 11:28 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 ` [PATCH 1/3] mt76usb: allow mt76u_bulk_msg be used for reads Lorenzo Bianconi
2019-02-20 11:28 ` Lorenzo Bianconi [this message]
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=20190220112837.GE2626@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 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.