All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: amd-gfx@lists.freedesktop.org, airlied@linux.ie,
	dri-devel@lists.freedesktop.org, alexander.deucher@amd.com,
	christian.koenig@amd.com
Subject: Re: [PATCH 1/6] drm: Inline AGP wrappers into their only callers
Date: Tue, 12 Jan 2021 09:59:11 +0100	[thread overview]
Message-ID: <X/1k30zps1I36JDd@phenom.ffwll.local> (raw)
In-Reply-To: <20210112081035.6882-2-tzimmermann@suse.de>

On Tue, Jan 12, 2021 at 09:10:30AM +0100, Thomas Zimmermann wrote:
> The AGP wrapper functions serve no purpose.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

They do, without them we fail compiling (I think at least) when agp isn't
enabled. Did you check for that? I should all work if we have the dummy
inlines for relevant agp functions in linux/agp_backend.h.
-Daniel

> ---
>  drivers/gpu/drm/drm_agpsupport.c | 12 ++++++------
>  drivers/gpu/drm/drm_memory.c     | 18 ------------------
>  include/drm/drm_agpsupport.h     | 18 ------------------
>  3 files changed, 6 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
> index 4c7ad46fdd21..8b690ef306de 100644
> --- a/drivers/gpu/drm/drm_agpsupport.c
> +++ b/drivers/gpu/drm/drm_agpsupport.c
> @@ -285,7 +285,7 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
>  	entry = drm_agp_lookup_entry(dev, request->handle);
>  	if (!entry || !entry->bound)
>  		return -EINVAL;
> -	ret = drm_unbind_agp(entry->memory);
> +	ret = agp_unbind_memory(entry->memory);
>  	if (ret == 0)
>  		entry->bound = 0;
>  	return ret;
> @@ -326,7 +326,7 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
>  	if (!entry || entry->bound)
>  		return -EINVAL;
>  	page = DIV_ROUND_UP(request->offset, PAGE_SIZE);
> -	retcode = drm_bind_agp(entry->memory, page);
> +	retcode = agp_bind_memory(entry->memory, page);
>  	if (retcode)
>  		return retcode;
>  	entry->bound = dev->agp->base + (page << PAGE_SHIFT);
> @@ -369,11 +369,11 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
>  	if (!entry)
>  		return -EINVAL;
>  	if (entry->bound)
> -		drm_unbind_agp(entry->memory);
> +		agp_unbind_memory(entry->memory);
>  
>  	list_del(&entry->head);
>  
> -	drm_free_agp(entry->memory, entry->pages);
> +	agp_free_memory(entry->memory);
>  	kfree(entry);
>  	return 0;
>  }
> @@ -453,8 +453,8 @@ void drm_legacy_agp_clear(struct drm_device *dev)
>  
>  	list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
>  		if (entry->bound)
> -			drm_unbind_agp(entry->memory);
> -		drm_free_agp(entry->memory, entry->pages);
> +			agp_unbind_memory(entry->memory);
> +		agp_free_memory(entry->memory);
>  		kfree(entry);
>  	}
>  	INIT_LIST_HEAD(&dev->agp->memory);
> diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
> index fbea69d6f909..f4f2bffdd5bd 100644
> --- a/drivers/gpu/drm/drm_memory.c
> +++ b/drivers/gpu/drm/drm_memory.c
> @@ -100,24 +100,6 @@ static void *agp_remap(unsigned long offset, unsigned long size,
>  	return addr;
>  }
>  
> -/** Wrapper around agp_free_memory() */
> -void drm_free_agp(struct agp_memory *handle, int pages)
> -{
> -	agp_free_memory(handle);
> -}
> -
> -/** Wrapper around agp_bind_memory() */
> -int drm_bind_agp(struct agp_memory *handle, unsigned int start)
> -{
> -	return agp_bind_memory(handle, start);
> -}
> -
> -/** Wrapper around agp_unbind_memory() */
> -int drm_unbind_agp(struct agp_memory *handle)
> -{
> -	return agp_unbind_memory(handle);
> -}
> -
>  #else /*  CONFIG_AGP  */
>  static inline void *agp_remap(unsigned long offset, unsigned long size,
>  			      struct drm_device *dev)
> diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h
> index 664e120b93e6..f3136750c490 100644
> --- a/include/drm/drm_agpsupport.h
> +++ b/include/drm/drm_agpsupport.h
> @@ -28,10 +28,6 @@ struct drm_agp_head {
>  
>  #if IS_ENABLED(CONFIG_AGP)
>  
> -void drm_free_agp(struct agp_memory * handle, int pages);
> -int drm_bind_agp(struct agp_memory * handle, unsigned int start);
> -int drm_unbind_agp(struct agp_memory * handle);
> -
>  struct drm_agp_head *drm_agp_init(struct drm_device *dev);
>  void drm_legacy_agp_clear(struct drm_device *dev);
>  int drm_agp_acquire(struct drm_device *dev);
> @@ -61,20 +57,6 @@ int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
>  
>  #else /* CONFIG_AGP */
>  
> -static inline void drm_free_agp(struct agp_memory * handle, int pages)
> -{
> -}
> -
> -static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
> -{
> -	return -ENODEV;
> -}
> -
> -static inline int drm_unbind_agp(struct agp_memory * handle)
> -{
> -	return -ENODEV;
> -}
> -
>  static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
>  {
>  	return NULL;
> -- 
> 2.29.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: amd-gfx@lists.freedesktop.org, airlied@linux.ie,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	dri-devel@lists.freedesktop.org, daniel@ffwll.ch,
	alexander.deucher@amd.com, christian.koenig@amd.com
Subject: Re: [PATCH 1/6] drm: Inline AGP wrappers into their only callers
Date: Tue, 12 Jan 2021 09:59:11 +0100	[thread overview]
Message-ID: <X/1k30zps1I36JDd@phenom.ffwll.local> (raw)
In-Reply-To: <20210112081035.6882-2-tzimmermann@suse.de>

On Tue, Jan 12, 2021 at 09:10:30AM +0100, Thomas Zimmermann wrote:
> The AGP wrapper functions serve no purpose.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

They do, without them we fail compiling (I think at least) when agp isn't
enabled. Did you check for that? I should all work if we have the dummy
inlines for relevant agp functions in linux/agp_backend.h.
-Daniel

> ---
>  drivers/gpu/drm/drm_agpsupport.c | 12 ++++++------
>  drivers/gpu/drm/drm_memory.c     | 18 ------------------
>  include/drm/drm_agpsupport.h     | 18 ------------------
>  3 files changed, 6 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
> index 4c7ad46fdd21..8b690ef306de 100644
> --- a/drivers/gpu/drm/drm_agpsupport.c
> +++ b/drivers/gpu/drm/drm_agpsupport.c
> @@ -285,7 +285,7 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
>  	entry = drm_agp_lookup_entry(dev, request->handle);
>  	if (!entry || !entry->bound)
>  		return -EINVAL;
> -	ret = drm_unbind_agp(entry->memory);
> +	ret = agp_unbind_memory(entry->memory);
>  	if (ret == 0)
>  		entry->bound = 0;
>  	return ret;
> @@ -326,7 +326,7 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
>  	if (!entry || entry->bound)
>  		return -EINVAL;
>  	page = DIV_ROUND_UP(request->offset, PAGE_SIZE);
> -	retcode = drm_bind_agp(entry->memory, page);
> +	retcode = agp_bind_memory(entry->memory, page);
>  	if (retcode)
>  		return retcode;
>  	entry->bound = dev->agp->base + (page << PAGE_SHIFT);
> @@ -369,11 +369,11 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
>  	if (!entry)
>  		return -EINVAL;
>  	if (entry->bound)
> -		drm_unbind_agp(entry->memory);
> +		agp_unbind_memory(entry->memory);
>  
>  	list_del(&entry->head);
>  
> -	drm_free_agp(entry->memory, entry->pages);
> +	agp_free_memory(entry->memory);
>  	kfree(entry);
>  	return 0;
>  }
> @@ -453,8 +453,8 @@ void drm_legacy_agp_clear(struct drm_device *dev)
>  
>  	list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
>  		if (entry->bound)
> -			drm_unbind_agp(entry->memory);
> -		drm_free_agp(entry->memory, entry->pages);
> +			agp_unbind_memory(entry->memory);
> +		agp_free_memory(entry->memory);
>  		kfree(entry);
>  	}
>  	INIT_LIST_HEAD(&dev->agp->memory);
> diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
> index fbea69d6f909..f4f2bffdd5bd 100644
> --- a/drivers/gpu/drm/drm_memory.c
> +++ b/drivers/gpu/drm/drm_memory.c
> @@ -100,24 +100,6 @@ static void *agp_remap(unsigned long offset, unsigned long size,
>  	return addr;
>  }
>  
> -/** Wrapper around agp_free_memory() */
> -void drm_free_agp(struct agp_memory *handle, int pages)
> -{
> -	agp_free_memory(handle);
> -}
> -
> -/** Wrapper around agp_bind_memory() */
> -int drm_bind_agp(struct agp_memory *handle, unsigned int start)
> -{
> -	return agp_bind_memory(handle, start);
> -}
> -
> -/** Wrapper around agp_unbind_memory() */
> -int drm_unbind_agp(struct agp_memory *handle)
> -{
> -	return agp_unbind_memory(handle);
> -}
> -
>  #else /*  CONFIG_AGP  */
>  static inline void *agp_remap(unsigned long offset, unsigned long size,
>  			      struct drm_device *dev)
> diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h
> index 664e120b93e6..f3136750c490 100644
> --- a/include/drm/drm_agpsupport.h
> +++ b/include/drm/drm_agpsupport.h
> @@ -28,10 +28,6 @@ struct drm_agp_head {
>  
>  #if IS_ENABLED(CONFIG_AGP)
>  
> -void drm_free_agp(struct agp_memory * handle, int pages);
> -int drm_bind_agp(struct agp_memory * handle, unsigned int start);
> -int drm_unbind_agp(struct agp_memory * handle);
> -
>  struct drm_agp_head *drm_agp_init(struct drm_device *dev);
>  void drm_legacy_agp_clear(struct drm_device *dev);
>  int drm_agp_acquire(struct drm_device *dev);
> @@ -61,20 +57,6 @@ int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
>  
>  #else /* CONFIG_AGP */
>  
> -static inline void drm_free_agp(struct agp_memory * handle, int pages)
> -{
> -}
> -
> -static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
> -{
> -	return -ENODEV;
> -}
> -
> -static inline int drm_unbind_agp(struct agp_memory * handle)
> -{
> -	return -ENODEV;
> -}
> -
>  static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
>  {
>  	return NULL;
> -- 
> 2.29.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-01-12  8:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12  8:10 [PATCH 0/6] Move struct drm_device.hose to legacy section Thomas Zimmermann
2021-01-12  8:10 ` Thomas Zimmermann
2021-01-12  8:10 ` [PATCH 1/6] drm: Inline AGP wrappers into their only callers Thomas Zimmermann
2021-01-12  8:10   ` Thomas Zimmermann
2021-01-12  8:59   ` Daniel Vetter [this message]
2021-01-12  8:59     ` Daniel Vetter
2021-01-12  9:56     ` Thomas Zimmermann
2021-01-12  9:56       ` Thomas Zimmermann
2021-01-12 14:01       ` Daniel Vetter
2021-01-12 14:01         ` Daniel Vetter
2021-01-12  8:10 ` [PATCH 2/6] drm: Implement drm_need_swiotlb() in drm_cache.c Thomas Zimmermann
2021-01-12  8:10   ` Thomas Zimmermann
2021-01-12  9:01   ` Daniel Vetter
2021-01-12  9:01     ` Daniel Vetter
2021-01-12  8:10 ` [PATCH 3/6] drm: Build drm_memory.o only for legacy drivers Thomas Zimmermann
2021-01-12  8:10   ` Thomas Zimmermann
2021-01-12  9:02   ` Daniel Vetter
2021-01-12  9:02     ` Daniel Vetter
2021-01-12  8:10 ` [PATCH 4/6] drm: Merge CONFIG_DRM_VM into CONFIG_DRM_LEGACY Thomas Zimmermann
2021-01-12  8:10   ` Thomas Zimmermann
2021-01-12  9:04   ` Daniel Vetter
2021-01-12  9:04     ` Daniel Vetter
2021-01-12  8:10 ` [PATCH 5/6] drm/radeon: Store PCI controller in struct radeon_device.hose Thomas Zimmermann
2021-01-12  8:10   ` Thomas Zimmermann
2021-01-12  8:10 ` [PATCH 6/6] drm: Move struct drm_device.hose to legacy section Thomas Zimmermann
2021-01-12  8:10   ` Thomas Zimmermann
2021-01-12  8:16 ` [PATCH 0/6] " Christian König
2021-01-12  8:16   ` Christian König

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=X/1k30zps1I36JDd@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.