All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Cline <jcline@redhat.com>
To: Lyude <lyude@redhat.com>
Cc: igt-dev@lists.freedesktop.org, nouveau@lists.freedesktop.org
Subject: Re: [igt-dev] [i-g-t, v3, 3/5] lib/igt_debugfs: Add igt_debugfs_pipe_dir()
Date: Tue, 18 Aug 2020 17:01:15 -0400	[thread overview]
Message-ID: <20200818210115.GA53828@dev.jcline.org> (raw)
In-Reply-To: <20200417211025.109574-4-lyude@redhat.com>

Hi,

On Fri, Apr 17, 2020 at 05:10:23PM -0400, Lyude wrote:
> From: Lyude Paul <lyude@redhat.com>
> 
> Like igt_debugfs_connector_dir(), but for pipes instead.
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> ---
>  lib/igt_debugfs.c | 29 +++++++++++++++++++++++++++++
>  lib/igt_debugfs.h |  1 +
>  2 files changed, 30 insertions(+)
> 
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index bf6be552..3c3b11e1 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -260,6 +260,35 @@ int igt_debugfs_connector_dir(int device, char *conn_name, int mode)
>  	return ret;
>  }
>  
> +/**
> + * igt_debugfs_pipe_dir:
> + * @device: fd of the device
> + * @pipe: index of pipe
> + * @mode: mode bits as used by open()
> + *
> + * This opens the debugfs directory corresponding to the pipe index on the
> + * device for use with igt_sysfs_get() and related functions.
> + *
> + * Returns:
> + * The directory fd, or -1 on failure.
> + */
> +int igt_debugfs_pipe_dir(int device, int pipe, int mode)
> +{
> +	char buf[128];
> +	int dir, ret;
> +
> +	dir = igt_debugfs_dir(device);
> +	if (dir < 0)
> +		return dir;
> +
> +	snprintf(buf, sizeof(buf), "crtc-%d", pipe);
> +	ret = openat(dir, buf, mode);
> +
> +	close(dir);
> +
> +	return ret;
> +}
> +

There seems to be a lot of overlap between this,
igt_debugfs_connector_dir(), and igt_debugfs_open(). As far as I can
tell, the latter two functions are completely identical so it's unclear
to me what the advantage of using one over the other is.

If I'm not mistaken igt_debugfs_pipe_dir() could be reduced to:

{
    char buf[128];
    snprintf(buf, sizeof(buf), "crtc-%d", pipe);
    return igt_debugfs_open(device, buf, mode);
}

and the docblock could just note it's sugar for igt_debugfs_open().

- Jeremy

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

WARNING: multiple messages have this Message-ID (diff)
From: Jeremy Cline <jcline-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Lyude <lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: igt-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [i-g-t, v3, 3/5] lib/igt_debugfs: Add igt_debugfs_pipe_dir()
Date: Tue, 18 Aug 2020 17:01:15 -0400	[thread overview]
Message-ID: <20200818210115.GA53828@dev.jcline.org> (raw)
In-Reply-To: <20200417211025.109574-4-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Hi,

On Fri, Apr 17, 2020 at 05:10:23PM -0400, Lyude wrote:
> From: Lyude Paul <lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> 
> Like igt_debugfs_connector_dir(), but for pipes instead.
> 
> Signed-off-by: Lyude Paul <lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  lib/igt_debugfs.c | 29 +++++++++++++++++++++++++++++
>  lib/igt_debugfs.h |  1 +
>  2 files changed, 30 insertions(+)
> 
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index bf6be552..3c3b11e1 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -260,6 +260,35 @@ int igt_debugfs_connector_dir(int device, char *conn_name, int mode)
>  	return ret;
>  }
>  
> +/**
> + * igt_debugfs_pipe_dir:
> + * @device: fd of the device
> + * @pipe: index of pipe
> + * @mode: mode bits as used by open()
> + *
> + * This opens the debugfs directory corresponding to the pipe index on the
> + * device for use with igt_sysfs_get() and related functions.
> + *
> + * Returns:
> + * The directory fd, or -1 on failure.
> + */
> +int igt_debugfs_pipe_dir(int device, int pipe, int mode)
> +{
> +	char buf[128];
> +	int dir, ret;
> +
> +	dir = igt_debugfs_dir(device);
> +	if (dir < 0)
> +		return dir;
> +
> +	snprintf(buf, sizeof(buf), "crtc-%d", pipe);
> +	ret = openat(dir, buf, mode);
> +
> +	close(dir);
> +
> +	return ret;
> +}
> +

There seems to be a lot of overlap between this,
igt_debugfs_connector_dir(), and igt_debugfs_open(). As far as I can
tell, the latter two functions are completely identical so it's unclear
to me what the advantage of using one over the other is.

If I'm not mistaken igt_debugfs_pipe_dir() could be reduced to:

{
    char buf[128];
    snprintf(buf, sizeof(buf), "crtc-%d", pipe);
    return igt_debugfs_open(device, buf, mode);
}

and the docblock could just note it's sugar for igt_debugfs_open().

- Jeremy

  reply	other threads:[~2020-08-18 21:01 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 21:10 [igt-dev] [PATCH i-g-t v3 0/5] Add nouveau-crc tests Lyude
2020-04-17 21:10 ` Lyude
2020-04-17 21:10 ` [igt-dev] [PATCH i-g-t v3 1/5] lib/igt_core: Fix igt_assert_fd() documentation Lyude
2020-04-17 21:10   ` Lyude
2020-04-20  9:29   ` [igt-dev] " Petri Latvala
2020-04-20  9:29     ` Petri Latvala
2020-04-17 21:10 ` [igt-dev] [PATCH i-g-t v3 2/5] lib/igt_core: Add igt_require_fd() Lyude
2020-04-17 21:10   ` Lyude
2020-04-20  9:29   ` [igt-dev] " Petri Latvala
2020-04-20  9:29     ` Petri Latvala
2020-04-17 21:10 ` [igt-dev] [PATCH i-g-t v3 3/5] lib/igt_debugfs: Add igt_debugfs_pipe_dir() Lyude
2020-04-17 21:10   ` Lyude
2020-08-18 21:01   ` Jeremy Cline [this message]
2020-08-18 21:01     ` [i-g-t, v3, " Jeremy Cline
2020-04-17 21:10 ` [igt-dev] [PATCH i-g-t v3 4/5] lib/igt_kms: Hook up connector dithering prop Lyude
2020-04-17 21:10   ` Lyude
2020-08-18 21:18   ` [igt-dev] [i-g-t, v3, " Jeremy Cline
2020-08-18 21:18     ` Jeremy Cline
2020-04-17 21:10 ` [igt-dev] [PATCH i-g-t v3 5/5] tests: Add nouveau-crc tests Lyude
2020-04-17 21:10   ` Lyude
2020-08-18 21:00   ` [igt-dev] [PATCH i-g-t v4] " Lyude
2020-08-18 21:00     ` Lyude
2020-09-28 21:36     ` [igt-dev] " Jeremy Cline
2020-09-28 21:36       ` Jeremy Cline
2020-09-29 16:13       ` Lyude Paul
2020-09-29 16:13         ` Lyude Paul
2020-09-29 17:42         ` Jeremy Cline
2020-09-29 17:42           ` Jeremy Cline
2020-04-17 23:16 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add nouveau-crc tests (rev3) Patchwork
2020-04-17 23:29 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-04-19 20:33 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2020-08-18 21:57 ` [igt-dev] ✓ Fi.CI.BAT: success for Add nouveau-crc tests (rev4) Patchwork
2020-08-19  4:40 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

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=20200818210115.GA53828@dev.jcline.org \
    --to=jcline@redhat.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    /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.