mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
	linux-kernel@vger.kernel.org
Cc: "Neal Gompa" <ngompa13@gmail.com>,
	"Peter Robinson" <pbrobinson@gmail.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"David Airlie" <airlied@linux.ie>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/2] drm/aperture: Move conflicting fbdev frame buffer removal to a helper
Date: Tue, 2 Nov 2021 10:13:00 +0100	[thread overview]
Message-ID: <48ee2cec-ce4c-6f15-ad73-e1e4a6151d7a@suse.de> (raw)
In-Reply-To: <20211025075756.3479157-2-javierm@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2840 bytes --]



Am 25.10.21 um 09:57 schrieb Javier Martinez Canillas:
> The logic to remove the conflicting frame buffers for fbdev devices that
> use a given memory range is only compiled if CONFIG_FB option is enabled.
> 
> But having an ifdefery in drm_aperture_remove_conflicting_framebuffers()
> makes the function harder to extend. Move the logic into its own helper.
> 
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
> 
> (no changes since v1)
> 
>   drivers/gpu/drm/drm_aperture.c | 39 ++++++++++++++++++++++------------
>   1 file changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_aperture.c b/drivers/gpu/drm/drm_aperture.c
> index 74bd4a76b253..1a8ed0c616d6 100644
> --- a/drivers/gpu/drm/drm_aperture.c
> +++ b/drivers/gpu/drm/drm_aperture.c
> @@ -273,6 +273,30 @@ static void drm_aperture_detach_drivers(resource_size_t base, resource_size_t si
>   	mutex_unlock(&drm_apertures_lock);
>   }
>   
> +static int drm_aperture_remove_conflicting_fbdev_framebuffers(resource_size_t base,
> +							      resource_size_t size, bool primary,
> +							      const struct drm_driver *req_driver)
> +{
> +#if IS_REACHABLE(CONFIG_FB)
> +	struct apertures_struct *a;
> +	int ret;
> +
> +	a = alloc_apertures(1);
> +	if (!a)
> +		return -ENOMEM;
> +
> +	a->ranges[0].base = base;
> +	a->ranges[0].size = size;
> +
> +	ret = remove_conflicting_framebuffers(a, req_driver->name, primary);
> +	kfree(a);
> +
> +	if (ret)
> +		return ret;
> +#endif
> +	return 0;
> +}
> +
>   /**
>    * drm_aperture_remove_conflicting_framebuffers - remove existing framebuffers in the given range
>    * @base: the aperture's base address in physical memory
> @@ -289,23 +313,12 @@ static void drm_aperture_detach_drivers(resource_size_t base, resource_size_t si
>   int drm_aperture_remove_conflicting_framebuffers(resource_size_t base, resource_size_t size,
>   						 bool primary, const struct drm_driver *req_driver)
>   {
> -#if IS_REACHABLE(CONFIG_FB)
> -	struct apertures_struct *a;
>   	int ret;
>   
> -	a = alloc_apertures(1);
> -	if (!a)
> -		return -ENOMEM;
> -
> -	a->ranges[0].base = base;
> -	a->ranges[0].size = size;
> -
> -	ret = remove_conflicting_framebuffers(a, req_driver->name, primary);
> -	kfree(a);
> -
> +	ret = drm_aperture_remove_conflicting_fbdev_framebuffers(base, size, primary,
> +								 req_driver);
>   	if (ret)
>   		return ret;
> -#endif
>   
>   	drm_aperture_detach_drivers(base, size);
>   
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2021-11-02  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25  7:57 [PATCH v2 0/2] Add a drm.disable_native_drivers command line option Javier Martinez Canillas
2021-10-25  7:57 ` [PATCH v2 1/2] drm/aperture: Move conflicting fbdev frame buffer removal to a helper Javier Martinez Canillas
2021-11-02  9:13   ` Thomas Zimmermann [this message]
2021-10-25  7:57 ` [PATCH v2 2/2] drm/aperture: Prevent conflicting framebuffers removal if option is set 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=48ee2cec-ce4c-6f15-ad73-e1e4a6151d7a@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ngompa13@gmail.com \
    --cc=pbrobinson@gmail.com \
    --cc=ville.syrjala@linux.intel.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

all inboxes | Powered by JetHome®