[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <79abfbff321f0d87c9c2e4df2b4c46a3f874c2ee.camel@analog.com>
Date: Fri, 20 Sep 2019 06:39:21 +0000
From: "Ardelean, Alexandru" <alexandru.Ardelean@...log.com>
To: "andrew@...n.ch" <andrew@...n.ch>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linville@...driver.com" <linville@...driver.com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>
Subject: Re: [PATCH 2/2][ethtool] ethtool: implement support for Energy Detect
Power Down
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
Powered by blists - more mailing lists