Re: [PATCH v4 08/11] i2c: riic: Add support for fast mode plus

From: Andi Shyti
Date: Mon Aug 19 2024 - 16:12:32 EST


Hi Claudiu,

...

> struct riic_dev {
> @@ -311,11 +315,14 @@ static int riic_init_hw(struct riic_dev *riic)
> int total_ticks, cks, brl, brh;
> struct i2c_timings *t = &riic->i2c_t;
> struct device *dev = riic->adapter.dev.parent;
> + const struct riic_of_data *info = riic->info;

Because you are only using info->fast_mode_plus, perhaps you can
directly take:

fast_mode_plus = riic->info->fast_mode_plus;

and you make it even more compact.

>
> - if (t->bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) {
> + if ((!info->fast_mode_plus && t->bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) ||
> + (info->fast_mode_plus && t->bus_freq_hz > I2C_MAX_FAST_MODE_PLUS_FREQ)) {
> dev_err(&riic->adapter.dev,
> - "unsupported bus speed (%dHz). %d max\n",
> - t->bus_freq_hz, I2C_MAX_FAST_MODE_FREQ);
> + "unsupported bus speed (%dHz). %d max\n", t->bus_freq_hz,

super nitpick: can you please put t->bus_freq_hz on a new line,
it looks better to either have everything put in columns or not.

> + info->fast_mode_plus ? I2C_MAX_FAST_MODE_PLUS_FREQ :
> + I2C_MAX_FAST_MODE_FREQ);

another super-nitpick: can you please align
I2C_MAX_FAST_MODE_PLUS_FREQ with I2C_MAX_FAST_MODE_FREQ? It makes
more clear that there is a "? ... :" statement.

Thanks,
Andi

> return -EINVAL;
> }