From patchwork Thu Apr 27 13:33:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 88267 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp273462vqo; Thu, 27 Apr 2023 06:36:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5HR9jQ83me971w/hQO2yDX11U3ZQlHN2JhDKFJ9FqC1KjWyPHy0JJyVX4ELRO8sEQx4859 X-Received: by 2002:aa7:8890:0:b0:63b:85a0:142a with SMTP id z16-20020aa78890000000b0063b85a0142amr2599158pfe.3.1682602597652; Thu, 27 Apr 2023 06:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682602597; cv=none; d=google.com; s=arc-20160816; b=I9uI8b4ulyIN5bA3BlwSa6sLdvTzkQXKTvPdoB0ilCMI7N9dMhJFWpAKTT/bMlBQZf Bt8Qx2UGaSh1hTl0QLJ/q5e5voVua8Vl3LJ6f0NMrfe3l/uSdVs+9xenduZWysrPtTVw y7FTXmeUw5oQ/qkDge+eWIULIAeJZktjnWNHMIzBU3wRFJd0oh56FSEyymJEpKH+iuYZ aRefFSqvnFpOCwEOIDpJegDZRsr3KKtXPXEuYxiNFv4TmwWLiwJo871cflRJmanhKQWK Hb45cLJJ3TAjNixV90DZTxQe8uJAyzpe64vC5r/FE7yqtSLEgY4C+imC8IVo4OAOSG92 JGng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sKRJAQs2Ndqm7IzSMR+A7rxBU8QW8BdAdffC5PULh3w=; b=T7oDfwZcHV0aTkq2GRT4n7PB0jQkaQJcFmCi2F8cAnB8U9NRikVuOmjsUQQ1XDLqrn NB2KOQz8zfEccHi2/xXppLY1T32Fx/LT/cqQLxXbShXtE/FRtQdJv5hRLJV88hSt/Jpj WYIx5XVZOKdwntC/8/9s1Q1L6ovMROjikfst59adY+WI/fcLAlxNSFFBfiSzu05DvFjO xlpMqvN6qvGWuklWbNBO0aR+LX2t06sOK3HTtaJsk/C+MmfVnJtYRzLNsif9yAU6zlqd 40DAolm8AKYwzdt3j4qAvMF06wcu8pkj047MaNXC0/ckancD1r18LJf9cg7r7AnO661x M2oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XloF75Ks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v71-20020a63894a000000b0051a24ba4d74si18137789pgd.837.2023.04.27.06.36.23; Thu, 27 Apr 2023 06:36:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XloF75Ks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243846AbjD0NeW (ORCPT + 99 others); Thu, 27 Apr 2023 09:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243664AbjD0Nd6 (ORCPT ); Thu, 27 Apr 2023 09:33:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A93ACC5; Thu, 27 Apr 2023 06:33:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4757E1FE35; Thu, 27 Apr 2023 13:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1682602436; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sKRJAQs2Ndqm7IzSMR+A7rxBU8QW8BdAdffC5PULh3w=; b=XloF75KsTh3J3orK1J0Om5HGNjp5OUXB5yz7v1zQNFL0Sa5F95PKX5D82vj3eIk0i60ABc 7Wpeb3xUf4nblskvjF0LGbrnvvwwRIjM5voi2GpV2VOGeuGG4/2z5UJuX74xa1w5tecqOc JYSSU/85rftkl1xoTHxkI3YsbqcLeKU= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 01B3E138F9; Thu, 27 Apr 2023 13:33:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mAUPOsN5SmSVeQAAMHmgww (envelope-from ); Thu, 27 Apr 2023 13:33:55 +0000 From: Oliver Neukum To: wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH 8/8] usb_pcwd: remove superfluous usb_device pointer Date: Thu, 27 Apr 2023 15:33:50 +0200 Message-Id: <20230427133350.31064-9-oneukum@suse.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427133350.31064-1-oneukum@suse.com> References: <20230427133350.31064-1-oneukum@suse.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764336701228817775?= X-GMAIL-MSGID: =?utf-8?q?1764336701228817775?= Retrieve the device from the interface Signed-off-by: Oliver Neukum --- 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 ?