Is platform_device_register() necessary?

Viewed 444

I've read a number of articles about using platfrom device system in Linux. For example, kernel.org document and platform device/driver vs i2c device/driver. As I understand, for using platform device in Linux I need to go through 2 steps:

  1. register the platform driver by platform_driver_register() function;
  2. register the device by platform_device_register() or platform_add_devices() function.

Also it says, it is important to define the same names fields in platform_driver and platform_device structures to bind device to driver (or platform driver to device driver ?).

I looked at platform driver for Synopsys DesignWare I2C device at drivers/i2c/busses/i2c-designware-platdrv.c. It seems to be platform driver and there is platform_driver_register() function call in __init section and driver name is set to i2c_designware. I supposed the appropriate device driver should exist somewhere in kernel source code. So I tried to find it by:

grep -rne "i2c_designware"

There are several file with matching, but nowhwre is there a call of platform_device_register() or platform_add_devices(). So, I see platform driver registration, but don't see platform device registration...

Could somebody explain this?

0 Answers
Related