Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 1/4] lib/igt_kms: Add igt_connector_sysfs_open()
Date: Wed, 4 Dec 2019 18:55:57 +0200	[thread overview]
Message-ID: <20191204165557.GA1208@intel.com> (raw)
In-Reply-To: <157539012572.9581.11458188672276428079@skylake-alporthouse-com>

On Tue, Dec 03, 2019 at 04:22:05PM +0000, Chris Wilson wrote:
> Quoting Ville Syrjala (2019-12-03 15:35:52)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Add a helper to open the sysfs directory for a connector.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  lib/igt_kms.c | 34 ++++++++++++++++++++++++++++++++++
> >  lib/igt_kms.h |  3 +++
> >  2 files changed, 37 insertions(+)
> > 
> > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > index 44647a2263bd..74ae98d774f1 100644
> > --- a/lib/igt_kms.c
> > +++ b/lib/igt_kms.c
> > @@ -965,6 +965,40 @@ static void reset_connectors_at_exit(int sig)
> >         igt_reset_connectors();
> >  }
> >  
> > +static char *kmstest_connector_dirname(int idx,
> > +                                      uint32_t connector_type,
> > +                                      uint32_t connector_type_id,
> > +                                      char *name, int namelen)
> > +{
> > +       snprintf(name, namelen, "card%d-%s-%d", idx,
> > +                kmstest_connector_type_str(connector_type),
> > +                connector_type_id);
> > +
> > +       return name;
> > +}
> > +
> > +int igt_connector_sysfs_open(int drm_fd,
> > +                            drmModeConnector *connector)
> > +{
> > +       char name[80];
> > +       int dir, conn_dir;
> > +
> > +       dir = igt_sysfs_open(drm_fd);
> > +       if (dir < 0)
> > +               return dir;
> > +
> > +       if (!kmstest_connector_dirname(igt_device_get_card_index(drm_fd),
> > +                                      connector->connector_type,
> > +                                      connector->connector_type_id,
> > +                                      name, sizeof(name)))
> > +               return -1;
> 
> Before igt_sysfs_open() or close(dir);

Just realized that this never even returns NULL unless you pass in
NULL. I'll just drop the check.

> 
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-12-04 16:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 15:35 [igt-dev] [PATCH i-g-t 1/4] lib/igt_kms: Add igt_connector_sysfs_open() Ville Syrjala
2019-12-03 15:35 ` [igt-dev] [PATCH i-g-t 2/4] lib/igt_kms: Don't leak fds when forcing connector multiple times Ville Syrjala
2019-12-03 16:24   ` Chris Wilson
2019-12-03 15:35 ` [igt-dev] [PATCH i-g-t 3/4] lib/igt_kms: Rework forced connector handling Ville Syrjala
2019-12-03 16:25   ` Chris Wilson
2019-12-03 15:35 ` [igt-dev] [PATCH i-g-t 4/4] tests/kms_dp_aux_dev: Add drm_dp_aux test Ville Syrjala
2019-12-03 16:32   ` Chris Wilson
2019-12-03 16:51     ` Ville Syrjälä
2019-12-03 16:16 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] lib/igt_kms: Add igt_connector_sysfs_open() Patchwork
2019-12-03 16:22 ` [igt-dev] [PATCH i-g-t 1/4] " Chris Wilson
2019-12-04 16:55   ` Ville Syrjälä [this message]
2019-12-03 23:34 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,1/4] " 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=20191204165557.GA1208@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox