From: Daniel Vetter <daniel@ffwll.ch>
To: Sean Paul <sean@poorly.run>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
dri-devel@lists.freedesktop.org, David Airlie <airlied@linux.ie>,
Sean Paul <seanpaul@chromium.org>
Subject: Re: [PATCH 3/3] drm: Add DRM_MODESET_LOCK_BEGIN/END helpers
Date: Wed, 28 Nov 2018 23:42:41 +0100 [thread overview]
Message-ID: <20181128224241.GC21184@phenom.ffwll.local> (raw)
In-Reply-To: <20181128143111.GG154175@art_vandelay>
On Wed, Nov 28, 2018 at 09:31:11AM -0500, Sean Paul wrote:
> On Wed, Nov 28, 2018 at 10:01:07AM +0100, Daniel Vetter wrote:
> > On Tue, Nov 27, 2018 at 05:46:40PM -0500, Sean Paul wrote:
> > > diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
> > > index a685d1bb21f26..6213a11445633 100644
> > > --- a/include/drm/drm_modeset_lock.h
> > > +++ b/include/drm/drm_modeset_lock.h
> > > @@ -130,4 +130,58 @@ void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
> > > int drm_modeset_lock_all_ctx(struct drm_device *dev,
> > > struct drm_modeset_acquire_ctx *ctx);
> > >
> > > +/**
> > > + * DRM_MODESET_LOCK_ALL_BEGIN - Helper to acquire modeset locks
> > > + * @dev: drm device
> > > + * @ret: local ret/err/etc variable to track error status
> > > + * @ctx: local modeset acquire context, will be dereferenced
> > > + * @flags: DRM_MODESET_ACQUIRE_* flags to pass to acquire_init()
> >
> > Full function name for the nice hyperlink. Needs a continuation line,
> > which just needs to be indentend.
> >
> > And a bikeshed: I'd put ret last in both macros, I think that's where
> > usually the cursors/output variables are.
>
> For _BEGIN is effectively a void, since it can't return with anything but
> ret==0. I agonized a little over doing this for _END, but figured since it was
> setting the value of ret, it might be misleading to put it at the end since
> folks might not realize that if they ignore it ret can still change (if that
> makes sense). In other words, I don't want people to think that:
>
> ret = DRM_MODESET_LOCAL_ALL_END(ret, ctx);
>
> behaves differently than
>
> DRM_MODESET_LOCAL_ALL_END(ret, ctx);
>
> By not allowing the assignment, it might poke people to think more about ret on
> END.
>
> I'm happy to have my mind changed on this, but figured context would be useful.
>
> All other bikesheds LGTM.
I think I wasn't clear enough: I meant to put ret last in the parameter
list of each. Especially the (ret, ctx) ordering looks very strange to me.
Definitely agreed that these macros shouldn't have some kind of contrived
return value.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-11-28 22:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 22:46 [PATCH 1/3] drm: Move drm_mode_setcrtc() local re-init to failure path Sean Paul
2018-11-27 22:46 ` [PATCH 2/3] drm: Move atomic_state_put after locks are dropped Sean Paul
2018-11-28 8:35 ` Daniel Vetter
2018-11-28 14:27 ` Sean Paul
2018-11-27 22:46 ` [PATCH 3/3] drm: Add DRM_MODESET_LOCK_BEGIN/END helpers Sean Paul
2018-11-28 9:01 ` Daniel Vetter
2018-11-28 14:31 ` Sean Paul
2018-11-28 22:42 ` Daniel Vetter [this message]
2018-11-28 16:59 ` Sean Paul
2018-11-28 22:40 ` Daniel Vetter
2018-11-28 8:29 ` [PATCH 1/3] drm: Move drm_mode_setcrtc() local re-init to failure path Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181128224241.GC21184@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=maxime.ripard@bootlin.com \
--cc=sean@poorly.run \
--cc=seanpaul@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox