Re: [PATCH v2 2/6] platform/x86: dell-smo8800: Move instantiation of lis3lv02d i2c_client from i2c-i801 to dell-smo8800

Pali Rohár
2024-03-02T11:19:28Z

On Saturday 02 March 2024 12:02:39 Hans de Goede wrote:
> But the point is that moving the code does not help because
> since there is a symbol used from the new code it will still
> get loaded on all machines were the i2c-i801.c driver gets
> loaded. So it will still be taking up RAM and increases
> boot time (loading an extra module consumes time) on machines
> which do not have any SMO88xx devices.
>
> And that point is still valid even independent of the code
> is moved to the existing dell-smo8800 module or to a new
> dell-smo8800-plat module.

This is silly argument if you are opposing to adding trivial exported
function with input argument struct i2c_adapter *adapter and with body

if (smo88xx_detected)
i2c_new_client_device(adapter, &info);

with two static global variables:

struct i2c_board_info info;
bool smo88xx_detected;

will be compiled and loaded on all x86 machines and taking too much RAM.
Because that design with notifiers and other things would eat much more
RAM and would be also slower.

As I said in previous emails, detection (and so filling those two above
static global variables) can be filled in the __init section and so
would not take after bootup. For detection it is is needed to just call
dmi_match(), acpi_get_devices() and dmi_get_system_info() which can be
done in __init section. I do not see reason why not.