stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Lorenzo Bianconi <lorenzo@kernel.org>,
	Zero_Chaos <sidhayn@gmail.com>, Felix Fietkau <nbd@nbd.name>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.4 090/102] mt76: mt76u: rely on usb_interface instead of usb_dev
Date: Fri, 24 Jan 2020 10:31:31 +0100	[thread overview]
Message-ID: <20200124092820.243720702@linuxfoundation.org> (raw)
In-Reply-To: <20200124092806.004582306@linuxfoundation.org>

From: Lorenzo Bianconi <lorenzo@kernel.org>

[ Upstream commit 80df01f4dc79abbed724bbe0851cab3fe8ad9d99 ]

usb drivers are supposed to communicate using usb_interface instead
mt76x{0,2}u is now registering through usb_device. Fix it by passing
usb_intf device to mt76_alloc_device routine.

Fixes: 112f980ac8926 ("mt76usb: use usb_dev private data")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-By: Zero_Chaos <sidhayn@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt76.h       |  3 ++-
 drivers/net/wireless/mediatek/mt76/mt76x0/usb.c |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76x2/usb.c |  2 +-
 drivers/net/wireless/mediatek/mt76/usb.c        | 12 +++++++++---
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 653cdcbaaea91..502814c26b33d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -799,7 +799,8 @@ static inline int
 mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len,
 	       int timeout)
 {
-	struct usb_device *udev = to_usb_device(dev->dev);
+	struct usb_interface *uintf = to_usb_interface(dev->dev);
+	struct usb_device *udev = interface_to_usbdev(uintf);
 	struct mt76_usb *usb = &dev->usb;
 	unsigned int pipe;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
index 00a445d275998..65d404e614040 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
@@ -226,7 +226,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
 	u32 mac_rev;
 	int ret;
 
-	mdev = mt76_alloc_device(&usb_dev->dev, sizeof(*dev), &mt76x0u_ops,
+	mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), &mt76x0u_ops,
 				 &drv_ops);
 	if (!mdev)
 		return -ENOMEM;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
index da5e0f9a8baeb..8b26c61081868 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
@@ -39,7 +39,7 @@ static int mt76x2u_probe(struct usb_interface *intf,
 	struct mt76_dev *mdev;
 	int err;
 
-	mdev = mt76_alloc_device(&udev->dev, sizeof(*dev), &mt76x2u_ops,
+	mdev = mt76_alloc_device(&intf->dev, sizeof(*dev), &mt76x2u_ops,
 				 &drv_ops);
 	if (!mdev)
 		return -ENOMEM;
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 20c6fe510e9db..05aa42bd98083 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -20,7 +20,8 @@ static int __mt76u_vendor_request(struct mt76_dev *dev, u8 req,
 				  u8 req_type, u16 val, u16 offset,
 				  void *buf, size_t len)
 {
-	struct usb_device *udev = to_usb_device(dev->dev);
+	struct usb_interface *uintf = to_usb_interface(dev->dev);
+	struct usb_device *udev = interface_to_usbdev(uintf);
 	unsigned int pipe;
 	int i, ret;
 
@@ -235,7 +236,8 @@ mt76u_rd_rp(struct mt76_dev *dev, u32 base,
 
 static bool mt76u_check_sg(struct mt76_dev *dev)
 {
-	struct usb_device *udev = to_usb_device(dev->dev);
+	struct usb_interface *uintf = to_usb_interface(dev->dev);
+	struct usb_device *udev = interface_to_usbdev(uintf);
 
 	return (!disable_usb_sg && udev->bus->sg_tablesize > 0 &&
 		(udev->bus->no_sg_constraint ||
@@ -370,7 +372,8 @@ mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index,
 		    struct urb *urb, usb_complete_t complete_fn,
 		    void *context)
 {
-	struct usb_device *udev = to_usb_device(dev->dev);
+	struct usb_interface *uintf = to_usb_interface(dev->dev);
+	struct usb_device *udev = interface_to_usbdev(uintf);
 	unsigned int pipe;
 
 	if (dir == USB_DIR_IN)
@@ -952,6 +955,7 @@ int mt76u_init(struct mt76_dev *dev,
 		.rd_rp = mt76u_rd_rp,
 		.type = MT76_BUS_USB,
 	};
+	struct usb_device *udev = interface_to_usbdev(intf);
 	struct mt76_usb *usb = &dev->usb;
 
 	tasklet_init(&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long)dev);
@@ -965,6 +969,8 @@ int mt76u_init(struct mt76_dev *dev,
 	dev->bus = &mt76u_ops;
 	dev->queue_ops = &usb_queue_ops;
 
+	dev_set_drvdata(&udev->dev, dev);
+
 	usb->sg_en = mt76u_check_sg(dev);
 
 	return mt76u_set_endpoints(intf, usb);
-- 
2.20.1




  parent reply	other threads:[~2020-01-24  9:43 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24  9:30 [PATCH 5.4 000/102] 5.4.15-stable review Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 001/102] drm/i915: Fix pid leak with banned clients Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 002/102] libbpf: Fix compatibility for kernels without need_wakeup Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 003/102] libbpf: Fix memory leak/double free issue Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 004/102] libbpf: Fix potential overflow issue Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 005/102] libbpf: Fix another potential overflow issue in bpf_prog_linfo Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 006/102] libbpf: Make btf__resolve_size logic always check size error condition Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 007/102] libbpf: Fix call relocation offset calculation bug Greg Kroah-Hartman
2020-01-24 13:43   ` Naresh Kamboju
2020-01-24 15:18     ` Sasha Levin
2020-01-24  9:30 ` [PATCH 5.4 008/102] bpf: Force .BTF section start to zero when dumping from vmlinux Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 009/102] samples: bpf: update map definition to new syntax BTF-defined map Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 010/102] samples/bpf: Fix broken xdp_rxq_info due to map order assumptions Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 011/102] ARM: dts: logicpd-torpedo-37xx-devkit-28: Reference new DRM panel Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 012/102] ARM: OMAP2+: Add missing put_device() call in omapdss_init_of() Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 013/102] xfs: Sanity check flags of Q_XQUOTARM call Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 014/102] i2c: stm32f7: rework slave_id allocation Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 015/102] i2c: i2c-stm32f7: fix 10-bits check in slave free id search loop Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 016/102] mfd: intel-lpss: Add default I2C device properties for Gemini Lake Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 017/102] SUNRPC: Fix svcauth_gss_proxy_init() Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 018/102] SUNRPC: Fix backchannel latency metrics Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 019/102] powerpc/security: Fix debugfs data leak on 32-bit Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 020/102] powerpc/pseries: Enable support for ibm,drc-info property Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 021/102] powerpc/kasan: Fix boot failure with RELOCATABLE && FSL_BOOKE Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 022/102] powerpc/archrandom: fix arch_get_random_seed_int() Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 023/102] tipc: reduce sensitive to retransmit failures Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 024/102] tipc: update mons self addr when node addr generated Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 025/102] tipc: fix potential memory leak in __tipc_sendmsg() Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 026/102] tipc: fix wrong socket reference counter after tipc_sk_timeout() returns Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 027/102] tipc: fix wrong timeout input for tipc_wait_for_cond() Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 028/102] net/mlx5e: Fix free peer_flow when refcount is 0 Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 029/102] phy: lantiq: vrx200-pcie: fix error return code in ltq_vrx200_pcie_phy_power_on() Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 030/102] net: phy: broadcom: Fix RGMII delays configuration for BCM54210E Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 031/102] phy: ti: gmii-sel: fix mac tx internal delay for rgmii-rxid Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 032/102] mt76: mt76u: fix endpoint definition order Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 033/102] mt7601u: fix bbp version check in mt7601u_wait_bbp_ready Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 034/102] ice: fix stack leakage Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 035/102] s390/pkey: fix memory leak within _copy_apqns_from_user() Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 036/102] nfsd: depend on CRYPTO_MD5 for legacy client tracking Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 037/102] crypto: amcc - restore CRYPTO_AES dependency Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 038/102] crypto: sun4i-ss - fix big endian issues Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 039/102] perf map: No need to adjust the long name of modules Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 040/102] leds: tlc591xx: update the maximum brightness Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 041/102] soc/tegra: pmc: Fix crashes for hierarchical interrupts Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 042/102] soc: qcom: llcc: Name regmaps to avoid collisions Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 043/102] soc: renesas: Add missing check for non-zero product register address Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 044/102] soc: aspeed: Fix snoop_file_poll()s return type Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 045/102] watchdog: sprd: Fix the incorrect pointer getting from driver data Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 046/102] ipmi: Fix memory leak in __ipmi_bmc_register Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 047/102] sched/core: Further clarify sched_class::set_next_task() Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 048/102] gpiolib: No need to call gpiochip_remove_pin_ranges() twice Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 049/102] rtw88: fix beaconing mode rsvd_page memory violation issue Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 050/102] rtw88: fix error handling when setup efuse info Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 051/102] drm/panfrost: Add missing check for pfdev->regulator Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 052/102] drm: panel-lvds: Potential Oops in probe error handling Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 053/102] drm/amdgpu: remove excess function parameter description Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 054/102] hwrng: omap3-rom - Fix missing clock by probing with device tree Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 055/102] dpaa2-eth: Fix minor bug in ethtool stats reporting Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 056/102] drm/rockchip: Round up _before_ giving to the clock framework Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 057/102] software node: Get reference to parent swnode in get_parent op Greg Kroah-Hartman
2020-01-24  9:30 ` [PATCH 5.4 058/102] PCI: mobiveil: Fix csr_read()/write() build issue Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 059/102] drm: rcar_lvds: Fix color mismatches on R-Car H2 ES2.0 and later Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 060/102] net: netsec: Correct dma sync for XDP_TX frames Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 061/102] ACPI: platform: Unregister stale platform devices Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 062/102] pwm: sun4i: Fix incorrect calculation of duty_cycle/period Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 063/102] regulator: bd70528: Add MODULE_ALIAS to allow module auto loading Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 064/102] drm/amdgpu/vi: silence an uninitialized variable warning Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 065/102] power: supply: bd70528: Add MODULE_ALIAS to allow module auto loading Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 066/102] firmware: imx: Remove call to devm_of_platform_populate Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 067/102] libbpf: Dont use kernel-side u32 type in xsk.c Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 068/102] rcu: Fix uninitialized variable in nocb_gp_wait() Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 069/102] dpaa_eth: perform DMA unmapping before read Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 070/102] dpaa_eth: avoid timestamp read on error paths Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 071/102] scsi: ufs: delete redundant function ufshcd_def_desc_sizes() Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 072/102] net: openvswitch: dont unlock mutex when changing the user_features fails Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 073/102] hv_netvsc: flag software created hash value Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 074/102] rt2800: remove errornous duplicate condition Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 075/102] net: neigh: use long type to store jiffies delta Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 076/102] net: axienet: Fix error return code in axienet_probe() Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 077/102] selftests: gen_kselftest_tar.sh: Do not clobber kselftest/ Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 078/102] rtc: bd70528: fix module alias to autoload module Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 079/102] packet: fix data-race in fanout_flow_is_huge() Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 080/102] i2c: stm32f7: report dma error during probe Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 081/102] kselftests: cgroup: Avoid the reuse of fd after it is deallocated Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 082/102] firmware: arm_scmi: Fix doorbell ring logic for !CONFIG_64BIT Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 083/102] mmc: sdio: fix wl1251 vendor id Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 084/102] mmc: core: fix wl1251 sdio quirks Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 085/102] tee: optee: Fix dynamic shm pool allocations Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 086/102] tee: optee: fix device enumeration error handling Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 087/102] workqueue: Add RCU annotation for pwq list walk Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 088/102] SUNRPC: Fix another issue with MIC buffer space Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 089/102] sched/cpufreq: Move the cfs_rq_util_change() call to cpufreq_update_util() Greg Kroah-Hartman
2020-01-24  9:31 ` Greg Kroah-Hartman [this message]
2020-01-24  9:31 ` [PATCH 5.4 091/102] dma-direct: dont check swiotlb=force in dma_direct_map_resource Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 092/102] afs: Remove set but not used variables before, after Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 093/102] dmaengine: ti: edma: fix missed failure handling Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 094/102] drm/radeon: fix bad DMA from INTERRUPT_CNTL2 Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 095/102] xdp: Fix cleanup on map free for devmap_hash map type Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 096/102] platform/chrome: wilco_ec: fix use after free issue Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 097/102] block: fix memleak of bio integrity data Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 098/102] s390/qeth: fix dangling IO buffers after halt/clear Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 099/102] net-sysfs: Call dev_hold always in netdev_queue_add_kobject Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 100/102] gpio: aspeed: avoid return type warning Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 101/102] phy/rockchip: inno-hdmi: round clock rate down to closest 1000 Hz Greg Kroah-Hartman
2020-01-24  9:31 ` [PATCH 5.4 102/102] optee: Fix multi page dynamic shm pool alloc Greg Kroah-Hartman
2020-01-24 13:47 ` [PATCH 5.4 000/102] 5.4.15-stable review Naresh Kamboju
2020-01-24 14:52 ` Jon Hunter
2020-01-24 21:46 ` shuah
2020-01-25 13:51   ` Greg Kroah-Hartman
2020-01-24 23:56 ` Guenter Roeck
2020-01-25 13:52   ` Greg Kroah-Hartman
2020-01-25 10:22 ` Naresh Kamboju
2020-01-25 13:52   ` Greg Kroah-Hartman

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=20200124092820.243720702@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=sashal@kernel.org \
    --cc=sidhayn@gmail.com \
    --cc=stable@vger.kernel.org \
    /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).