[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170526102149.l26fzjwg5zxsqq5e@sirena.org.uk>
Date: Fri, 26 May 2017 11:21:49 +0100
From: Mark Brown <broonie@...nel.org>
To: "Alex A. Mihaylov" <minimumlaw@...bler.ru>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sebastian Reichel <sre@...nel.org>,
Evgeniy Polyakov <zbr@...emap.net>,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH 1/4] Introduce regmap infrastructure over Maxim/Dalas
OneWire (W1) bus
On Thu, May 25, 2017 at 08:46:36PM +0300, Alex A. Mihaylov wrote:
This looks mostly fine, a couple of small things and like I said in
reply to Greg please use subject lines matching the style for the
subsystem - this makes it a lot easier for people to identify relevant
patches.
> + int ret = -ENODEV;
> +
> +
> + if (reg > 255)
> + return -EINVAL;
> +
> + mutex_lock(&sl->master->bus_mutex);
> + if (!w1_reset_select_slave(sl)) {
> + w1_write_8(sl->master, W1_CMD_READ_DATA);
> + w1_write_8(sl->master, reg);
> + *val = w1_read_8(sl->master);
> + ret = 0;
> + }
> + mutex_unlock(&sl->master->bus_mutex);
This is a bit confusing with how -ENODEV is generated - move the
assignment into the if statement so it doesn't look like we're silently
ignoring errors unless you look back to the top of the function.
> +static struct regmap_bus regmap_w1_bus_a8_v16 = {
> + .reg_read = w1_reg_a8_v16_read,
> + .reg_write = w1_reg_a8_v16_write,
> +};
It'd be clearer to just have all all these structs at the end of the set
of functions rather than scattered about randomly.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists