Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752863AbdDDHnb (ORCPT ); Tue, 4 Apr 2017 03:43:31 -0400 Received: from mga09.intel.com ([134.134.136.24]:36184 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752692AbdDDHna (ORCPT ); Tue, 4 Apr 2017 03:43:30 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,274,1486454400"; d="asc'?scan'208";a="1130615011" From: Felipe Balbi To: "Gustavo A. R. Silva" , Alan Stern , Greg Kroah-Hartman , Peter Chen , Chunfeng Yun , Mathias Nyman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Senna Tschudin , "Gustavo A. R. Silva" Subject: Re: [PATCH 2/2] usb: misc: refactor code In-Reply-To: <20170403195042.GA12225@embeddedgus> References: <20170403195042.GA12225@embeddedgus> Date: Tue, 04 Apr 2017 10:43:13 +0300 Message-ID: <87fuhoipny.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3199 Lines: 103 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, "Gustavo A. R. Silva" writes: > Code refactoring to make the flow easier to follow. > > Cc: Alan Stern > Cc: Greg Kroah-Hartman > Signed-off-by: Gustavo A. R. Silva > --- > drivers/usb/misc/usbtest.c | 67 +++++++++++++++++++++-------------------= ------ > 1 file changed, 30 insertions(+), 37 deletions(-) > > diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c > index 7bfb6b78..382491e 100644 > --- a/drivers/usb/misc/usbtest.c > +++ b/drivers/usb/misc/usbtest.c > @@ -124,18 +124,32 @@ static struct usb_device *testdev_to_usbdev(struct = usbtest_dev *test) >=20=20 > /*----------------------------------------------------------------------= ---*/ >=20=20 > +static inline void endpoint_update(int edi, > + struct usb_host_endpoint **in, > + struct usb_host_endpoint **out, > + struct usb_host_endpoint *e) > +{ > + if (edi) { > + if (!*in) > + *in =3D e; > + } else { > + if (!*out) > + *out =3D e; > + } > +} > + > static int > get_endpoints(struct usbtest_dev *dev, struct usb_interface *intf) > { > - int tmp; > - struct usb_host_interface *alt; > - struct usb_host_endpoint *in, *out; > - struct usb_host_endpoint *iso_in, *iso_out; > - struct usb_host_endpoint *int_in, *int_out; > - struct usb_device *udev; > + int tmp; > + struct usb_host_interface *alt; > + struct usb_host_endpoint *in, *out; > + struct usb_host_endpoint *iso_in, *iso_out; > + struct usb_host_endpoint *int_in, *int_out; > + struct usb_device *udev; unnecessary change >=20=20 > for (tmp =3D 0; tmp < intf->num_altsetting; tmp++) { > - unsigned ep; > + unsigned ep; unnecessary change >=20=20 > in =3D out =3D NULL; > iso_in =3D iso_out =3D NULL; > @@ -150,48 +164,27 @@ get_endpoints(struct usbtest_dev *dev, struct usb_i= nterface *intf) > * ignore other endpoints and altsettings. > */ > for (ep =3D 0; ep < alt->desc.bNumEndpoints; ep++) { > - struct usb_host_endpoint *e; > + struct usb_host_endpoint *e; unnecessary change =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAljjTpEACgkQzL64meEa mQZHQw//Vl/Up1zRBHtDOvGMiIvJcxlzp9VSXI5JyCKiVkq1H3fZKCz4jl7+sJ9U NCmJtCMebuPfZub5zixPR9YMyJpcyyKAyp2Dq8K97um0DdPOSB6mMoBDN1EUAecN 6MtkRKDLyHWQNwKL8mb48MJ5m2ANFiAfew19US9o1+Wyt+91NG02ZArD62Pp82+A mJnhkZhrzr4axOLedof+xcLjrAOYHWd74moScnJtK6j9EOfUjmEsS4SG/I0hLjIp GX3p34N6laWzSFFqDvqyegByD+QYW9UOlw0q3KFGkKjUrjanIyTi/v29IQBedcSM PKSAZfs9LTI2YTTc9Ldy9rnBqABJ1GG3+jhhcA6cVzv7+Gr1WL5adtnZLI+SUJZ/ BMdx0cY7Pb9St4yOk2xW0ThsOtJ11XXbrVB3vFHAMhmW+5fIyHY1ihwB6IDtACVr ExcsVZFrClP1tC9lzbAORiCV/M0gDHoZFEtY1pOifi/lGDXToguyu2GIhOx9tWCt ezjSOrHvYQ5cQIg5hVDz9zz+YvcbVEVk7Oe+cVgDaPxNMfmKEw/VUrWgDhkj8Aw5 HRzNOceyZx7NBX479xI3M31uUf2UrMQmgW3pe+Um4GNKNOhDEcvioc2OYpyfnTqF ztg9Qu1TwyAKMl2cyiVVZa37rEGiAFgLWExM2r23ELIh5x3sj3E= =A/uj -----END PGP SIGNATURE----- --=-=-=--