All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Maíra Canal" <mcanal@igalia.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"David Airlie" <airlied@gmail.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Brian Starkey" <brian.starkey@arm.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Emma Anholt" <emma@anholt.net>, "Melissa Wen" <mwen@igalia.com>,
	"Rodrigo Siqueira" <rodrigosiqueiramelo@gmail.com>
Cc: "Maíra Canal" <mcanal@igalia.com>,
	"André Almeida" <andrealmeid@igalia.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/6] drm/debugfs: Create wrapper to add files to debugfs list
Date: Mon, 16 Jan 2023 12:59:48 +0200	[thread overview]
Message-ID: <87r0vueod7.fsf@intel.com> (raw)
In-Reply-To: <20230116102815.95063-4-mcanal@igalia.com>

On Mon, 16 Jan 2023, Maíra Canal <mcanal@igalia.com> wrote:
> Create a helper to encapsulate the code that adds a new debugfs file to
> a linked list related to a object. Moreover, the helper also provides
> more flexibily, as the parameter is a struct drm_debugfs_list.
>
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> ---
>  drivers/gpu/drm/drm_debugfs.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index 176b0f8614e5..aca460fa5d23 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -229,6 +229,13 @@ void drm_debugfs_list_destroy(struct drm_debugfs_list *debugfs_list)
>  	mutex_destroy(&debugfs_list->mutex);
>  }
>  
> +static void drm_debugfs_list_add(struct list_head *entry, struct drm_debugfs_list *debugfs_list)

Although list_add() has the arguments backwards, the type safety here
would let us have the destination parameter first without confusing
anyone.

BR,
Jani.


> +{
> +	mutex_lock(&debugfs_list->mutex);
> +	list_add(entry, &debugfs_list->list);
> +	mutex_unlock(&debugfs_list->mutex);
> +}
> +
>  int drm_debugfs_init(struct drm_minor *minor, int minor_id,
>  		     struct dentry *root)
>  {
> @@ -350,9 +357,7 @@ void drm_debugfs_add_file(struct drm_device *dev, const char *name,
>  	entry->file.data = data;
>  	entry->dev = dev;
>  
> -	mutex_lock(&dev->debugfs_list.mutex);
> -	list_add(&entry->list, &dev->debugfs_list.list);
> -	mutex_unlock(&dev->debugfs_list.mutex);
> +	drm_debugfs_list_add(&entry->list, &dev->debugfs_list);
>  }
>  EXPORT_SYMBOL(drm_debugfs_add_file);

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2023-01-16 11:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 10:28 [PATCH 0/6] drm/debugfs: Make the debugfs structure more generic Maíra Canal
2023-01-16 10:28 ` [PATCH 1/6] drm/debugfs: Introduce wrapper for debugfs list Maíra Canal
2023-01-16 10:28 ` [PATCH 2/6] drm/debugfs: Make drm_device use the struct drm_debugfs_list Maíra Canal
2023-01-16 10:58   ` Jani Nikula
2023-01-16 10:28 ` [PATCH 3/6] drm/debugfs: Create wrapper to add files to debugfs list Maíra Canal
2023-01-16 10:59   ` Jani Nikula [this message]
2023-01-16 10:28 ` [PATCH 4/6] drm/debugfs: Create wrapper to register debugfs Maíra Canal
2023-01-16 10:28 ` [PATCH 5/6] drm/debugfs: Make the struct drm_debugfs_entry independent of DRM device Maíra Canal
2023-01-16 10:28 ` [PATCH 6/6] drm/debugfs: Make the show callback pass the pointer to the right object Maíra Canal

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=87r0vueod7.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=andrealmeid@igalia.com \
    --cc=brian.starkey@arm.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mcanal@igalia.com \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=noralf@tronnes.org \
    --cc=rodrigosiqueiramelo@gmail.com \
    --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.