linux/drivers/i2c
Hans de Goede 60f6859702 i2c: core: Setup i2c_adapter runtime-pm before calling device_add()
Platform glue code, which is not build into the kernel and thus cannot
use i2c_register_board_info() may want to use bus_register_notifier()
to listen for i2c-adapters to show up on which the platform code needs
to manually instantiate platform specific i2c_clients.

This results in calling i2c_new_client_device() from the bus notifier
which happens near the device_add() call.

If the i2c-core has not yet setup runtime-pm (specifically the
no-callbacks and ignore-children flags) for the device embedded
inside struct i2c_adapter and the driver for the i2c_client
calls pm_runtime_set_active() this will trigger the following
error inside __pm_runtime_set_status():

"runtime PM trying to activate child device %s but parent (%s) is not active\n"

and the i2c_client's runtime-status will not be updated.

Split the device_register() call for the adapter into device_initialize()
and device_add() and move the pm-runtime init calls inbetween these 2 calls
so that the runtime-status can be correctly set when a driver binds from
the bus-notifier.

Note the moved pm-runtime init calls just override the initial value of
some flags in struct device set by device_initialize() and calling these
before device_add() is safe.

Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-09-10 00:36:56 +02:00
..
algos i2c: algo: bit: allow getsda to be NULL 2023-01-23 23:15:49 +01:00
busses i2c: ismt: kill transaction in hardware on timeout 2024-09-10 00:36:55 +02:00
muxes i2c: muxes: add support for tsd,mule-i2c multiplexer 2024-09-10 00:36:47 +02:00
i2c-atr.c i2c: Annotate struct i2c_atr with __counted_by 2023-09-24 22:50:25 +02:00
i2c-boardinfo.c
i2c-core-acpi.c i2c: acpi: Unbind mux adapters before delete 2024-05-06 09:17:38 +02:00
i2c-core-base.c i2c: core: Setup i2c_adapter runtime-pm before calling device_add() 2024-09-10 00:36:56 +02:00
i2c-core-of.c Char/Misc drivers for 6.4-rc1 2023-04-27 12:07:50 -07:00
i2c-core-slave.c
i2c-core-smbus.c
i2c-core.h i2c: core: Fix atomic xfer check for non-preempt config 2024-01-06 14:10:10 +01:00
i2c-dev.c i2c: dev: Check for I2C_FUNC_I2C before calling i2c_transfer 2024-06-26 12:45:25 +02:00
i2c-mux.c i2c: mux: Remove class argument from i2c_mux_add_adapter() 2024-05-13 16:13:19 +02:00
i2c-slave-eeprom.c i2c: Convert drivers to new .probe() callback 2023-03-09 21:59:30 +01:00
i2c-slave-testunit.c i2c: testunit: match HostNotify test name with docs 2024-08-08 07:20:33 +02:00
i2c-smbus.c i2c: smbus: Send alert notifications to all devices if source not found 2024-08-04 16:29:34 +02:00
i2c-stub.c i2c: stub: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
Kconfig i2c: testunit: correct Kconfig description 2024-07-11 11:27:22 +02:00
Makefile media: i2c: add I2C Address Translator (ATR) support 2023-07-14 13:11:44 +02:00