From: Oliver Neukum <oneukum@suse.com>
To: wim@linux-watchdog.org, linux@roeck-us.net,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Oliver Neukum <oneukum@suse.com>
Subject: [PATCH 8/8] usb_pcwd: remove superfluous usb_device pointer
Date: Thu, 27 Apr 2023 15:33:50 +0200 [thread overview]
Message-ID: <20230427133350.31064-9-oneukum@suse.com> (raw)
In-Reply-To: <20230427133350.31064-1-oneukum@suse.com>
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 --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 ?
--
2.40.0
next prev parent reply other threads:[~2023-04-27 13:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230427133350.31064-1-oneukum@suse.com>
2023-04-27 13:33 ` [PATCH 1/8] pwcd_usb: fix error handling in probe Oliver Neukum
2023-04-27 13:33 ` [PATCH 2/8] pcwd_usb: stop open race disconnect Oliver Neukum
2023-04-27 13:33 ` [PATCH 3/8] pcwd_usb: usb_pcwd_open handle and return errors Oliver Neukum
2023-04-27 13:33 ` [PATCH 4/8] pcwd_usb: do not leave a freed URB active Oliver Neukum
2023-04-27 13:33 ` [PATCH 5/8] pcwd_usb: usb_pcwd_ioctl: return IO errors Oliver Neukum
2023-04-27 13:33 ` [PATCH 6/8] pcwd_usb: memory ordering of interrupt and waiter Oliver Neukum
2023-04-27 13:33 ` [PATCH 7/8] usb_pcwd: WDIOC_SETTIMEOUT: prevent preemption Oliver Neukum
2023-04-27 13:33 ` Oliver Neukum [this message]
2023-05-13 8:52 ` [PATCH 8/8] usb_pcwd: remove superfluous usb_device pointer Dan Carpenter
2023-04-27 14:12 ` watchdog: pcwd driver updates (was: No subject) Guenter Roeck
2023-04-27 14:19 ` Oliver Neukum
2023-04-27 14:35 ` Guenter Roeck
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=20230427133350.31064-9-oneukum@suse.com \
--to=oneukum@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wim@linux-watchdog.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