[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdUHm1msGCvOsArurvCZLPi4Pjr4RE8XR5mTQEiVQ1OMxA@mail.gmail.com>
Date: Thu, 21 Sep 2023 11:07:07 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Maxime Ripard <mripard@...nel.org>
Cc: Javier Martinez Canillas <javierm@...hat.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/ssd130x: Drop _helper prefix from struct
drm_*_helper_funcs callbacks
Hi Maxime,
On Thu, Sep 21, 2023 at 10:51 AM Maxime Ripard <mripard@...nel.org> wrote:
> On Thu, Sep 21, 2023 at 10:46:05AM +0200, Geert Uytterhoeven wrote:
> > On Thu, Sep 21, 2023 at 10:12 AM Maxime Ripard <mripard@...nel.org> wrote:
> > > On Thu, Sep 21, 2023 at 09:57:22AM +0200, Geert Uytterhoeven wrote:
> > > > On Thu, Sep 21, 2023 at 9:44 AM Maxime Ripard <mripard@...nel.org> wrote:
> > > > > On Mon, Sep 18, 2023 at 09:19:07AM +0200, Javier Martinez Canillas wrote:
> > > > > > Thomas Zimmermann <tzimmermann@...e.de> writes:
> > > > > > > Am 14.09.23 um 21:51 schrieb Javier Martinez Canillas:
> > > > > > >> The driver uses a naming convention where functions for struct drm_*_funcs
> > > > > > >> callbacks are named ssd130x_$object_$operation, while the callbacks for
> > > > > > >> struct drm_*_helper_funcs are named ssd130x_$object_helper_$operation.
> > > > > > >>
> > > > > > >> The idea is that this helper_ prefix in the function names denote that are
> > > > > > >> for struct drm_*_helper_funcs callbacks. This convention was copied from
> > > > > > >> other drivers, when ssd130x was written but Maxime pointed out that is the
> > > > > > >> exception rather than the norm.
> > > > > > >
> > > > > > > I guess you found this in my code. I want to point out that I use the
> > > > > > > _helper infix to signal that these are callback for
> > > > > > > drm_primary_plane_helper_funcs and *not* drm_primary_plane_funcs. The
> > > > > > > naming is intentional.
> > > > > >
> > > > > > Yes, that's what tried to say in the commit message and indeed I got the
> > > > > > convention from drivers in drivers/gpu/drm/tiny. In fact I believe these
> > > > > > function names are since first iteration of the driver, when was meant to
> > > > > > be a tiny driver.
> > > > > >
> > > > > > According to Maxime it's the exception rather than the rule and suggested
> > > > > > to change it, I don't really have a strong opinion on either naming TBH.
> > > > >
> > > > > Maybe that's just me, but the helper in the name indeed throws me off. In my
> > > > > mind, it's supposed to be used only for helpers, not functions implementing the
> > > > > helpers hooks.
> > > >
> > > > With several callbacks using the same (field) name, it is very helpful
> > > > to name the actual implementation by combining the struct type name
> > > > and the field name.
> > >
> > > I can't think of any (at least for a given object). Which one do you have in
> > > mind?
> >
> > E.g. atomic_check():
> >
> > drm_crtc_helper_funcs.atomic_check()
> > drm_encoder_helper_funcs.atomic_check()
> > drm_connector_helper_funcs.atomic_check()
> > drm_plane_helper_funcs.atomic_check()
>
> Right, but that's between objects, not between drm_$OBJECT_funcs and
> drm_$OBJECT_helper_funcs. So conflicts for a single given driver is unlikely,
> and can be solved by using, say, $DRIVER_crtc_atomic_check and
> $DRIVER_plane_atomic_check.
IC. There are indeed no such conflicts (except between
drm_encoder_slave_funcs and drm_encoder_helper_funcs, which I guess
doesn't count).
Thanks, this helps a lot to explain why there is no need to have
"helper" in the name of the callbacks.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists