From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH 10/18] drm/irq: track the irq installed in drm_irq_install in dev->irq Date: Thu, 17 Apr 2014 17:03:59 +0200 Message-ID: <20140417150358.GJ550@ulmo> References: <1397252175-14227-1-git-send-email-daniel.vetter@ffwll.ch> <1397252175-14227-11-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0625209643==" Return-path: Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by gabe.freedesktop.org (Postfix) with ESMTP id A7D3B6E547 for ; Thu, 17 Apr 2014 08:05:07 -0700 (PDT) Received: by mail-ee0-f43.google.com with SMTP id e53so774911eek.16 for ; Thu, 17 Apr 2014 08:05:06 -0700 (PDT) In-Reply-To: <1397252175-14227-11-git-send-email-daniel.vetter@ffwll.ch> 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: DRI Development List-Id: dri-devel@lists.freedesktop.org --===============0625209643== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Re2uCLPLNzqOLVJA" Content-Disposition: inline --Re2uCLPLNzqOLVJA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 11, 2014 at 11:36:07PM +0200, Daniel Vetter wrote: > To get rid of the dev->bus->get_irq callback we need to pass in the > desired irq explicitly into drm_irq_install. To avoid having to do the > same for drm_irq_unistall just track it internally. That leaves > drivers with less room to botch things up. >=20 > v2: Add the hunk lost in an earlier patch to this one (Thierry). >=20 > Cc: Thierry Reding > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_irq.c | 18 +++++++++++------- > include/drm/drmP.h | 2 ++ > 2 files changed, 13 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c > index 330e85b19115..1c3b6229363d 100644 > --- a/drivers/gpu/drm/drm_irq.c > +++ b/drivers/gpu/drm/drm_irq.c > @@ -249,14 +249,16 @@ static inline int drm_dev_to_irq(struct drm_device = *dev) > */ > int drm_irq_install(struct drm_device *dev) > { > - int ret; > + int ret, irq; > unsigned long sh_flags =3D 0; > char *irqname; > =20 > + irq =3D drm_dev_to_irq(dev); > + This looks odd... > if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) > return -EINVAL; > =20 > - if (drm_dev_to_irq(dev) =3D=3D 0) > + if (irq =3D=3D 0) > return -EINVAL; Wouldn't it make more sense to assign irq only here? And while at it, perhaps you meant to store irq directly within dev->irq, rather than in a local variable? That would address Laurent's comment as well. > =20 > /* Driver must have been initialized */ > @@ -267,7 +269,7 @@ int drm_irq_install(struct drm_device *dev) > return -EBUSY; > dev->irq_enabled =3D true; > =20 > - DRM_DEBUG("irq=3D%d\n", drm_dev_to_irq(dev)); > + DRM_DEBUG("irq=3D%d\n", dev->irq); > =20 > /* Before installing handler */ > if (dev->driver->irq_preinstall) > @@ -282,7 +284,7 @@ int drm_irq_install(struct drm_device *dev) > else > irqname =3D dev->driver->name; > =20 > - ret =3D request_irq(drm_dev_to_irq(dev), dev->driver->irq_handler, > + ret =3D request_irq(dev->irq, dev->driver->irq_handler, > sh_flags, irqname, dev); > =20 > if (ret < 0) { > @@ -301,7 +303,9 @@ int drm_irq_install(struct drm_device *dev) > dev->irq_enabled =3D false; > if (!drm_core_check_feature(dev, DRIVER_MODESET)) > vga_client_register(dev->pdev, NULL, NULL, NULL); > - free_irq(drm_dev_to_irq(dev), dev); > + free_irq(dev->irq, dev); > + } else { > + dev->irq =3D irq; > } But perhaps you really only want to assign it after it's been properly initialized, so I guess the local variable is fine. But in that case you probably need to make sure to not use dev->irq until after this assignment. Thierry --Re2uCLPLNzqOLVJA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJTT+1eAAoJEN0jrNd/PrOh7poP/23/XNsttfQPmIczDQq69qOE WpIB2DaegPE/+ZcuhrZPzskVrgTO4PLIP44KRmCKrcoJnHlxpCpDbN73DZDT6Txx dfj7wS8fCIdwp2IAZlonbOegmPIeE+wspRYfOKAMZSMsnhS4cQHdF1vb0DwhTgdc cYu0Nddp6ZesjlhqiGDx+wSd0ztI54LWTyGmj8R20k7Y/x105+EMvwDqetciZ5Eq 70QsWPgco1nIRa9RvtTVG8AlG21yorkmV16pdEpXeH0qb2I6eFAVAKMuEpYyqdms Lh1WLoO+/wJw5adrDt2bjR6eLFtS/j1Kyys0uGe47bEX9V4B6r3Je0947iEXkqzk eZ8tWjzuxu01jRu67SELN+R0LTzb1+5PgcYXPU/sH/WpgW2OL+mozwwPRzp73fno zTUqI65mrICyUawXQE7Gx/ouLeEY7LO+09MzlcmL2e6JCx2LmzHAreDn2UKphUNU 9M7wwqI1du7ex3ftNU+N+Ne7QtSKzX7JcBCfrJsMequTnNOZ+rKJQi9b/herWqTF CdjRTcu5+j1kFWLYcSGGf/KcyEDRH7Pyv/eN/GFsktafEe1ShkBHZ6oPUswLOSaz 7DvpHwiaBqZ2LUV2gk1Vw38FOEf8DTu6PXKmH3WqpZ2xrphTuecFKP9W/PW8eaOS twHPrLWcDyAKLVpkvE2t =USpG -----END PGP SIGNATURE----- --Re2uCLPLNzqOLVJA-- --===============0625209643== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0625209643==--