]> git.karo-electronics.de Git - linux-beck.git/commit
i2c: remove __init from i2c_register_board_info()
authorLuis R. Rodriguez <mcgrof@kernel.org>
Tue, 7 Jun 2016 23:52:27 +0000 (16:52 -0700)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 19 Jun 2016 12:13:50 +0000 (14:13 +0200)
commit5abe9b26847c65a698f38744a52635b287514294
tree59027652b7a4241858f9b6bcb9dd765b48ab086d
parentd4f56c7773483b8829e89cfc739b7a5a071f6da0
i2c: remove __init from i2c_register_board_info()

As of next-20160607 with allyesconfig we get this linker failure:

  MODPOST vmlinux.o
WARNING: vmlinux.o(.text+0x21bc0d): Section mismatch in reference from
the function intel_scu_devices_create() to the function
.init.text:i2c_register_board_info()

This is caused by the fact that intel_scu_devices_create() calls
i2c_register_board_info() and intel_scu_devices_create() is not
annotated with __init. This typically involves manual code
inspection and if one is certain this is correct we would
just peg intel_scu_devices_create() with a __ref annotation.

In this case this would be wrong though as the
intel_scu_devices_create() call is exported, and used in
the ipc_probe() on drivers/platform/x86/intel_scu_ipc.c.
The issue is that even though builtin_pci_driver(ipc_driver)
is used this just exposes the probe routine, which can occur
at any point in time if this bus supports hotplug. A race
can happen between kernel_init_freeable() that calls the init
calls (in this case registeres the intel_scu_ipc.c driver, and
later free_initmem(), which would free the i2c_register_board_info().
If a probe happens later in boot i2c_register_board_info() would
not be present and we should get a page fault.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
[wsa: made function declaration a one-liner]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-boardinfo.c