On 7/16/24 16:40, Jason Gunthorpe wrote:
> On Sun, Jul 14, 2024 at 10:18:12AM +0000, Omer Shpigelman wrote:
>> On 7/12/24 16:08, Jason Gunthorpe wrote:
>>> [You don't often get email from j...@ziepe.ca. Learn why this is important 
>>> at https://aka.ms/LearnAboutSenderIdentification ]
>>>
>>> On Fri, Jun 28, 2024 at 10:24:32AM +0000, Omer Shpigelman wrote:
>>>
>>>> We need the core driver to access the IB driver (and to the ETH driver as
>>>> well). As you wrote, we can't use exported symbols from our IB driver nor
>>>> rely on function pointers, but what about providing the core driver an ops
>>>> structure? meaning exporting a register function from the core driver that
>>>> should be called by the IB driver during auxiliary device probe.
>>>> Something like:
>>>>
>>>> int hbl_cn_register_ib_aux_dev(struct auxiliary_device *adev,
>>>>                              struct hbl_ib_ops *ops)
>>>> {
>>>> ...
>>>> }
>>>> EXPORT_SYMBOL(hbl_cn_register_ib_aux_dev);
>>>
>>> Definately do not do some kind of double-register like this.
>>>
>>> The auxiliary_device scheme can already be extended to provide ops for
>>> each sub device.
>>>
>>> Like
>>>
>>> struct habana_driver {
>>>    struct auxiliary_driver base;
>>>    const struct habana_ops *ops;
>>> };
>>>
>>> If the ops are justified or not is a different question.
>>>
>>
>> Well, I suggested this double-register option because I got a comment that
>> the design pattern of embedded ops structure shouldn't be used.
>> So I'm confused now...
> 
> Yeah, don't stick ops in random places, but the device_driver is the
> right place.
> 

Sorry, let me explain again. My original code has an ops structure
exactly like you are suggesting now (see struct hbl_aux_dev in the first
patch of the series). But I was instructed not to use this ops structure
and to rely on exported symbols for inter-driver communication.
I'll be happy to use this ops structure like in your example rather than
converting my code to use exported symbols.
Leon - am I missing anything? what's the verdict here?

Reply via email to