From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425269AbcBRIMK (ORCPT ); Thu, 18 Feb 2016 03:12:10 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:34101 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424994AbcBRIMI (ORCPT ); Thu, 18 Feb 2016 03:12:08 -0500 From: Felipe Balbi X-Google-Original-From: Felipe Balbi To: Marek Szyprowski , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Ruslan Bilovol , Bartlomiej Zolnierkiewicz , Vegard Nossum , Maxime Ripard , Greg Kroah-Hartman , Peter Chen , Felipe Balbi Subject: Re: [PATCH v2 RESEND] usb: gadget: provide interface for legacy gadgets to get UDC name In-Reply-To: <1455782337-4713-1-git-send-email-m.szyprowski@samsung.com> References: <56B7D2C9.5070301@oracle.com> <1455782337-4713-1-git-send-email-m.szyprowski@samsung.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/25.0.50.2 (x86_64-pc-linux-gnu) Date: Thu, 18 Feb 2016 10:11:56 +0200 Message-ID: <87ziuyqvxv.fsf@ti.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Marek Szyprowski writes: > Since commit 855ed04a3758b205e84b269f92d26ab36ed8e2f7 ("usb: gadget: > udc-core: independent registration of gadgets and gadget drivers") gadget > drivers can not assume that UDC drivers are already available on their > initialization. This broke the HACK, which was used in gadgetfs driver, > to get UDC controller name. This patch removes this hack and replaces it > by additional function in the UDC core (which is usefully only for legacy > drivers, please don't use it in the new code). > > Reported-by: Vegard Nossum > Signed-off-by: Marek Szyprowski > Tested-by: Vegard Nossum > --- > changelog: > v2: > - properly report udc gagdet driver name instead of udc device name > > v1: https://lkml.org/lkml/2016/2/8/176 > - initial version > --- > drivers/usb/gadget/legacy/inode.c | 29 ++--------------------------- > drivers/usb/gadget/udc/udc-core.c | 33 +++++++++++++++++++++++++++++++++ > include/linux/usb/gadget.h | 1 + > 3 files changed, 36 insertions(+), 27 deletions(-) > > diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legac= y/inode.c > index 7e179f81d05c..7a62a2f7bc18 100644 > --- a/drivers/usb/gadget/legacy/inode.c > +++ b/drivers/usb/gadget/legacy/inode.c > @@ -227,7 +227,7 @@ static void put_ep (struct ep_data *data) > * implicitly, starting with the driver name and then endpoint names. > */ >=20=20 > -static const char *CHIP; > +static char CHIP[32]; >=20=20 > /*----------------------------------------------------------------------= */ >=20=20 > @@ -1697,28 +1697,6 @@ static struct usb_gadget_driver gadgetfs_driver = =3D { > }; >=20=20 > /*----------------------------------------------------------------------= */ > - > -static void gadgetfs_nop(struct usb_gadget *arg) { } > - > -static int gadgetfs_probe(struct usb_gadget *gadget, > - struct usb_gadget_driver *driver) > -{ > - CHIP =3D gadget->name; > - return -EISNAM; > -} > - > -static struct usb_gadget_driver probe_driver =3D { > - .max_speed =3D USB_SPEED_HIGH, > - .bind =3D gadgetfs_probe, > - .unbind =3D gadgetfs_nop, > - .setup =3D (void *)gadgetfs_nop, > - .disconnect =3D gadgetfs_nop, > - .driver =3D { > - .name =3D "nop", > - }, > -}; > - > - > /* DEVICE INITIALIZATION > * > * fd =3D open ("/dev/gadget/$CHIP", O_RDWR) > @@ -1968,10 +1946,7 @@ gadgetfs_fill_super (struct super_block *sb, void = *opts, int silent) > if (the_device) > return -ESRCH; >=20=20 > - /* fake probe to determine $CHIP */ > - CHIP =3D NULL; > - usb_gadget_probe_driver(&probe_driver); > - if (!CHIP) > + if (usb_get_gadget_udc_name(CHIP, sizeof(CHIP)) !=3D 0) > return -ENODEV; >=20=20 > /* superblock */ > diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/u= dc-core.c > index fd73a3ea07c2..4bde2e110e44 100644 > --- a/drivers/usb/gadget/udc/udc-core.c > +++ b/drivers/usb/gadget/udc/udc-core.c > @@ -442,6 +442,39 @@ err1: > EXPORT_SYMBOL_GPL(usb_add_gadget_udc_release); >=20=20 > /** > + * usb_get_gadget_udc_name - get the name of the first UDC controller > + * @dst_name > + * @len gotta describe these and add a blank line after @len too. This also seems a little too big for -rc. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWxXzMAAoJEIaOsuA1yqREQHwP/jqI1HO1NX/7mxT+NYITKj0S DPIN1WgRy1QZ4fsgl9ZQ6nnyp7U4D14B+/T+68IRztsPHajfQ4wb2/huwYZFepSl fw1CE77AZ1P7Km5r0QB25Uox729BBTfhH9kuQlDQ+7ZqcWIzMCcvGUwMNJC65YXp aNSEqK+f5dIj8DrbMjOSUOPr53oZOZQl5zaTGWSLiuJv1BMCdFi2733WSsHSZril lT0eK1mJfnkMazMUBdLEG7MtN/sRxrQ9dWYrpSDtkI6XXeVbau6NLnJFsm0iKlf/ iIlvkTlXGuyo/ffCqeTAi1qJ9me6GGPBolqp4/lv+kSKFnzH/ky1TZKZMmnuIftH 0xV/M9K+gCc0NLQoii9Ea3OqUWs0eksfvkjk8ec2cAzD8JDZ3qUv0uHcOzthCPPo G26ks4jrmJRwcXAqq+6Z+IttcsqO2jmhY2pInT+sECB7lDvlAqcn4v7FDS3mFG+m 48Cr1+p4XKT0SlDtbL4yJ0DWucPWUO8F/l0l0Uj+H8szJwFRE7kzcw8A2JYRiS92 KWp4qlioOUalznXrV4NVgb8aLYlJ1U0fCtS/mbcIhcCMQf+cU8uCoOJCDdzMwru4 C/6DzE2pDN1APIf0DfmNaQylKowrq5P8IKSBbqTdSl4Hh4L0yAnw1TJSJhQ5zIWx ibVNOPmGImzImxdHU9EB =0pZ7 -----END PGP SIGNATURE----- --=-=-=--