From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH 15/17] drm/vc4: Convert to using __drm_atomic_helper_crtc_reset() for reset. Date: Fri, 01 Mar 2019 14:47:03 -0800 Message-ID: <87woli6wm0.fsf@anholt.net> References: <20190301125627.7285-1-maarten.lankhorst@linux.intel.com> <20190301125627.7285-16-maarten.lankhorst@linux.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1635124036==" Return-path: In-Reply-To: <20190301125627.7285-16-maarten.lankhorst@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Maarten Lankhorst , dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1635124036== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Maarten Lankhorst writes: > Convert vc4 to using __drm_atomic_helper_crtc_reset(), instead of > writing its own version. Instead of open coding destroy_state(), > call it directly for freeing the old state. > > Signed-off-by: Maarten Lankhorst > Cc: Eric Anholt > --- > drivers/gpu/drm/vc4/vc4_crtc.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crt= c.c > index e7c04a9eb219..fdf21594b050 100644 > --- a/drivers/gpu/drm/vc4/vc4_crtc.c > +++ b/drivers/gpu/drm/vc4/vc4_crtc.c > @@ -1041,12 +1041,13 @@ static void vc4_crtc_destroy_state(struct drm_crt= c *crtc, > static void > vc4_crtc_reset(struct drm_crtc *crtc) > { > - if (crtc->state) > - vc4_crtc_destroy_state(crtc->state); > + struct vc4_crtc_state *crtc_state =3D > + kzalloc(sizeof(*crtc_state), GFP_KERNEL); >=20=20 > - crtc->state =3D kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL); > if (crtc->state) > - crtc->state->crtc =3D crtc; > + vc4_crtc_destroy_state(crtc, crtc->state); > + > + __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base); Wouldn't it be much easier if __drm_atomic_helper_crtc_reset took in a new state and destroyed the old state for you? It seems like hardly a helper as is. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlx5tmcACgkQtdYpNtH8 nuiG/xAAo3Za/RbsjBmntwI4JBu608Nsns1Ke738u32HgwdEluNTL8HhQoHnpYj3 vUR6YpUjwzu2st6kLfm3Ss8y5qZHK6ElKVwNRpZF2ju00/l8BgFo5DRHWR0L5sJd 17bIiCNU/EV6WKgqBW4GQkpa2RdevdBcJm/6ci11J70kmXEcntGUaw5EMcM7RcqR 1OZRwE0ii8oFOYaIRrnU/EqmaAxfSTbMtZn8kDtmVbFerjr68bHQ/m/DUYynLbp0 2CHym55Os0DHABXRcG9yA4GCAxCwVxe8K3I9GU3X0t/O6FG1Y1lmpM/Jej8+XPS4 K2dLCsRD3Yh3r/umzCM/Y9j07HsXsakhdl37Gc4EkU+qCxM8bCdnJ0Nmu8SBZ+TM Eh+13JUzhKAAYvuuoUskKjH1Fqg28pegpG40zPilQVMhHTNwksvCLYbyMWVjp9vZ b3Elj9ZapL5VsMYxbHnGQ8uZ44SGm/H7b+Q42INxY56CRgMjnEE9XW40JEyDtZ13 QEHNcn9LjwRp/6MDrOgf8JPZucQe48hPBHjxo1KNTdwaowrLPnNrroUIJMHpCT5m CyxQ4XQ7hWMS7d/IimuEO8LkrEq7WEihx1FtqtucTyguLNzcKgNShBVtzVDcv4ys TyBF+xow1lwpAn17pXDOMJKtH3+RX6w1KtDb8bsZyrd4ZC6Rcbc= =Er+P -----END PGP SIGNATURE----- --=-=-=-- --===============1635124036== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4 --===============1635124036==--