Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: magnetometer: bmc150_magn_i2c: Add OF device ID table

The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.

But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Javier Martinez Canillas and committed by
Jonathan Cameron
49926b12 58623b33

+9
+9
drivers/iio/magnetometer/bmc150_magn_i2c.c
··· 63 63 }; 64 64 MODULE_DEVICE_TABLE(i2c, bmc150_magn_i2c_id); 65 65 66 + static const struct of_device_id bmc150_magn_of_match[] = { 67 + { .compatible = "bosch,bmc150_magn" }, 68 + { .compatible = "bosch,bmc156_magn" }, 69 + { .compatible = "bosch,bmm150_magn" }, 70 + { } 71 + }; 72 + MODULE_DEVICE_TABLE(of, bmc150_magn_of_match); 73 + 66 74 static struct i2c_driver bmc150_magn_driver = { 67 75 .driver = { 68 76 .name = "bmc150_magn_i2c", 77 + .of_match_table = bmc150_magn_of_match, 69 78 .acpi_match_table = ACPI_PTR(bmc150_magn_acpi_match), 70 79 .pm = &bmc150_magn_pm_ops, 71 80 },