Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6543632ybf; Thu, 5 Mar 2020 23:25:24 -0800 (PST) X-Google-Smtp-Source: ADFU+vvEA6En8zL8PD1C5NDzLqwWENd3NbWz0LjFM5eJwmyzjI8yzuAranDIPxyAivk6VBEYuSTZ X-Received: by 2002:a05:6808:a0c:: with SMTP id n12mr1613731oij.101.1583479524294; Thu, 05 Mar 2020 23:25:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583479524; cv=none; d=google.com; s=arc-20160816; b=KcbTifLoD18iALPejx7nB5glmK8uvoQ3DR5jg3etT0idWVnR6hHzKN+cEKdp+pVIeG sXZM8vpSw3N2TpeAjBgX9+oUILs/+DiDsIuC7VKwZQuilr9k3JE6XJSqzaPJA6knTTmx 7OkE3DvRpybg6fpdeYbORhGK9pDRMejEXNnDjIeJb4/uhHLxtB1U6ylLRJVs4CqzhGzT zBnlXxqXJHU7Sd/6h56bQmK9O/LoaCNC5OaxNc2eOlyeegZT96LMHqWCY6LOQz98JBKI 1hKX9tPDs54w0EfYcq0p1qTw7ezBI/mTEYx+joFzd3bbfSyw8yAbk+hI5IaFwH4ktJIB XLIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=ClgOlEARyeennLZJdn66QhCUB5bH/Q1kj/5TZg3Oq/c=; b=w1n5uiC507fvNBfzN+7/N2SlrFdce8dvYuWVafovcNdQ6uNjTAPP88CXwcfmj1NKxd YWOHmIhlGeG/UgNcTn32KjPWjuhVjMUSdgPgVNevtA847KMcR1kdBjyFkp1yxkAz/0By DCOPSyT8RGUhJaN9Pj4Avh2dg97qybUNFXC8/JKf66V+wmVxmZ/acwwRVR1xLTOKMdl5 A9rOlUh6MRdvyq72wK/V1w1bqRyOtooC1jx2usvwELQMdXRE3oqsV5fvbLUjT+9ohIzN oW0HU0Yl4+wKjKaGs355tUBYpseqCftN0hvJGZd9Cx4mLbqMX0DH9bjaKKWO18/SajB8 9Xjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si1074056ota.42.2020.03.05.23.25.12; Thu, 05 Mar 2020 23:25:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726874AbgCFHYn (ORCPT + 99 others); Fri, 6 Mar 2020 02:24:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:37840 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbgCFHYn (ORCPT ); Fri, 6 Mar 2020 02:24:43 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 132E0ABF6; Fri, 6 Mar 2020 07:24:38 +0000 (UTC) Subject: Re: [PATCH] drm/hisilicon: Add the load and unload for hibmc_driver To: Tian Tao , puck.chen@hisilicon.com, airlied@linux.ie, daniel@ffwll.ch, kraxel@redhat.com, alexander.deucher@amd.com, tglx@linutronix.de, dri-devel@lists.freedesktop.org, xinliang.liu@linaro.org, linux-kernel@vger.kernel.org Cc: linuxarm@huawei.com References: <1583466184-7060-1-git-send-email-tiantao6@hisilicon.com> From: Thomas Zimmermann Autocrypt: addr=tzimmermann@suse.de; keydata= mQENBFs50uABCADEHPidWt974CaxB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x2Dyoklv5g4BzkgqTqwmaYzsl8UxZKvbaxq0zb ehDda8lvhFXodNFMAgTLJlLuDYOGLK2AwbrS3Sp0AEbkpdJBb44qVlGm5bApZouHeJ/+n+7r 12+lqdsAEQEAAYkBPAQYAQgAJhYhBHIX+6yM6c9jRKFo5WgNwR1TC3ojBQJbOdLgAhsMBQkD wmcAAAoJEGgNwR1TC3ojpfcIAInwP5OlcEKokTnHCiDTz4Ony4GnHRP2fXATQZCKxmu4AJY2 h9ifw9Nf2TjCZ6AMvC3thAN0rFDj55N9l4s1CpaDo4J+0fkrHuyNacnT206CeJV1E7NYntxU n+LSiRrOdywn6erjxRi9EYTVLCHcDhBEjKmFZfg4AM4GZMWX1lg0+eHbd5oL1as28WvvI/uI aMyV8RbyXot1r/8QLlWldU3NrTF5p7TMU2y3ZH2mf5suSKHAMtbE4jKJ8ZHFOo3GhLgjVrBW HE9JXO08xKkgD+w6v83+nomsEuf6C6LYrqY/tsZvyEX6zN8CtirPdPWu/VXNRYAl/lat7lSI 3H26qrE= Message-ID: <23d99485-59c9-b466-3939-982394aab9bd@suse.de> Date: Fri, 6 Mar 2020 08:24:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1583466184-7060-1-git-send-email-tiantao6@hisilicon.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hgM94dktjnwDN88zvKY8CPwH8lBPU3BMx" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hgM94dktjnwDN88zvKY8CPwH8lBPU3BMx Content-Type: multipart/mixed; boundary="O6U3plXr6584I0RxYfo7EkxSA0bZDs7n0"; protected-headers="v1" From: Thomas Zimmermann To: Tian Tao , puck.chen@hisilicon.com, airlied@linux.ie, daniel@ffwll.ch, kraxel@redhat.com, alexander.deucher@amd.com, tglx@linutronix.de, dri-devel@lists.freedesktop.org, xinliang.liu@linaro.org, linux-kernel@vger.kernel.org Cc: linuxarm@huawei.com Message-ID: <23d99485-59c9-b466-3939-982394aab9bd@suse.de> Subject: Re: [PATCH] drm/hisilicon: Add the load and unload for hibmc_driver References: <1583466184-7060-1-git-send-email-tiantao6@hisilicon.com> In-Reply-To: <1583466184-7060-1-git-send-email-tiantao6@hisilicon.com> --O6U3plXr6584I0RxYfo7EkxSA0bZDs7n0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Am 06.03.20 um 04:42 schrieb Tian Tao: > using the load and unload function provided by drm framework instead of= > doing the same work in the hibmc_pci_probe and do some code cleanup. >=20 > Signed-off-by: Tian Tao > Signed-off-by: Gong junjie > --- > drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 62 +++++++++--------= -------- > drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h | 2 + > 2 files changed, 24 insertions(+), 40 deletions(-) >=20 > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/= gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c > index 79a180a..51f1c70 100644 > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c > @@ -23,7 +23,7 @@ > #include > #include > #include > - > +#include > #include "hibmc_drm_drv.h" > #include "hibmc_drm_regs.h" > =20 > @@ -49,6 +49,8 @@ static irqreturn_t hibmc_drm_interrupt(int irq, void = *arg) > =20 > static struct drm_driver hibmc_driver =3D { > .driver_features =3D DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, > + .load =3D hibmc_load, > + .unload =3D hibmc_unload, These callbacks are deprecated and not to be used. During the last weeks and months, we've been working on removing them from the other remaining drivers. Therefore nak. Best regards Thomas > .fops =3D &hibmc_fops, > .name =3D "hibmc", > .date =3D "20160828", > @@ -232,6 +234,21 @@ static int hibmc_hw_map(struct hibmc_drm_private *= priv) > return 0; > } > =20 > +static void hibmc_hw_unmap(struct hibmc_drm_private *priv) > +{ > + struct drm_device *dev =3D priv->dev; > + > + if (priv->mmio) { > + devm_iounmap(dev->dev, priv->mmio); > + priv->mmio =3D NULL; > + } > + > + if (priv->fb_map) { > + devm_iounmap(dev->dev, priv->fb_map); > + priv->fb_map =3D NULL; > + } > +} > + > static int hibmc_hw_init(struct hibmc_drm_private *priv) > { > int ret; > @@ -245,7 +262,7 @@ static int hibmc_hw_init(struct hibmc_drm_private *= priv) > return 0; > } > =20 > -static int hibmc_unload(struct drm_device *dev) > +void hibmc_unload(struct drm_device *dev) > { > struct hibmc_drm_private *priv =3D dev->dev_private; > =20 > @@ -258,11 +275,12 @@ static int hibmc_unload(struct drm_device *dev) > =20 > hibmc_kms_fini(priv); > hibmc_mm_fini(priv); > + hibmc_hw_unmap(priv); > dev->dev_private =3D NULL; > return 0; > } > =20 > -static int hibmc_load(struct drm_device *dev) > +int hibmc_load(struct drm_device *dev, unsigned long flags) > { > struct hibmc_drm_private *priv; > int ret; > @@ -332,43 +350,7 @@ static int hibmc_pci_probe(struct pci_dev *pdev, > if (ret) > return ret; > =20 > - dev =3D drm_dev_alloc(&hibmc_driver, &pdev->dev); > - if (IS_ERR(dev)) { > - DRM_ERROR("failed to allocate drm_device\n"); > - return PTR_ERR(dev); > - } > - > - dev->pdev =3D pdev; > - pci_set_drvdata(pdev, dev); > - > - ret =3D pci_enable_device(pdev); > - if (ret) { > - DRM_ERROR("failed to enable pci device: %d\n", ret); > - goto err_free; > - } > - > - ret =3D hibmc_load(dev); > - if (ret) { > - DRM_ERROR("failed to load hibmc: %d\n", ret); > - goto err_disable; > - } > - > - ret =3D drm_dev_register(dev, 0); > - if (ret) { > - DRM_ERROR("failed to register drv for userspace access: %d\n", > - ret); > - goto err_unload; > - } > - return 0; > - > -err_unload: > - hibmc_unload(dev); > -err_disable: > - pci_disable_device(pdev); > -err_free: > - drm_dev_put(dev); > - > - return ret; > + return drm_get_pci_dev(pdev, ent, &hibmc_driver); > } > =20 > static void hibmc_pci_remove(struct pci_dev *pdev) > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/= gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h > index 50a0c1f..4e89cd7 100644 > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h > @@ -37,6 +37,8 @@ void hibmc_set_power_mode(struct hibmc_drm_private *p= riv, > void hibmc_set_current_gate(struct hibmc_drm_private *priv, > unsigned int gate); > =20 > +int hibmc_load(struct drm_device *dev, unsigned long flags); > +void hibmc_unload(struct drm_device *dev); > int hibmc_de_init(struct hibmc_drm_private *priv); > int hibmc_vdac_init(struct hibmc_drm_private *priv); > =20 >=20 --=20 Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany (HRB 36809, AG N=C3=BCrnberg) Gesch=C3=A4ftsf=C3=BChrer: Felix Imend=C3=B6rffer --O6U3plXr6584I0RxYfo7EkxSA0bZDs7n0-- --hgM94dktjnwDN88zvKY8CPwH8lBPU3BMx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAl5h+rUACgkQaA3BHVML eiMYiQf9GqZAwiyMfHRje2Jao2QTfgw9zRcQZSH10Ip5eZcKyjtjVkaUonJ8co4m dypcv9O7/RpRs6lmt6tMjDDzay9fUBbzF95ft9b5pSIv1ayPRQoYI55I0+T3+1n+ VYBo1yXMx8Y6MWgGgxH9+cH9qTyo2pcgp7c69dEcp0zoPy4VNCqsK0lgVF7RiPkJ +4GE8FvMOx+HAFieDgkV7YcqD3Qg0msNWTBGeWx32ef0fOZaVZTV3+/SR2vuU7SB 6Ip94GmvFnZpfn2WezD+NImfv9AsmoygtzMi/GFGjfrxq5LUwAt7jrADUET3bl4W RwCWP8V6yGcjjOA1ITVqju1fOHx9eg== =Xobx -----END PGP SIGNATURE----- --hgM94dktjnwDN88zvKY8CPwH8lBPU3BMx--