mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/ssd130x: Drop _helper prefix from struct drm_*_helper_funcs callbacks
Date: Thu, 21 Sep 2023 10:23:42 +0200	[thread overview]
Message-ID: <878r90kk8h.fsf@minerva.mail-host-address-is-not-set> (raw)
In-Reply-To: <CAMuHMdUGVgj6V+N865QZaAusqD7O2f1askE544Z4MF0h4zBERg@mail.gmail.com>

Geert Uytterhoeven <geert@linux-m68k.org> writes:

Hello Geert and Maxime,

> Hi Maxime,
>
> On Thu, Sep 21, 2023 at 9:44 AM Maxime Ripard <mripard@kernel.org> wrote:
>> On Mon, Sep 18, 2023 at 09:19:07AM +0200, Javier Martinez Canillas wrote:
>> > Thomas Zimmermann <tzimmermann@suse.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.

I agree with your definition of helpers. But more importantly for me is
what you mentioned, that most DRM drivers aren't using this convention
of concatenating  the driver name + struct type name + callback name.

>
> 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.  Anything else confuses the casual reader.

Both options have cons and pros (e.g: quickly figuring out to what struct
callback is associated as you said), but the reason I posted this patch is
to attempt making the driver more consistent with the rest of the drivers.

> Perhaps the real question is whether the structures should have "helper"
> in their name in the first place?
>

Indeed. I never fully understood why the DRM/KMS objects callbacks are
split in drm_$object_funcs and drm_$object_helper_funcs structs. AFAIU
is because the former is the minimum required and the latter is to add
additional custom behavior ?

I read this section of the documentation but still isn't clear to me:

https://dri.freedesktop.org/docs/drm/gpu/drm-kms-helpers.html

> Just my 2€c as a DRM novice...
>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


  parent reply	other threads:[~2023-09-21 19:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 19:51 Javier Martinez Canillas
2023-09-18  6:51 ` Thomas Zimmermann
2023-09-18  7:19   ` Javier Martinez Canillas
2023-09-21  7:44     ` Maxime Ripard
2023-09-21  7:57       ` Geert Uytterhoeven
2023-09-21  8:12         ` Maxime Ripard
2023-09-21  8:25           ` Javier Martinez Canillas
2023-09-21  8:46           ` Geert Uytterhoeven
2023-09-21  8:51             ` Maxime Ripard
2023-09-21  9:07               ` Geert Uytterhoeven
2023-09-21  8:55             ` Thomas Zimmermann
2023-09-21  8:23         ` Javier Martinez Canillas [this message]
2023-09-21  8:44           ` Thomas Zimmermann
2023-09-21  8:52       ` Thomas Zimmermann
2023-09-21 13:22         ` Maxime Ripard
2023-09-21 14:19 ` Maxime Ripard
2023-09-22  9:50   ` Javier Martinez Canillas

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=878r90kk8h.fsf@minerva.mail-host-address-is-not-set \
    --to=javierm@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®