igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 5/6] tools/dpcd_reg: Make --count optional.
Date: Wed, 5 Sep 2018 16:19:52 -0700	[thread overview]
Message-ID: <20180905231952.GC2686@intel.com> (raw)
In-Reply-To: <7d4e447b018c475495fdfbfa19c2e67993719ae0.camel@intel.com>

On Tue, Sep 04, 2018 at 06:12:15PM -0700, Dhinakaran Pandiyan wrote:
> On Fri, 2018-08-31 at 21:18 -0700, Rodrigo Vivi wrote:
> > Defaults to 1 when not explicitly defined.
> > 
> > Cc: Tarun Vyas <tarun.vyas@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  tools/dpcd_reg.c | 17 +++++++----------
> >  1 file changed, 7 insertions(+), 10 deletions(-)
> > 
> > diff --git a/tools/dpcd_reg.c b/tools/dpcd_reg.c
> > index c533401c..a141f1fc 100644
> > --- a/tools/dpcd_reg.c
> > +++ b/tools/dpcd_reg.c
> > @@ -170,7 +170,7 @@ int main(int argc, char **argv)
> >  	} cmd = DUMP;
> >  
> >  	struct option longopts [] = {
> > -		{
> > "count",      required_argument,      NULL,      'c' },
> > +		{
> > "count",      optional_argument,      NULL,      'c' },
> Passing count can be optional, but when count is passed it should
> require an argument.
> 
> From what I understand, this change makes passing an argument to count
> optional.

ops... indeed... my bad...

I will fix whenever touching this again. ;)

Thanks,
Rodrigo.

> 
> >  		{ "device",	required_argument,	NULL,  
> >     'd' },
> >  		{ "help", 	no_argument, 		&help
> > _flg,  2  },
> >  		{ "offset",	required_argument,	NULL,	
> >    'o' },
> > @@ -227,10 +227,15 @@ int main(int argc, char **argv)
> >  	}
> >  
> >  	if (cmd != DUMP && offset == INVALID) {
> > -		printf("Offset needed for this operation\n");
> > +		igt_warn("Offset needed for this operation\n");
> >  		print_usage(argv[0], 0);
> >  	}
> >  
> > +	if (cmd != DUMP && count == INVALID) {
> > +		igt_debug("count not defined, defaults to 1
> > byte\n");
> > +		count = 1;
> > +	}
> > +
> >  	memset(dev_name, '\0', 20);
> >  	snprintf(dev_name, sizeof(aux_dev) + 2, "%s%d", aux_dev,
> > devid);
> >  
> > @@ -243,20 +248,12 @@ int main(int argc, char **argv)
> >  
> >  	switch (cmd) {
> >  	case READ:
> > -		if (count == INVALID) {
> > -			igt_warn("Please specify the count in
> > bytes\n");
> > -			print_usage(argv[0], 0);
> > -		}
> >  		ret = dpcd_read(fd, offset, count);
> >  		if (ret != count)
> >  			igt_warn("Failed to read from %s aux
> > device\n",
> >  				 dev_name);
> >  		break;
> >  	case WRITE:
> > -		if (val == INVALID) {
> > -			igt_warn("Write value is missing\n");
> > -			print_usage(argv[0], 0);
> > -		}
> >  		ret = dpcd_write(fd, offset, &val);
> >  		if (ret < 0)
> >  			igt_warn("Failed to write to %s aux
> > device\n",
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-09-05 23:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-01  4:18 [igt-dev] [PATCH i-g-t 1/6] tools: Add a simple tool to read/write/decode dpcd registers Rodrigo Vivi
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 2/6] tools/dpcd_reg: Improve outputs Rodrigo Vivi
2018-09-05  1:04   ` Dhinakaran Pandiyan
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 3/6] tools/dpcd_reg: Unify file handling Rodrigo Vivi
2018-09-05  0:56   ` Dhinakaran Pandiyan
2018-09-05 18:17     ` Rodrigo Vivi
2018-09-15  0:06       ` Tarun Vyas
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 4/6] tools/dpcd_reg: Introduce dump as the default operation Rodrigo Vivi
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 5/6] tools/dpcd_reg: Make --count optional Rodrigo Vivi
2018-09-05  1:12   ` Dhinakaran Pandiyan
2018-09-05 23:19     ` Rodrigo Vivi [this message]
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 6/6] tools/dpcd_reg: Add dump all functionality Rodrigo Vivi
2018-09-06  0:26   ` Dhinakaran Pandiyan
2018-09-06  2:05     ` Rodrigo Vivi
2018-09-01  4:47 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/6] tools: Add a simple tool to read/write/decode dpcd registers Patchwork
2018-09-01  5:40 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-09-05  0:48 ` [igt-dev] [PATCH i-g-t 1/6] " Dhinakaran Pandiyan
2018-09-15  0:04   ` Tarun Vyas

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=20180905231952.GC2686@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).