netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "andrew@lunn.ch" <andrew@lunn.ch>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linville@tuxdriver.com" <linville@tuxdriver.com>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>
Subject: Re: [PATCH 2/2][ethtool] ethtool: implement support for Energy Detect Power Down
Date: Fri, 20 Sep 2019 06:39:21 +0000	[thread overview]
Message-ID: <79abfbff321f0d87c9c2e4df2b4c46a3f874c2ee.camel@analog.com> (raw)
In-Reply-To: <20190919140025.GC22556@lunn.ch>

On Thu, 2019-09-19 at 16:00 +0200, Andrew Lunn wrote:
> [External]
> 
> > -static int parse_named_u8(struct cmd_context *ctx, const char *name,
> > u8 *val)
> > +static int parse_named_uint(struct cmd_context *ctx, const char *name,
> > +			    void *val, enum tunable_type_id type_id)
> >  {
> >  	if (ctx->argc < 2)
> >  		return 0;
> > @@ -5026,7 +5051,16 @@ static int parse_named_u8(struct cmd_context
> > *ctx, const char *name, u8 *val)
> >  	if (strcmp(*ctx->argp, name))
> >  		return 0;
> >  
> > -	*val = get_uint_range(*(ctx->argp + 1), 0, 0xff);
> > +	switch (type_id) {
> > +	case ETHTOOL_TUNABLE_U8:
> > +		*(u8 *)val = get_uint_range(*(ctx->argp + 1), 0, 0xff);
> > +		break;
> > +	case ETHTOOL_TUNABLE_U16:
> > +		*(u16 *)val = get_uint_range(*(ctx->argp + 1), 0, 0xffff);
> 
> I personally don't like these casts. Could you refactor this code in
> some other way to avoid them. Make the parse_named_u8()
> parse_named_u16() a bit fatter, and the shared code a bit slimmer?
> 

Sure thing.
V2 coming shortly.

> Thanks
> 	Andrew

      reply	other threads:[~2019-09-20  6:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 10:08 [PATCH 1/2][ethtool] ethtool: sync ethtool-copy.h: adds support for EDPD Alexandru Ardelean
2019-09-19 10:08 ` [PATCH 2/2][ethtool] ethtool: implement support for Energy Detect Power Down Alexandru Ardelean
2019-09-19 14:00   ` Andrew Lunn
2019-09-20  6:39     ` Ardelean, Alexandru [this message]

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=79abfbff321f0d87c9c2e4df2b4c46a3f874c2ee.camel@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.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).