Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Nyekjaer <sean@geanix.com>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>, Chen-Yu Tsai <wens@csie.org>,
	 Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	 Yannick Fertre <yannick.fertre@foss.st.com>,
	Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>,
	 Philippe Cornu <philippe.cornu@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	 Alexandre Torgue <alexandre.torgue@foss.st.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev,
	 linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH v2 1/3] drm/modes: introduce drm_mode_validate_mode() helper function
Date: Tue, 26 Nov 2024 16:49:50 +0100	[thread overview]
Message-ID: <20241126-tentacled-busy-catfish-c451fc@houat> (raw)
In-Reply-To: <871pyyxjwz.fsf@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]

On Tue, Nov 26, 2024 at 02:24:12PM +0200, Jani Nikula wrote:
> On Tue, 26 Nov 2024, Maxime Ripard <mripard@kernel.org> wrote:
> > On Tue, Nov 26, 2024 at 12:16:34PM +0200, Jani Nikula wrote:
> >> On Mon, 25 Nov 2024, Maxime Ripard <mripard@kernel.org> wrote:
> >> > I wonder about the naming though (and prototype). I doesn't really
> >> > validates a mode, but rather makes sure that a given rate is a good
> >> > approximation of a pixel clock. So maybe something like
> >> > drm_mode_check_pixel_clock?
> >> 
> >> Quoting myself from a few weeks back:
> >> 
> >> """
> >> Random programming thought of the day: "check" is generally a terrible
> >> word in a function name.
> >> 
> >> Checking stuff is great, but what do you expect to happen if the check
> >> passes/fails? Do you expect the function to return on fail, or throw an
> >> exception? Or just log about it? If you return a value, what should the
> >> return value mean? It's hard to know without looking it up.
> >> 
> >> Prefer predicates instead, is_stuff_okay() is better than
> >> check_stuff(). Or assert_stuff() if you don't return on failures.
> >> """
> >
> > Both is_stuff_okay() or assert_stuff() return a boolean in my mind. If
> > you want to return a mode status enum, I don't think they are better
> > names.
> 
> Most functions returning enum drm_mode_status are called
> something_something_mode_valid(). Not check something.

But it doesn't check whether the mode is valid or not. It checks whether
a given clock rate is within reasonable tolerance from the expected
pixel clock.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 269 bytes --]

  reply	other threads:[~2024-11-26 15:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 13:49 [PATCH v2 0/3] drm/stm: dsi: relax mode_valid clock tolerance Sean Nyekjaer
2024-11-25 13:49 ` [PATCH v2 1/3] drm/modes: introduce drm_mode_validate_mode() helper function Sean Nyekjaer
2024-11-25 16:00   ` Maxime Ripard
2024-11-26  7:36     ` Sean Nyekjaer
2024-11-26  8:38       ` Maxime Ripard
2024-11-26 11:34         ` Sean Nyekjaer
2024-11-26 12:09           ` Maxime Ripard
2024-11-26 12:11             ` Sean Nyekjaer
2024-11-26  8:47       ` Raphael Gallais-Pou
2024-11-26  9:30         ` Maxime Ripard
2024-11-26 13:30       ` Sean Nyekjaer
2024-12-02 10:32         ` Maxime Ripard
2024-11-26 10:16     ` Jani Nikula
2024-11-26 12:09       ` Maxime Ripard
2024-11-26 12:24         ` Jani Nikula
2024-11-26 15:49           ` Maxime Ripard [this message]
2025-01-06 16:16   ` Raphael Gallais-Pou
2024-11-25 13:49 ` [PATCH v2 2/3] drm/sun4i: use " Sean Nyekjaer
2024-11-25 16:01   ` Maxime Ripard
2024-11-25 16:10   ` Chen-Yu Tsai
2024-11-25 13:49 ` [PATCH v2 3/3] drm/stm: dsi: " Sean Nyekjaer
2024-11-25 16:01   ` Maxime Ripard
2025-01-06 16:04   ` Raphael Gallais-Pou

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=20241126-tentacled-busy-catfish-c451fc@houat \
    --to=mripard@kernel.org \
    --cc=airlied@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=philippe.cornu@foss.st.com \
    --cc=raphael.gallais-pou@foss.st.com \
    --cc=samuel@sholland.org \
    --cc=sean@geanix.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=wens@csie.org \
    --cc=yannick.fertre@foss.st.com \
    /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