Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094AbdDLHeX (ORCPT ); Wed, 12 Apr 2017 03:34:23 -0400 Received: from mga04.intel.com ([192.55.52.120]:31517 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751212AbdDLHeT (ORCPT ); Wed, 12 Apr 2017 03:34:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,189,1488873600"; d="asc'?scan'208";a="1118494780" From: Felipe Balbi To: Greg KH Cc: Alan Stern , Roger Quadros , vivek.gautam@codeaurora.org, USB list , Kernel development list Subject: Re: [PATCH v3 1/3] usb: udc: allow adding and removing the same gadget device In-Reply-To: <20170412064550.GA6143@kroah.com> References: <87r30zcs95.fsf@linux.intel.com> <20170411141927.GB27233@kroah.com> <87wpaqb1vb.fsf@linux.intel.com> <20170412064550.GA6143@kroah.com> Date: Wed, 12 Apr 2017 10:33:34 +0300 Message-ID: <87fuheaxm9.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: 2127 Lines: 65 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Greg KH writes: >> Here's what we have for most UDCs (net2280.c included): >>=20 >> struct my_udc { >> struct gadget gadget; >> [...] >> }; >>=20 >> probe() >> { >> struct my_udc *u; >>=20 >> u =3D kzalloc(sizeof(*u), GFP_KERNEL); >> [...] >> return 0; >> } >>=20 >> Now, if this kzalloc() would be replaced with devm_kzalloc() wouldn't >> this result on a functionally equivalent execution to the patch I >> proposed above? >>=20 >> Iff we change struct gadget to contain a struct device *dev instead of a >> struct device dev, then sure, we will need to cope with proper >> ->release() implementations. >>=20 >> As it is, it brings nothing to the table, IMO. > > You always have to have a release function for a kobject, no matter > where it is, as it is being reference counted. To not do so, is a huge > indication of a problem in the design. okay, this goes all the way back to when Dave B wrote the API, it has always had empty ->release() functions (not all UDCs, though). I'll make sure to review all of this for v4.13. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAljt2E4ACgkQzL64meEa mQaz+xAAhgn6QuW1BZmINv13MnJPn7PKySsDgc3AY4uz8kK8Hq5y6BrByllzd0y1 oGA4cHsb+WlzFj4zMwoGGiW7BmSPpebSRLTmDaK8oDAgnPRrh9NwP62JBlzCHdjY 6ix4m4rxpeDa/i9qzZvK7hwfsa7IORKeQa1LmHejvegJIdvcRLt2Mjl1G0RPCDLq cxxrks8UsYsGs4wpfTRYriLUAXBMhG1RYszvhDFibPF28cdgaD1/FabPIswh5wMZ /oTNzM9m9s3hNrweaUolvTmR96dRoUe/DNBR+pvYrBceRTlgC+DCLooOjPXjj/wS 8sTA/QOvPjnuDPIN8U9kHxvugphq6jgaEpmieT70LMoc+3b7giKMNMdf/Q4tlEJi lQM1t3XLxjyY5X9YbiTlQRoqSwsLlW0jg5FB2rYCc1okyckCPutiE6SDHjQ7faZh 1NrFyLT5zLFeYMGoi4E3jI+FR6kcffmGogXnHPGBQHaz0y+mXoOE7e4tCwMX3+C7 5JrqjU6re8zzGIs8bA6fNaep8zzWp+aFEM2+Qi6h6Vi2TTgeAt5swDLyJma7wRgS YoMS+DXX0tGHrV6IsY4hYpoz6gZoStr7F5+VFgTRh45hRxX1JaktBX2lvTpQlFkO 99/dapZUNEoHoLp1irAJlLF7uEOxYmAnlVREMFNsuWg4mnrVUXw= =axsa -----END PGP SIGNATURE----- --=-=-=--