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

Terry Bowman
2023-06-08T14:37:03Z

Hi Dan,

On 6/8/23 01:42, Dan Williams wrote:
> Terry Bowman wrote:
>> From: Robert Richter <rrichter@amd.com>
>>
>> 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.
>

Ok, I'll change the structure member names and code to use the following:
struct cxl_dport::dev -> struct cxl_dport::dport_dev

struct cxl_port::uport -> struct cxl_port::uport_dev

Regards,
Terry

>>
>> 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.