From patchwork Tue Apr 17 07:27:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Majewski?= X-Patchwork-Id: 153067 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id B4C0DB7022 for ; Tue, 17 Apr 2012 17:28:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7998C2805F; Tue, 17 Apr 2012 09:27:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6o9lxFhVjiQQ; Tue, 17 Apr 2012 09:27:57 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 33FE62807E; Tue, 17 Apr 2012 09:27:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 274442807F for ; Tue, 17 Apr 2012 09:27:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fXQUBvG9M4Ai for ; Tue, 17 Apr 2012 09:27:52 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by theia.denx.de (Postfix) with ESMTP id 0F4CA2807D for ; Tue, 17 Apr 2012 09:27:50 +0200 (CEST) Received: from euspt1 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0M2M00C0N4OB7Z@mailout1.w1.samsung.com> for u-boot@lists.denx.de; Tue, 17 Apr 2012 08:26:35 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M2M00KZJ4QB50@spt1.w1.samsung.com> for u-boot@lists.denx.de; Tue, 17 Apr 2012 08:27:47 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 5463E270053; Tue, 17 Apr 2012 09:39:54 +0200 (CEST) Date: Tue, 17 Apr 2012 09:27:43 +0200 From: Lukasz Majewski In-reply-to: <1334647664-30422-1-git-send-email-l.majewski@samsung.com> To: u-boot@lists.denx.de Message-id: <1334647664-30422-3-git-send-email-l.majewski@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.9.1 References: <1334214931-19480-1-git-send-email-l.majewski@samsung.com> <1334647664-30422-1-git-send-email-l.majewski@samsung.com> Cc: Marek Vasut , Kyungmin Park Subject: [U-Boot] [PATCH v2 2/3] usb:gadget:composite: Support for composite at gadget.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add device data pointer to the USB gadget's device struct. Wrapper for extracting usb_gadget from Linux's usb device Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Cc: Marek Vasut --- Changes for v2: - Two separate patches regarding gadget.h file squashed together --- include/linux/usb/gadget.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 275cb5f..eba865e 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -411,6 +411,7 @@ struct usb_gadget_ops { struct device { void *driver_data; /* data private to the driver */ + void *device_data; /* data private to the device */ }; /** @@ -481,6 +482,11 @@ static inline void *get_gadget_data(struct usb_gadget *gadget) return gadget->dev.driver_data; } +static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev) +{ + return container_of(dev, struct usb_gadget, dev); +} + /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ #define gadget_for_each_ep(tmp, gadget) \ list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)