Re: [PATCH net-next v3 03/12] net: ethernet: oa_tc6: implement register read operation

From: Andrew Lunn
Date: Wed Mar 06 2024 - 19:19:49 EST


> enum oa_tc6_register_op {
> + OA_TC6_CTRL_REG_READ = 0,
> OA_TC6_CTRL_REG_WRITE = 1,
> };

I thought it looked a little odd when the enum was added in the
previous patch with the first value of 1, and only one value. Now it
makes more sense.

The actual value appears to not matter? It is always

> + if (reg_op == OA_TC6_CTRL_REG_WRITE)

So i would drop the numbering, and leave it to the compiler. The
patches will then look less odd.

> +static int oa_tc6_check_ctrl_read_reply(struct oa_tc6 *tc6, u8 size)
> +{
> + u32 *tx_buf = tc6->spi_ctrl_tx_buf;
> + u32 *rx_buf = tc6->spi_ctrl_rx_buf + OA_TC6_CTRL_IGNORED_SIZE;
> +
> + /* The echoed control read header must match with the one that was
> + * transmitted.
> + */
> + if (*tx_buf != *rx_buf)
> + return -ENODEV;

Another case where -EPROTO might be better?

Andrew