[01/15] drm: Move dma functions into drm_legacy.h
diff mbox

Message ID 1410345840-3326-2-git-send-email-daniel.vetter@ffwll.ch
State New, archived
Headers show

Commit Message

Daniel Vetter Sept. 10, 2014, 10:43 a.m. UTC
Also drop the unneeded EXPORT_SYMBOL and sprinkle drm_legacy_ prefixes
where missing.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_bufs.c   |  2 +-
 drivers/gpu/drm/drm_dma.c    | 10 ++++------
 drivers/gpu/drm/drm_fops.c   |  2 +-
 drivers/gpu/drm/drm_legacy.h |  8 ++++++++
 include/drm/drmP.h           |  7 -------
 5 files changed, 14 insertions(+), 15 deletions(-)

Comments

David Herrmann Sept. 10, 2014, 2:42 p.m. UTC | #1
Hi

On Wed, Sep 10, 2014 at 12:43 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Also drop the unneeded EXPORT_SYMBOL and sprinkle drm_legacy_ prefixes
> where missing.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_bufs.c   |  2 +-
>  drivers/gpu/drm/drm_dma.c    | 10 ++++------
>  drivers/gpu/drm/drm_fops.c   |  2 +-
>  drivers/gpu/drm/drm_legacy.h |  8 ++++++++
>  include/drm/drmP.h           |  7 -------
>  5 files changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index 9e04d6a43fa4..70ba89f66199 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -1338,7 +1338,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
>                                   task_pid_nr(current));
>                         return -EINVAL;
>                 }
> -               drm_free_buffer(dev, buf);
> +               drm_legacy_free_buffer(dev, buf);
>         }
>
>         return 0;
> diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
> index 8a140a953754..9360c3915fe9 100644
> --- a/drivers/gpu/drm/drm_dma.c
> +++ b/drivers/gpu/drm/drm_dma.c
> @@ -124,7 +124,7 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
>   *
>   * Resets the fields of \p buf.
>   */
> -void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
> +void drm_legacy_free_buffer(struct drm_device *dev, struct drm_buf * buf)
>  {
>         if (!buf)
>                 return;
> @@ -142,8 +142,8 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
>   *
>   * Frees each buffer associated with \p file_priv not already on the hardware.
>   */
> -void drm_core_reclaim_buffers(struct drm_device *dev,
> -                             struct drm_file *file_priv)
> +void drm_legacy_core_reclaim_buffers(struct drm_device *dev,
> +                                    struct drm_file *file_priv)
>  {
>         struct drm_device_dma *dma = dev->dma;
>         int i;
> @@ -154,7 +154,7 @@ void drm_core_reclaim_buffers(struct drm_device *dev,
>                 if (dma->buflist[i]->file_priv == file_priv) {
>                         switch (dma->buflist[i]->list) {
>                         case DRM_LIST_NONE:
> -                               drm_free_buffer(dev, dma->buflist[i]);
> +                               drm_legacy_free_buffer(dev, dma->buflist[i]);
>                                 break;
>                         case DRM_LIST_WAIT:
>                                 dma->buflist[i]->list = DRM_LIST_RECLAIM;
> @@ -166,5 +166,3 @@ void drm_core_reclaim_buffers(struct drm_device *dev,
>                 }
>         }
>  }
> -
> -EXPORT_SYMBOL(drm_core_reclaim_buffers);
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index b419990042b0..6a8c9379bd42 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -404,7 +404,7 @@ int drm_release(struct inode *inode, struct file *filp)
>                 drm_master_release(dev, filp);
>
>         if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> -               drm_core_reclaim_buffers(dev, file_priv);
> +               drm_legacy_core_reclaim_buffers(dev, file_priv);
>
>         drm_events_release(file_priv);
>
> diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
> index 3049af5a01b3..36755ac4f244 100644
> --- a/drivers/gpu/drm/drm_legacy.h
> +++ b/drivers/gpu/drm/drm_legacy.h
> @@ -92,4 +92,12 @@ int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f);
>  int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f);
>  int drm_legacy_lock_free(struct drm_lock_data *lock, unsigned int ctx);
>
> +/* DMA support */
> +extern int drm_legacy_dma_setup(struct drm_device *dev);
> +extern void drm_legacy_dma_takedown(struct drm_device *dev);
> +extern void drm_legacy_free_buffer(struct drm_device *dev,
> +                                  struct drm_buf * buf);
> +extern void drm_legacy_core_reclaim_buffers(struct drm_device *dev,
> +                                           struct drm_file *filp);
> +

"_core_"  in the name doesn't really make much sense, but as long as
it has "legacy", too, I guess nobody cares.

You might wanna drop all the "extern " prefix for functions while
doing the move. It has no affect at all (default for function
declarations). Otherwise, looks good:

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

>  #endif /* __DRM_LEGACY_H__ */
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index c5c9f0e44a7b..574e325d6b69 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1158,13 +1158,6 @@ void drm_clflush_virt_range(void *addr, unsigned long length);
>   * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
>   */
>
> -                               /* DMA support (drm_dma.h) */
> -extern int drm_legacy_dma_setup(struct drm_device *dev);
> -extern void drm_legacy_dma_takedown(struct drm_device *dev);
> -extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
> -extern void drm_core_reclaim_buffers(struct drm_device *dev,
> -                                    struct drm_file *filp);
> -
>                                 /* IRQ support (drm_irq.h) */
>  extern int drm_control(struct drm_device *dev, void *data,
>                        struct drm_file *file_priv);
> --
> 1.9.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter Sept. 11, 2014, 6:24 a.m. UTC | #2
On Wed, Sep 10, 2014 at 04:42:04PM +0200, David Herrmann wrote:
> Hi
> 
> On Wed, Sep 10, 2014 at 12:43 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Also drop the unneeded EXPORT_SYMBOL and sprinkle drm_legacy_ prefixes
> > where missing.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > ---
> >  drivers/gpu/drm/drm_bufs.c   |  2 +-
> >  drivers/gpu/drm/drm_dma.c    | 10 ++++------
> >  drivers/gpu/drm/drm_fops.c   |  2 +-
> >  drivers/gpu/drm/drm_legacy.h |  8 ++++++++
> >  include/drm/drmP.h           |  7 -------
> >  5 files changed, 14 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> > index 9e04d6a43fa4..70ba89f66199 100644
> > --- a/drivers/gpu/drm/drm_bufs.c
> > +++ b/drivers/gpu/drm/drm_bufs.c
> > @@ -1338,7 +1338,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
> >                                   task_pid_nr(current));
> >                         return -EINVAL;
> >                 }
> > -               drm_free_buffer(dev, buf);
> > +               drm_legacy_free_buffer(dev, buf);
> >         }
> >
> >         return 0;
> > diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
> > index 8a140a953754..9360c3915fe9 100644
> > --- a/drivers/gpu/drm/drm_dma.c
> > +++ b/drivers/gpu/drm/drm_dma.c
> > @@ -124,7 +124,7 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
> >   *
> >   * Resets the fields of \p buf.
> >   */
> > -void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
> > +void drm_legacy_free_buffer(struct drm_device *dev, struct drm_buf * buf)
> >  {
> >         if (!buf)
> >                 return;
> > @@ -142,8 +142,8 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
> >   *
> >   * Frees each buffer associated with \p file_priv not already on the hardware.
> >   */
> > -void drm_core_reclaim_buffers(struct drm_device *dev,
> > -                             struct drm_file *file_priv)
> > +void drm_legacy_core_reclaim_buffers(struct drm_device *dev,
> > +                                    struct drm_file *file_priv)
> >  {
> >         struct drm_device_dma *dma = dev->dma;
> >         int i;
> > @@ -154,7 +154,7 @@ void drm_core_reclaim_buffers(struct drm_device *dev,
> >                 if (dma->buflist[i]->file_priv == file_priv) {
> >                         switch (dma->buflist[i]->list) {
> >                         case DRM_LIST_NONE:
> > -                               drm_free_buffer(dev, dma->buflist[i]);
> > +                               drm_legacy_free_buffer(dev, dma->buflist[i]);
> >                                 break;
> >                         case DRM_LIST_WAIT:
> >                                 dma->buflist[i]->list = DRM_LIST_RECLAIM;
> > @@ -166,5 +166,3 @@ void drm_core_reclaim_buffers(struct drm_device *dev,
> >                 }
> >         }
> >  }
> > -
> > -EXPORT_SYMBOL(drm_core_reclaim_buffers);
> > diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> > index b419990042b0..6a8c9379bd42 100644
> > --- a/drivers/gpu/drm/drm_fops.c
> > +++ b/drivers/gpu/drm/drm_fops.c
> > @@ -404,7 +404,7 @@ int drm_release(struct inode *inode, struct file *filp)
> >                 drm_master_release(dev, filp);
> >
> >         if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> > -               drm_core_reclaim_buffers(dev, file_priv);
> > +               drm_legacy_core_reclaim_buffers(dev, file_priv);
> >
> >         drm_events_release(file_priv);
> >
> > diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
> > index 3049af5a01b3..36755ac4f244 100644
> > --- a/drivers/gpu/drm/drm_legacy.h
> > +++ b/drivers/gpu/drm/drm_legacy.h
> > @@ -92,4 +92,12 @@ int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f);
> >  int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f);
> >  int drm_legacy_lock_free(struct drm_lock_data *lock, unsigned int ctx);
> >
> > +/* DMA support */
> > +extern int drm_legacy_dma_setup(struct drm_device *dev);
> > +extern void drm_legacy_dma_takedown(struct drm_device *dev);
> > +extern void drm_legacy_free_buffer(struct drm_device *dev,
> > +                                  struct drm_buf * buf);
> > +extern void drm_legacy_core_reclaim_buffers(struct drm_device *dev,
> > +                                           struct drm_file *filp);
> > +
> 
> "_core_"  in the name doesn't really make much sense, but as long as
> it has "legacy", too, I guess nobody cares.

Will do.
> 
> You might wanna drop all the "extern " prefix for functions while
> doing the move. It has no affect at all (default for function
> declarations). Otherwise, looks good:

Yeah, missed it here and with the sg stuff in the next patch. Will fix.

> 
> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
> 
> Thanks
> David
> 
> >  #endif /* __DRM_LEGACY_H__ */
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index c5c9f0e44a7b..574e325d6b69 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -1158,13 +1158,6 @@ void drm_clflush_virt_range(void *addr, unsigned long length);
> >   * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
> >   */
> >
> > -                               /* DMA support (drm_dma.h) */
> > -extern int drm_legacy_dma_setup(struct drm_device *dev);
> > -extern void drm_legacy_dma_takedown(struct drm_device *dev);
> > -extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
> > -extern void drm_core_reclaim_buffers(struct drm_device *dev,
> > -                                    struct drm_file *filp);
> > -
> >                                 /* IRQ support (drm_irq.h) */
> >  extern int drm_control(struct drm_device *dev, void *data,
> >                        struct drm_file *file_priv);
> > --
> > 1.9.3
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 9e04d6a43fa4..70ba89f66199 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1338,7 +1338,7 @@  int drm_legacy_freebufs(struct drm_device *dev, void *data,
 				  task_pid_nr(current));
 			return -EINVAL;
 		}
-		drm_free_buffer(dev, buf);
+		drm_legacy_free_buffer(dev, buf);
 	}
 
 	return 0;
diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
index 8a140a953754..9360c3915fe9 100644
--- a/drivers/gpu/drm/drm_dma.c
+++ b/drivers/gpu/drm/drm_dma.c
@@ -124,7 +124,7 @@  void drm_legacy_dma_takedown(struct drm_device *dev)
  *
  * Resets the fields of \p buf.
  */
-void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
+void drm_legacy_free_buffer(struct drm_device *dev, struct drm_buf * buf)
 {
 	if (!buf)
 		return;
@@ -142,8 +142,8 @@  void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
  *
  * Frees each buffer associated with \p file_priv not already on the hardware.
  */
-void drm_core_reclaim_buffers(struct drm_device *dev,
-			      struct drm_file *file_priv)
+void drm_legacy_core_reclaim_buffers(struct drm_device *dev,
+				     struct drm_file *file_priv)
 {
 	struct drm_device_dma *dma = dev->dma;
 	int i;
@@ -154,7 +154,7 @@  void drm_core_reclaim_buffers(struct drm_device *dev,
 		if (dma->buflist[i]->file_priv == file_priv) {
 			switch (dma->buflist[i]->list) {
 			case DRM_LIST_NONE:
-				drm_free_buffer(dev, dma->buflist[i]);
+				drm_legacy_free_buffer(dev, dma->buflist[i]);
 				break;
 			case DRM_LIST_WAIT:
 				dma->buflist[i]->list = DRM_LIST_RECLAIM;
@@ -166,5 +166,3 @@  void drm_core_reclaim_buffers(struct drm_device *dev,
 		}
 	}
 }
-
-EXPORT_SYMBOL(drm_core_reclaim_buffers);
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index b419990042b0..6a8c9379bd42 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -404,7 +404,7 @@  int drm_release(struct inode *inode, struct file *filp)
 		drm_master_release(dev, filp);
 
 	if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
-		drm_core_reclaim_buffers(dev, file_priv);
+		drm_legacy_core_reclaim_buffers(dev, file_priv);
 
 	drm_events_release(file_priv);
 
diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
index 3049af5a01b3..36755ac4f244 100644
--- a/drivers/gpu/drm/drm_legacy.h
+++ b/drivers/gpu/drm/drm_legacy.h
@@ -92,4 +92,12 @@  int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f);
 int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f);
 int drm_legacy_lock_free(struct drm_lock_data *lock, unsigned int ctx);
 
+/* DMA support */
+extern int drm_legacy_dma_setup(struct drm_device *dev);
+extern void drm_legacy_dma_takedown(struct drm_device *dev);
+extern void drm_legacy_free_buffer(struct drm_device *dev,
+				   struct drm_buf * buf);
+extern void drm_legacy_core_reclaim_buffers(struct drm_device *dev,
+					    struct drm_file *filp);
+
 #endif /* __DRM_LEGACY_H__ */
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index c5c9f0e44a7b..574e325d6b69 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1158,13 +1158,6 @@  void drm_clflush_virt_range(void *addr, unsigned long length);
  * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
  */
 
-				/* DMA support (drm_dma.h) */
-extern int drm_legacy_dma_setup(struct drm_device *dev);
-extern void drm_legacy_dma_takedown(struct drm_device *dev);
-extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
-extern void drm_core_reclaim_buffers(struct drm_device *dev,
-				     struct drm_file *filp);
-
 				/* IRQ support (drm_irq.h) */
 extern int drm_control(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv);