[Intel-gfx] [PATCH] Convert proc files to seq_file

Dave Airlie airlied at gmail.com
Tue Feb 3 09:37:03 CET 2009


On Tue, Jan 20, 2009 at 7:06 AM, Ben Gamari <bgamari at gmail.com> wrote:
> The old mechanism to formatting proc files is extremely ugly. The
> seq_file API was designed specifically for cases like this and greatly
> simplifies the process.

Don't bother adding a new header files just add the functions in a
separate block in drmP.h

Some other comments inline...

> ---
>  drivers/gpu/drm/Makefile   |    3 +-
>  drivers/gpu/drm/drm_info.c |  292 ++++++++++++++++++
>  drivers/gpu/drm/drm_info.h |    9 +
>  drivers/gpu/drm/drm_proc.c |  721 +++++++-------------------------------------
>  drivers/gpu/drm/drm_stub.c |    2 +-
>  include/drm/drmP.h         |   26 ++-
>  6 files changed, 437 insertions(+), 616 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_info.c
>  create mode 100644 drivers/gpu/drm/drm_info.h
> +
> +/**
> + * Called when "/proc/dri/.../name" is read.
> + *
> + * Prints the device name together with the bus id if available.

> diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
> index 8df849f..fc1c837 100644
> --- a/drivers/gpu/drm/drm_proc.c
> +++ b/drivers/gpu/drm/drm_proc.c
> @@ -37,697 +37,192 @@
>  * OTHER DEALINGS IN THE SOFTWARE.
>  */
>
> +#include <linux/seq_file.h>
>  #include "drmP.h"
> +#include "drm_info.h"
>
> -static int drm_name_info(char *buf, char **start, off_t offset,
> -                        int request, int *eof, void *data);
> -static int drm_vm_info(char *buf, char **start, off_t offset,
> -                      int request, int *eof, void *data);
> -static int drm_clients_info(char *buf, char **start, off_t offset,
> -                           int request, int *eof, void *data);
> -static int drm_queues_info(char *buf, char **start, off_t offset,
> -                          int request, int *eof, void *data);
> -static int drm_bufs_info(char *buf, char **start, off_t offset,
> -                        int request, int *eof, void *data);
> -static int drm_vblank_info(char *buf, char **start, off_t offset,
> -                          int request, int *eof, void *data);
> -static int drm_gem_name_info(char *buf, char **start, off_t offset,
> -                            int request, int *eof, void *data);
> -static int drm_gem_object_info(char *buf, char **start, off_t offset,
> -                              int request, int *eof, void *data);
> -#if DRM_DEBUG_CODE
> -static int drm_vma_info(char *buf, char **start, off_t offset,
> -                       int request, int *eof, void *data);
> -#endif
> +
> +/***************************************************
> + * Initialization, etc.
> + **************************************************/
>
>  /**
>  * Proc file list.
>  */
> -static struct drm_proc_list {
> -       const char *name;       /**< file name */
> -       int (*f) (char *, char **, off_t, int, int *, void *);          /**< proc callback*/
> -       u32 driver_features; /**< Required driver features for this entry */
> -} drm_proc_list[] = {
> +static struct drm_info_list drm_proc_list[] = {
>        {"name", drm_name_info, 0},
> -       {"mem", drm_mem_info, 0},
> +       /*{"mem", drm_mem_info, 0},*/

Just remove it if its not used. I'm not sure how much testing the
DRM memory tracking has gotten.

>        {"vm", drm_vm_info, 0},
>        {"clients", drm_clients_info, 0},
>        {"queues", drm_queues_info, 0},
>        {"bufs", drm_bufs_info, 0},
> -       {"vblank", drm_vblank_info, 0},
>        {"gem_names", drm_gem_name_info, DRIVER_GEM},
>        {"gem_objects", drm_gem_object_info, DRIVER_GEM},
> -#if DRM_DEBUG_CODE
> -       {"vma", drm_vma_info},
> -#endif

Where did this go? DRM_DEBUG_CODE is always defined in drmP.h

Dave.



More information about the Intel-gfx mailing list