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

Andrew Lunn
2024-03-07T13:22:03Z

On Thu, Mar 07, 2024 at 07:04:20AM +0000, Parthiban.Veerasooran@microchip.com wrote:
> Hi Andrew,
>
> On 07/03/24 5:49 am, Andrew Lunn wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> >> 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.
> Ok.
> >
> > 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.
> "drop the numbering", do you refer to this patch alone or previous patch
> also? If it is for this patch alone then it makes sense as they are
> going to be 0 and 1 anyway. But if we drop the numbering in the previous
> patch it will become 0 which will create an issue in the below line as
> it needs 1,
>
> FIELD_PREP(OA_TC6_CTRL_HEADER_WRITE, reg_op)

That is why i asked:

> The actual value appears to not matter? It is always
>
> + if (reg_op == OA_TC6_CTRL_REG_WRITE)

So the actual value does matter, so keep it in the previous patch.
Does the value of OA_TC6_CTRL_REG_READ matter? Is it also used in
FIELD_PREP etc? If not, taking away the = 0 will emphasise that
OA_TC6_CTRL_REG_WRITE has to be 1.

Andrew