From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH RFC] drm/bridge: panel: Add module_get/but calls to attached panel driver Date: Tue, 20 Feb 2018 11:34:53 +0100 Message-ID: <20180220103453.GH23425@ulmo> References: <1519070782-20834-1-git-send-email-jsarha@ti.com> <20180219225923.GG22199@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1308977746==" Return-path: Received: from mail-qk0-x231.google.com (mail-qk0-x231.google.com [IPv6:2607:f8b0:400d:c09::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1ED5B6E388 for ; Tue, 20 Feb 2018 10:34:57 +0000 (UTC) Received: by mail-qk0-x231.google.com with SMTP id y137so9658728qka.4 for ; Tue, 20 Feb 2018 02:34:57 -0800 (PST) In-Reply-To: <20180219225923.GG22199@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Daniel Vetter Cc: airlied@linux.ie, tomi.valkeinen@ti.com, dri-devel@lists.freedesktop.org, Jyri Sarha , laurent.pinchart@ideasonboard.com List-Id: dri-devel@lists.freedesktop.org --===============1308977746== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BXr400anF0jyguTS" Content-Disposition: inline --BXr400anF0jyguTS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 19, 2018 at 11:59:23PM +0100, Daniel Vetter wrote: > On Mon, Feb 19, 2018 at 10:06:22PM +0200, Jyri Sarha wrote: > > Currently there is no way for a master drm driver to protect against an > > attached panel driver from being unloaded while it is in use. The > > least we can do is to indicate the usage by incrementing the module > > reference count. > >=20 > > Signed-off-by: Jyri Sarha > > cc: eric@anholt.net > > cc: laurent.pinchart@ideasonboard.com > > --- > > I do not see any module_get/put code in drm core. Is there is a reason > > for that? > >=20 > > There is two more alternative places for adding the module_get/put > > code. One is puting it directly to drm_panel_attach() and > > drm_panel_detach(). However, if the same module implements both the > > master drm driver and the panel (like tilcdc does with its > > tilcdc_panel.c), then attaching the panel will lock the module in for > > no good reason. Still, this solution should work with drm bridges as I > > do not see any reason why anybody would implement bridge drivers in > > the same module with the master drm driver. > >=20 > > The other place to put the code would in the master drm driver. But > > for handling the situation with bridges would need the device pointer > > in struct drm_bridge. >=20 > I think this looks like a reasonable place to do this. Looking at the code > we seem to have a similar issue with the bridge driver itself. I think > we need to wire through the module owner stuff and add a try_modeul_get to > of_drm_find_bridge (and any other helper used to find bridge instances). I disagree. module_get() is only going to protect you from unloading a module that's in use, but there are other ways to unbind a driver from the device and cause subsequent mayhem. struct device_link was "recently" introduced to fix that issue. Thierry --BXr400anF0jyguTS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlqL+coACgkQ3SOs138+ s6GzDA/9Gy262SsLMnV1Bfw9Z135JuJLVhP2ju+62f9PiVMfjwLPwAHfw2/5Cgp9 UGTm0RELdlQpu3CJxLkYZ9//GmPIFXvO4sfQkQpQNDnLcxT0AaIg/WxmXPIYal21 95RDKxPb1H809VVtzpQB9IAuISfLFnJW8bOz6dck/43vGwCbPUcW8+oSFE99MCLm mLEAzGIiVQdaan+rXF3rFzY+SnJ8D/i69aAQdTmS9QEqWTF+v17AXkZjXDIwLZ3l xlJRrd/cKclIuyomSmx3keHYlQtD54CxUGCOJGW2dSJMhq2AJY/6bHyXox7FsiND y7rYIpGYjTLT6GWv88XtQhli7oq/1BvFTtBu/05xMduWvMgZscMBxzkJiWg1TqiG CekQWBBL8N+dPOxKfrYIHptbHmnpX0R/5EGIBt15befLdbQWxVV9Y1F0eXKHPZo6 71WRnrykCkAHh1hX3197KsbK+6COa+7YS/Tju0MPysgUosnY6oY3K/KFFlWaq7un GBdkecpkdSlT4pVy76RPGYAtN4sElvEmi1YZP1vRteBkxRkHLKocqzkB04pSXokF n2bsazJyDXg/cricVuGhcmvyGca0vvmNnYk83K9PxYZjrmd9wqzyvZvE08gUdnNT 6KNPvaDQhvo50Y+/D/iDEZ+Zd79UUmMZflDWLi50Xi2cGcDo1L8= =s9cq -----END PGP SIGNATURE----- --BXr400anF0jyguTS-- --===============1308977746== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1308977746==--