From patchwork Mon Apr 3 12:20:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 96624 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp72323qgd; Mon, 3 Apr 2017 05:20:44 -0700 (PDT) X-Received: by 10.99.140.70 with SMTP id q6mr17822892pgn.222.1491222044806; Mon, 03 Apr 2017 05:20:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si14147694pln.333.2017.04.03.05.20.44; Mon, 03 Apr 2017 05:20:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752970AbdDCMUn (ORCPT + 25 others); Mon, 3 Apr 2017 08:20:43 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:16440 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbdDCMUl (ORCPT ); Mon, 3 Apr 2017 08:20:41 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v33CKbPS032322; Mon, 3 Apr 2017 07:20:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1491222038; bh=o9ESdBus2LqZKmRJRetIS8RMnmOwiGHE1hCk2ogJBkw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OHmhg+dON0tyS2lfX00Tc1GKgZfCGwZVZwYBG2NMrRcd1vfV/lIHpRqL/fMSncLKR R5Jm6ItHqlmH5lIbf6F5FQAtlLoOK1DeDYaqzZg6LJ4HBOWZX/Ei1R2f3IjZRtRFUd QTeHFndrjjRyogDOJMFaSQ7lB5jTB4n2DBSEDQn8= Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v33CKbx8030640; Mon, 3 Apr 2017 07:20:37 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Mon, 3 Apr 2017 07:20:37 -0500 Received: from lta0400828d.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v33CKXuq010968; Mon, 3 Apr 2017 07:20:36 -0500 From: Roger Quadros To: CC: , , , Roger Quadros Subject: [PATCH v3 1/3] usb: udc: allow adding and removing the same gadget device Date: Mon, 3 Apr 2017 15:20:29 +0300 Message-ID: <1491222031-18120-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491222031-18120-1-git-send-email-rogerq@ti.com> References: <1491222031-18120-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org allow usb_del_gadget_udc() and usb add_gadget_udc() to be called repeatedly on the same gadget->dev structure. We need to clear the gadget->dev structure so that kobject_init() doesn't complain about already initialized object. Signed-off-by: Roger Quadros --- drivers/usb/gadget/udc/core.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index d685d82..efce68e 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1273,6 +1273,7 @@ void usb_del_gadget_udc(struct usb_gadget *gadget) flush_work(&gadget->work); device_unregister(&udc->dev); device_unregister(&gadget->dev); + memset(&gadget->dev, 0x00, sizeof(gadget->dev)); } EXPORT_SYMBOL_GPL(usb_del_gadget_udc);