mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Lyude Paul <lyude@redhat.com>, Maxime Ripard <mripard@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"open list:RUST:Keyword:b(?i:rust)b"
	<rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH 1/2] drm/edid: Use unsigned int in drm_add_modes_noedid()
Date: Wed, 26 Mar 2025 10:29:39 +0100	[thread overview]
Message-ID: <65cd8976-3e07-4886-8eaa-f9a6094f6f1e@suse.de> (raw)
In-Reply-To: <20250325212823.669459-2-lyude@redhat.com>

Hi

Am 25.03.25 um 22:27 schrieb Lyude Paul:
> A negative resolution doesn't really make any sense, no one goes into a TV
> store and says "Hello sir, I would like a negative 4K TV please", that
> would make everyone look at you funny.
>
> So, let's make these parameters a bit more reasonable and ensure that
> they're unsigned - which makes the resulting rust bindings for this
> function a bit easier to understand and work with.
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Maxime Ripard <mripard@kernel.org>
> ---
>   drivers/gpu/drm/drm_edid.c | 2 +-
>   include/drm/drm_edid.h     | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 13bc4c290b17d..2e2e1d2347397 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -7099,7 +7099,7 @@ EXPORT_SYMBOL(drm_add_edid_modes);
>    * Return: The number of modes added or 0 if we couldn't find any.
>    */
>   int drm_add_modes_noedid(struct drm_connector *connector,
> -			int hdisplay, int vdisplay)
> +			 unsigned int hdisplay, unsigned int vdisplay)

You should also remove these branches:

  https://elixir.bootlin.com/linux/v6.13.7/source/drivers/gpu/drm/drm_edid.c#L7109

Best regards
Thomas

>   {
>   	int i, count, num_modes = 0;
>   	struct drm_display_mode *mode;
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index eaac5e665892a..b38409670868d 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -437,7 +437,7 @@ bool drm_detect_monitor_audio(const struct edid *edid);
>   enum hdmi_quantization_range
>   drm_default_rgb_quant_range(const struct drm_display_mode *mode);
>   int drm_add_modes_noedid(struct drm_connector *connector,
> -			 int hdisplay, int vdisplay);
> +			 unsigned int hdisplay, unsigned int vdisplay);
>   
>   int drm_edid_header_is_valid(const void *edid);
>   bool drm_edid_is_valid(struct edid *edid);

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


  reply	other threads:[~2025-03-26  9:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 21:27 [PATCH 0/2] drm: Make some resolution info unsigned Lyude Paul
2025-03-25 21:27 ` [PATCH 1/2] drm/edid: Use unsigned int in drm_add_modes_noedid() Lyude Paul
2025-03-26  9:29   ` Thomas Zimmermann [this message]
2025-03-26 10:39   ` Jani Nikula
2025-03-26 11:06     ` Miguel Ojeda
2025-03-28 22:27     ` Lyude Paul
2025-03-29 12:04       ` Miguel Ojeda
2025-03-25 21:27 ` [PATCH 2/2] drm/mode_config: Make drm_mode_config.(max|min)_(width|height) signed Lyude Paul
2025-03-26  9:32   ` Thomas Zimmermann
2025-03-26  9:07 ` [PATCH 0/2] drm: Make some resolution info unsigned Maxime Ripard

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=65cd8976-3e07-4886-8eaa-f9a6094f6f1e@suse.de \
    --to=tzimmermann@suse.de \
    --cc=a.hindborg@kernel.org \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    /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®