RE: [PATCH v5 03/26] cxl: Rename member @dport of struct cxl_dport to @dev

From: Dan Williams
Date: Thu Jun 08 2023 - 02:42:25 EST


Terry Bowman wrote:
> From: Robert Richter <rrichter@xxxxxxx>
>
> Reading code like dport->dport does not immediately suggest that this
> points to the corresponding device structure of the dport. Rename
> struct member @dport to @dev.

This one I don't agree with.

This can switch to ->dport_dev if you like. The reason for ->dport was
for symmetry with the ->uport of a 'struct cxl_port'. So if you change
this to ->dport_dev then also make the ->uport_dev change for symmetry.

Unlike a 'struct cxl_port' a 'struct cxl_dport' is not a device in its
own right which is what I see when I read dport->dev.

>
> While at it, also rename @new argument of add_dport() to @dport. This
> better describes the variable as a dport (e.g. new->dport becomes to
> dport->dev).

There is already other occurrences of dport_dev as an argument, so I
think that works here too.