From patchwork Tue Jun 12 01:19:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 164298 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 23579B6FC2 for ; Tue, 12 Jun 2012 11:20:28 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753210Ab2FLBUY (ORCPT ); Mon, 11 Jun 2012 21:20:24 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:61786 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753116Ab2FLBUW (ORCPT ); Mon, 11 Jun 2012 21:20:22 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so59162pbb.19 for ; Mon, 11 Jun 2012 18:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=uztaJ6Qa4TEQoOS6ty+e0mXvCKLjTsR407svQMewSCA=; b=UPA3OmTvxWI3x7dMS/sifQ8svjafnGZlfwi8U7MIGS0SGwn+hywyYIa4U93aYEneN2 gENPyNs9J/DJnAgJX/cUktjp9GC2ToA03E04W2pzW0F8SfInCKpqc2euHasnbqLGkTsw pg5J8png0tpa3MOnX63ywx7IYAROCg+idMJA1DvJtl5UaRY7nG2UlvVbgSStpFHjLVVh UivN1KVarXwb/jUsfUHFDnDwFuG13Ww6SVcqny3DAtef52WnZQ4FUb+NooGPNiUtmEHF kDLVLygi98pqKPGZSrHiOZeqhUMWsN92H9YdlKsms/SxiXifbzKXwVi3DAz6eGhgsL9X iSZw== Received: by 10.68.226.102 with SMTP id rr6mr32270565pbc.99.1339464022270; Mon, 11 Jun 2012 18:20:22 -0700 (PDT) Received: from localhost ([183.37.205.112]) by mx.google.com with ESMTPS id wn3sm91512pbc.74.2012.06.11.18.20.15 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jun 2012 18:20:21 -0700 (PDT) From: Ming Lei To: "David S. Miller" , Greg Kroah-Hartman Cc: Oliver Neukum , netdev@vger.kernel.org, linux-usb@vger.kernel.org, Ming Lei Subject: [PATCH 2/7] usbnet:pegasus: remove usb_get/put_dev in .probe and .disconnect Date: Tue, 12 Jun 2012 09:19:40 +0800 Message-Id: <1339463985-9006-3-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1339463985-9006-1-git-send-email-tom.leiming@gmail.com> References: <1339463985-9006-1-git-send-email-tom.leiming@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org usb_device is parent device of usb_interface in the view of driver model, so its reference count is always held during .probe/.disconnect of usb_interface instance. This patch just removes the unnecessay usb_get/put_dev. Signed-off-by: Ming Lei --- drivers/net/usb/pegasus.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index 7023220..a0b5807 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c @@ -1329,8 +1329,6 @@ static int pegasus_probe(struct usb_interface *intf, } pegasus_count++; - usb_get_dev(dev); - net = alloc_etherdev(sizeof(struct pegasus)); if (!net) goto out; @@ -1407,7 +1405,6 @@ out2: out1: free_netdev(net); out: - usb_put_dev(dev); pegasus_dec_workqueue(); return res; } @@ -1425,7 +1422,6 @@ static void pegasus_disconnect(struct usb_interface *intf) pegasus->flags |= PEGASUS_UNPLUG; cancel_delayed_work(&pegasus->carrier_check); unregister_netdev(pegasus->net); - usb_put_dev(interface_to_usbdev(intf)); unlink_all_urbs(pegasus); free_all_urbs(pegasus); free_skb_pool(pegasus);