lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cbbd52bf-8758-42e9-8b35-48750137f2fd@bootlin.com>
Date: Fri, 6 Sep 2024 15:29:17 +0200
From: Thomas Richard <thomas.richard@...tlin.com>
To: Andi Shyti <andi.shyti@...nel.org>
Cc: Lee Jones <lee@...nel.org>, Linus Walleij <linus.walleij@...aro.org>,
 Bartosz Golaszewski <brgl@...ev.pl>,
 Wim Van Sebroeck <wim@...ux-watchdog.org>, Guenter Roeck
 <linux@...ck-us.net>, linux-kernel@...r.kernel.org,
 linux-gpio@...r.kernel.org, linux-i2c@...r.kernel.org,
 linux-watchdog@...r.kernel.org, thomas.petazzoni@...tlin.com,
 blake.vermeer@...sight.com
Subject: Re: [PATCH 3/5] i2c: Congatec Board Controller i2c bus driver

On 8/14/24 01:24, Andi Shyti wrote:
> Hi Thomas,

Hi Andi,

Thanks for the review !!

> 
> On Fri, Aug 09, 2024 at 04:52:07PM GMT, Thomas Richard wrote:
>> Add i2c support for the Congatec Board Controller.
>> do you mind adding some more description?

I'll mention that there are 2 busses.

> 
>> Signed-off-by: Thomas Richard <thomas.richard@...tlin.com>
> 
> ...
> 
>> +config I2C_CGBC
>> +	tristate "Congatec I2C Controller"
>> +	depends on MFD_CGBC
>> +	help
>> +	  This enables the I2C bus interfaces for the Congatec Board
> 
> This what? :-)

Rephrased it for next iteration.

> 
>> +	  Controller.
>> +
>> +	  This driver can also be built as a module. If so, the module will
>> +	  be called i2c-cgbc.ko.
>> +
> 
> ...
> 
>> +#include <linux/module.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/i2c.h>
>> +#include <linux/iopoll.h>
> 
> please sort includes in alphabetical order?

Fixed in the next iteration.

> 
>> +#include <linux/mfd/cgbc.h>
> 
> ...
> 
>> +enum i2c_state {
>> +	STATE_DONE = 0,
>> +	STATE_INIT,
>> +	STATE_START,
>> +	STATE_READ,
>> +	STATE_WRITE,
>> +	STATE_ERROR,
>> +};
> 
> can you please use the cgbc prefix for this enum and all the
> members?

Ok, fixed in the next iteration.

> 
> ...
> 
>> +	if (bus_frequency > CGBC_I2C_FREQ_MAX_HZ ||
>> +	    bus_frequency < CGBC_I2C_FREQ_MIN_HZ) {
>> +		dev_warn(i2c->dev, "invalid frequency %u, using default\n", bus_frequency);
> 
> should this rather be a dev_info()? (supernit: please start with
> capital leter).

The driver i2c-xlp9xx has a similar message [1] and it uses a dev_warn().
So I don't know.
If you think dev_info() is more relevant in this case, I'll change it.
Supernit will be fixed in next iteration.

[1]
https://elixir.bootlin.com/linux/v6.11-rc6/source/drivers/i2c/busses/i2c-xlp9xx.c#L480

> 
>> +		bus_frequency = I2C_MAX_STANDARD_MODE_FREQ;
>> +	}
>> +
>> +	cmd[0] = CGBC_I2C_CMD_SPEED | algo_data->bus_id;
>> +	cmd[1] = cgbc_i2c_freq_to_reg(bus_frequency);
>> +
>> +	ret = cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL);
>> +	if (ret)
>> +		return dev_err_probe(i2c->dev, ret,
>> +				     "Failed to initialize I2C bus %s",
>> +				     adap->name);
>> +
>> +	cmd[1] = 0x00;
>> +
>> +	ret = cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL);
>> +	if (ret)
>> +		return dev_err_probe(i2c->dev, ret,
>> +				     "Failed to get I2C bus frequency");
>> +
>> +	bus_frequency = cgbc_i2c_reg_to_freq(data);
>> +
>> +	dev_dbg(i2c->dev, "%s is running at %d Hz\n", adap->name, bus_frequency);
>> +
>> +	/*
>> +	 * The read_maxtime_us is the maximum time to wait during a read to get
>> +	 * data. At maximum CGBC_I2C_READ_MAX_LEN can be read by command.
>> +	 * So calculate the max time to size correctly the timeout.
>> +	 */
> 
> this comment is a bit wild, can we rephrase to something like:
> 
> /*
>  * The read_maxtime_us variable represents the maximum time to wait
>  * for data during a read operation. The maximum amount of data that
>  * can be read by a command is CGBC_I2C_READ_MAX_LEN.
>  * Therefore, calculate the max time to properly size the timeout.
>  */
> 
> (it's a suggestion, please choose the words you prefer).

thanks for the rephrasing.

Thomas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ