RFC Early device registration
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest4 patches 14 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | driver core: Register SoC bus after platform busdrivers/ drivers/ drivers/ | +7 | 0 replies | |
| 2/4 | driver core: Allow early registration of devicesdrivers/ drivers/ drivers/ | +112 | 14 replies | |
| 3/4 | ARM: tegra: Call of_platform_populate() earlyarch/ arch/ | +33 | 0 replies | |
| 4/4 | OF: Add device pointer to struct device_nodedrivers/ drivers/ include/ | +5 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC 0/4] Early device registration
This patch series is the result of some earlier discussion[0]. Some drivers need to probe their devices very early in the boot process (such as IRQ chip drivers). However there is no struct device available at that time because they are added a lot later.
The most notable case where this happens is for systems that are booted using a device tree. A lot of those early drivers work around the issue by "binding" themselves to the struct device_node. One disadvantage of that is that they cannot use APIs that require a struct device (such as regmap). Another downside is that it introduces inconsistencies in how drivers are written.
In order to remedy that situation, this patch series introduces a way to register devices earlier. This is more difficult than it sounds. One of the problems is that kmalloc() is required during device registration. Another prerequisite is sysfs since every device is represented in the sysfs tree. To allow a device to be created before sysfs is available, only the very minimal set of operations are performed at the early stage and the device is added to a list of early devices that will be fully registered once all the necessary infrastructure is available. This is somewhat inspired by and therefore similar to deferred driver probing.
By no means is this patch series complete. I was able to boot a Tegra device to a boot prompt without any serious regressions. One thing I did notice is that somehow this series causes udev not to rename ethernet devices (f.e. eth0 to enp1s0) which it does without that patch set.
One thing that this set of patches doesn't address yet is a way to probe devices early, which might be required for some use-cases. However I'm looking for some feedback before going further down this road.
Thierry
[0]: https://lists.ozlabs.org/pipermail/devicetree-discuss/2013-June/036542.html
Thierry Reding (4):
driver core: Register SoC bus after platform bus driver core: Allow early registration of devices
ARM: tegra: Call of_platform_populate() early
OF: Add device pointer to struct device_node
arch/arm/mach-tegra/common.c | 33 +++++++++++++ arch/arm/mach-tegra/tegra.c | 32 ------------- drivers/base/base.h | 8 ++++ drivers/base/core.c | 107 +++++++++++++++++++++++++++++++++++++++++++ drivers/base/init.c | 3 ++ drivers/base/soc.c | 11 +---- drivers/of/device.c | 2 + drivers/of/platform.c | 10 +--- include/linux/of.h | 2 + 9 files changed, 157 insertions(+), 51 deletions(-)
Signature · 1 line
1.8.3.4