Virtualization Archive mirror
 help / color / mirror / Atom feed
From: Robert Foss <rfoss@kernel.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: dri-devel@lists.freedesktop.org,
	Gerd Hoffmann <kraxel@redhat.com>,
	 virtualization@lists.linux.dev
Subject: Re: [RESEND 5/6] drm/bochs: switch to struct drm_edid
Date: Mon, 13 May 2024 19:04:56 +0200	[thread overview]
Message-ID: <CAN6tsi5YZf3ZiixnfcntzJN8YfmQzXPzbYssCkneLwiWz=febA@mail.gmail.com> (raw)
In-Reply-To: <24536f4a1a12af7b43ba86e9761dfeef179b72df.1715347488.git.jani.nikula@intel.com>

On Fri, May 10, 2024 at 3:27 PM Jani Nikula <jani.nikula@intel.com> wrote:
>
> Prefer struct drm_edid based functions over struct edid.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> ---
>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: virtualization@lists.linux.dev
> ---
>  drivers/gpu/drm/tiny/bochs.c | 23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
> index 2d7ad808cc0e..d12d6e0bf3df 100644
> --- a/drivers/gpu/drm/tiny/bochs.c
> +++ b/drivers/gpu/drm/tiny/bochs.c
> @@ -85,7 +85,7 @@ struct bochs_device {
>         u16 yres_virtual;
>         u32 stride;
>         u32 bpp;
> -       struct edid *edid;
> +       const struct drm_edid *drm_edid;
>
>         /* drm */
>         struct drm_device *dev;
> @@ -199,10 +199,10 @@ static int bochs_hw_load_edid(struct bochs_device *bochs)
>         if (drm_edid_header_is_valid(header) != 8)
>                 return -1;
>
> -       kfree(bochs->edid);
> -       bochs->edid = drm_do_get_edid(&bochs->connector,
> -                                     bochs_get_edid_block, bochs);
> -       if (bochs->edid == NULL)
> +       drm_edid_free(bochs->drm_edid);
> +       bochs->drm_edid = drm_edid_read_custom(&bochs->connector,
> +                                              bochs_get_edid_block, bochs);
> +       if (bochs->drm_edid == NULL)
>                 return -1;
>
>         return 0;
> @@ -303,7 +303,7 @@ static void bochs_hw_fini(struct drm_device *dev)
>         if (bochs->fb_map)
>                 iounmap(bochs->fb_map);
>         pci_release_regions(to_pci_dev(dev->dev));
> -       kfree(bochs->edid);
> +       drm_edid_free(bochs->drm_edid);
>  }
>
>  static void bochs_hw_blank(struct bochs_device *bochs, bool blank)
> @@ -471,12 +471,9 @@ static const struct drm_simple_display_pipe_funcs bochs_pipe_funcs = {
>
>  static int bochs_connector_get_modes(struct drm_connector *connector)
>  {
> -       struct bochs_device *bochs =
> -               container_of(connector, struct bochs_device, connector);
> -       int count = 0;
> +       int count;
>
> -       if (bochs->edid)
> -               count = drm_add_edid_modes(connector, bochs->edid);
> +       count = drm_edid_connector_add_modes(connector);
>
>         if (!count) {
>                 count = drm_add_modes_noedid(connector, 8192, 8192);
> @@ -507,10 +504,10 @@ static void bochs_connector_init(struct drm_device *dev)
>         drm_connector_helper_add(connector, &bochs_connector_connector_helper_funcs);
>
>         bochs_hw_load_edid(bochs);
> -       if (bochs->edid) {
> +       if (bochs->drm_edid) {
>                 DRM_INFO("Found EDID data blob.\n");
>                 drm_connector_attach_edid_property(connector);
> -               drm_connector_update_edid_property(connector, bochs->edid);
> +               drm_edid_connector_update(&bochs->connector, bochs->drm_edid);
>         }
>  }
>
> --
> 2.39.2
>

Reviewed-by: Robert Foss <rfoss@kernel.org>

  reply	other threads:[~2024-05-13 17:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1715347488.git.jani.nikula@intel.com>
2024-05-10 13:26 ` [RESEND 5/6] drm/bochs: switch to struct drm_edid Jani Nikula
2024-05-13 17:04   ` Robert Foss [this message]
2024-05-10 13:26 ` [RESEND 6/6] drm/virtio: " Jani Nikula
2024-05-13 17:03   ` Robert Foss

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='CAN6tsi5YZf3ZiixnfcntzJN8YfmQzXPzbYssCkneLwiWz=febA@mail.gmail.com' \
    --to=rfoss@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=kraxel@redhat.com \
    --cc=virtualization@lists.linux.dev \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).