Re: [PATCH v2 02/10] PCI: endpoint: Decouple EPC and PCIe bus specific events
From: Damien Le Moal
Date: Wed Apr 03 2024 - 22:41:14 EST
On 4/3/24 23:26, Manivannan Sadhasivam wrote:
> On Tue, Apr 02, 2024 at 09:14:20AM +0900, Damien Le Moal wrote:
>> On 4/2/24 00:50, Manivannan Sadhasivam wrote:
>>> Currently, 'struct pci_epc_event_ops' has a bunch of events that are sent
>>> from the EPC driver to EPF driver. But those events are a mix of EPC
>>> specific events like core_init and PCIe bus specific events like LINK_UP,
>>> LINK_DOWN, BME etc...
>>>
>>> Let's decouple them to respective structs (pci_epc_event_ops,
>>> pci_epc_bus_event_ops) to make the separation clear.
>>
>> I fail to see the benefits here. The event operation names are quite clear and,
>> in my opinion, it is clear if an event op applies to the controller or to the
>> bus/link. If anything, "core_init" could a little more clear, so renaming that
>> "ep_controller_init" or something like that (clearly spelling out what is being
>> initialized) seems enough to me. Similarly, the "bme" op name is very criptic.
>> Renaming that to "bus_master_enable" would go a long way clarifying the code.
>> For link events, "link_up", "link_down" are clear. So I think there is no need
>> to split the event op struct like this. Renaming the ops is better.
>>
>> Note that I am not opposed to this patch, but I think it is just code churn
>> that does not really bring any fundamental improvement. Regardless, renaming
>> "core_init" and "bme" ops is I think desired.
>>
>
> Niklas shared the same view during v1, but I hate to see the events being mixed
> in a single ops. Especially that it will confuse the developers who are not
> familiar with the EP subsystem.
>
> But since the argument is coming twice, I've decided to drop this for now and
> just rename the 'core_init' callback to 'epc_init' and name the deinit callback
> as 'epc_deinit'.
Sounds good. Please also rename the completely unclear "bme" operation. Spell it
out to be clear.
--
Damien Le Moal
Western Digital Research