Re: [PATCH v2 3/3] platform/chrome: cros_ec_ucsi: Implement UCSI PDC driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/03/2024 10:57, Tzung-Bi Shih wrote:
> On Thu, Mar 28, 2024 at 09:36:54AM +0100, Krzysztof Kozlowski wrote:
>> On 28/03/2024 03:32, Pavan Holla wrote:
>>> On Tue, Mar 26, 2024 at 9:59 PM Krzysztof Kozlowski <krzk@xxxxxxxxxx> wrote:
>>>>
>>>> On 27/03/2024 04:39, Pavan Holla wrote:
>>>>> Hi Krzysztof,
>>>>>
>>>>> Thanks for the review.
>>>>>
>>>>> On Tue, Mar 26, 2024 at 1:47 AM Krzysztof Kozlowski <krzk@xxxxxxxxxx> wrote:
>>>>>> Nothing improved.
>>>>>
>>>>> Yes. I only added maintainers of drivers/platform/chrome in v2. I am
>>>>> still investigating why MODULE_ALIAS() is required.
>>>>
>>>> Heh, I wrote why. You miss ID table.
>>>
>>> This driver is going to be used by the cros_ec_dev.c MFD. The UCSI device doesn’t
>>> have an ACPI or OF entry, so I am not sure how I can use MODULE_DEVICE_TABLE
>>> here. If I don’t use MODULE_ALIAS(“platform:” DRV_NAME),
>>> https://elixir.bootlin.com/linux/latest/source/drivers/mfd/cros_ec_dev.c#L206
>>> isn’t able to automatically associate the driver with the device at boot.
>>> I haven’t upstreamed the change in cros_ec_dev.c yet, but the code is similar to
>>> existing code for drivers/platform/chrome/cros_usbpd_logger.c. There are many
>>> other occurrences of the same MODULE_ALIAS pattern:
>>
>> Just open other platform drivers and look how it is done there. Or ask
>> colleagues. There is absolutely no one in entire Chromium/google who
>> ever wrote platform_driver? platform_driver has ID table for matching.
>>
>> Otherwise how do you expect this to be matched? How your driver is being
>> matched and device bound? By fallback, right? So what is the primary method?
> 
> Those platform devices are adding in drivers/mfd/cros_ec_dev.c via
> mfd_add_hotplug_devices().

This is not matching.

> 
> By looking other use cases of mfd_add_hotplug_devices():
> $ grep -R --files-with-matches mfd_add_hotplug_devices drivers/mfd/
> drivers/mfd/dln2.c
> drivers/mfd/cros_ec_dev.c
> drivers/mfd/viperboard.c
> 
> They also have no ID tables and need MODULE_ALIAS().
> - drivers/gpio/gpio-dln2.c
> - drivers/i2c/busses/i2c-dln2.c
> - drivers/spi/spi-dln2.c
> - drivers/iio/adc/dln2-adc.c
> - drivers/gpio/gpio-viperboard.c
> - drivers/i2c/busses/i2c-viperboard.c
> - drivers/iio/adc/viperboard_adc.c

So if there is a bug in some driver, you are allowed to add it? :) There
is plenty of poor examples, so what I was suggesting to look for good
examples. I agree that itself might be a tricky task.

> I'm not sure whether using the path results in:
> - Lack of device ID table.
> - Need MODULE_ALIAS().
> in the platform device drivers.  And perhaps it relies on the fallback match?

Guys, think for a sec. If you are adding module alias being equivalent
to platform ID table entry, then why you are not using the platform ID
table entry in the first? That's the entire point.

So to repeat myself:
If you need it, usually it means your device ID table is wrong (e.g.
misses either entries or MODULE_DEVICE_TABLE()).

MODULE_ALIAS() is not a substitute for incomplete ID table.

Best regards,
Krzysztof





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux