diff mbox series

[8/8] usb_pcwd: remove superfluous usb_device pointer

Message ID 20230427133350.31064-9-oneukum@suse.com
State New
Headers show
Series [1/8] pwcd_usb: fix error handling in probe | expand

Commit Message

Oliver Neukum April 27, 2023, 1:33 p.m. UTC
Retrieve the device from the interface

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/watchdog/pcwd_usb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 09cae7a6ad07..055acc191af9 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -112,8 +112,6 @@  static char expect_release;
 
 /* Structure to hold all of our device specific stuff */
 struct usb_pcwd_private {
-	/* save off the usb device pointer */
-	struct usb_device	*udev;
 	/* the interface for this device */
 	struct usb_interface	*interface;
 
@@ -210,6 +208,7 @@  static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,
 {
 	int got_response, count;
 	unsigned char *buf;
+	struct usb_device *udev = interface_to_usbdev(usb_pcwd->interface);
 
 	/* We will not send any commands if the USB PCWD device does
 	 * not exist */
@@ -233,7 +232,7 @@  static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,
 
 	atomic_set(&usb_pcwd->cmd_received, 0);
 
-	if (usb_control_msg(usb_pcwd->udev, usb_sndctrlpipe(usb_pcwd->udev, 0),
+	if (usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 			HID_REQ_SET_REPORT, HID_DT_REPORT,
 			0x0200, usb_pcwd->interface_number, buf, 6,
 			USB_COMMAND_TIMEOUT) != 6) {
@@ -625,8 +624,10 @@  static struct notifier_block usb_pcwd_notifier = {
  */
 static inline void usb_pcwd_delete(struct usb_pcwd_private *usb_pcwd)
 {
+	struct usb_device *udev = interface_to_usbdev(usb_pcwd->interface);
+
 	usb_free_urb(usb_pcwd->intr_urb);
-	usb_free_coherent(usb_pcwd->udev, usb_pcwd->intr_size,
+	usb_free_coherent(udev, usb_pcwd->intr_size,
 			  usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
 	kfree(usb_pcwd);
 }
@@ -691,7 +692,6 @@  static int usb_pcwd_probe(struct usb_interface *interface,
 	usb_pcwd_device = usb_pcwd;
 
 	mutex_init(&usb_pcwd->mtx);
-	usb_pcwd->udev = udev;
 	usb_pcwd->interface = interface;
 	usb_pcwd->interface_number = iface_desc->desc.bInterfaceNumber;
 	usb_pcwd->intr_size = (le16_to_cpu(endpoint->wMaxPacketSize) > 8 ?