[PATCH] hwmon: (ltc4151) Export OF device ID table as module aliases

From: Javier Martinez Canillas
Date: Mon Jan 16 2017 - 09:52:53 EST


The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, this means that exporting the OF device ID
table device aliases in the module is not needed. But in order to change
how the core reports modaliases to user-space, it's better to export it.

Before this patch:

$ modinfo drivers/hwmon/ltc4151.ko | grep alias
alias: i2c:ltc4151

After this patch:

$ modinfo drivers/hwmon/ltc4151.ko | grep alias
alias: i2c:ltc4151
alias: of:N*T*Clltc,ltc4151C*
alias: of:N*T*Clltc,ltc4151

Signed-off-by: Javier Martinez Canillas <javier@xxxxxxxxxxxxxxx>
---

drivers/hwmon/ltc4151.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/ltc4151.c b/drivers/hwmon/ltc4151.c
index 8445c9fd946b..b904cb547ffb 100644
--- a/drivers/hwmon/ltc4151.c
+++ b/drivers/hwmon/ltc4151.c
@@ -215,6 +215,7 @@ static const struct of_device_id ltc4151_match[] = {
{ .compatible = "lltc,ltc4151" },
{},
};
+MODULE_DEVICE_TABLE(of, ltc4151_match);

/* This is the driver that will be inserted */
static struct i2c_driver ltc4151_driver = {
--
2.7.4