From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754810AbdESQrH (ORCPT ); Fri, 19 May 2017 12:47:07 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:51328 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428AbdESQrA (ORCPT ); Fri, 19 May 2017 12:47:00 -0400 Date: Fri, 19 May 2017 17:46:16 +0100 From: Mark Brown To: Stefan Agner Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Message-ID: <20170519164616.a4c3ojkfid6oqnts@sirena.org.uk> References: <20170515080827.22905-1-stefan@agner.ch> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="w3dx5uuztn6fcghj" Content-Disposition: inline In-Reply-To: <20170515080827.22905-1-stefan@agner.ch> X-Cookie: I feel partially hydrogenated! User-Agent: NeoMutt/20170306 (1.8.0) X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH] regmap: add regmap_debugfs_exit as devres action X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --w3dx5uuztn6fcghj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 15, 2017 at 01:08:27AM -0700, Stefan Agner wrote: > Instead of manually cleanup regmap_debugfs_exit, use devres action > to do the cleanup. This also works for external users of > regmap_attach_dev. Why? It's also not clear to me that this will work if something creates a regmap, frees it and then creates another one on the same device without a reprobe. There have been a few devices that did that as part of enumeration of the device, they created a simple regmap to read ID registers then replaced it with a more complete description of the actual device they found. > This fixes warnings when reloading certain drivers making use of > regmap_debugfs_exit: > imx7d-pinctrl 30330000.iomuxc: Failed to create debugfs directory How? (and this should be in the changelog.) > @@ -1215,7 +1216,6 @@ void regmap_exit(struct regmap *map) > struct regmap_async *async; > =20 > regcache_exit(map); > - regmap_debugfs_exit(map); > regmap_range_exit(map); > if (map->bus && map->bus->free_context) > map->bus->free_context(map->bus_context); This isn't obviously correct, it reorders the cleanup such that the debugfs entries will only get removed when the device is removed which means that the debugfs entries will be hanging around after the regmap has been deinstantiated. In the common case where it too was allocated as a managed resource that'll work out but if for some reason it wasn't allocated as as managed resource then the debugfs entry will be dealocated after the regmap. We should also be doing the debugfs cleanup before the regcache cleanup but that's a separate and preexisting bug. --w3dx5uuztn6fcghj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlkfIVgACgkQJNaLcl1U h9B00gf9Hbj+gc6YH5A7a94wL/1isqNVXTV2KxRut1ctzJFuC9snVoedoRyicIk1 Rs5267A2b2iFRD+kuK6OedvpOFIeplGBtQlWEw6lzYDGN/81HFkzYTrc5bnIm85I gLVBclNDvx53zDQA0qWo2uMxDJWsOwjqrLJws9cMVixq3kyuyp38ZcWdW5WjBKBe gCr7Vvb07bSQpGWmFlVwnYeOoPvCTT7nRwp+n0tt6dhVpSRqAX5WTDaveho9u/b8 ENvOfAEnHzZcZq1VnXZUi+bV7UPfl9i5h8n0EM61EbyKt8E3qMGvflQZyCiBd7XF g1LCeSOwUV4eYYLlDduqty9l2rhk7w== =GVNC -----END PGP SIGNATURE----- --w3dx5uuztn6fcghj--