Search Linux Wireless

Re: [PATCH 1/3] mt76usb: allow mt76u_bulk_msg be used for reads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Extend mt76u_bulk_msg() such it can be used for synchronous bulk reads.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@xxxxxxxxxx>
> ---

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
> 



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux