Skip to contentSkip to conversation

i2c: slave-eeprom: add an of_match_table

PATCH In review Björn Ardö 2 participants 3 messages May 4, 2021 – Aug 20, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: slave-eeprom: add an of_match_table

This is needed since commit af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF").

---
 drivers/i2c/i2c-slave-eeprom.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/i2c/i2c-slave-eeprom.c +14 -0
index 5c7ae421cacf..89274b72b369 100644
@@ -204,9 +204,23 @@ static const struct i2c_device_id i2c_slave_eeprom_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, i2c_slave_eeprom_id);
 
+static const struct of_device_id i2c_slave_eeprom_match[] = {
+	{ .compatible = "linux,slave-24c02", },
+	{ .compatible = "linux,slave-24c02ro", },
+	{ .compatible = "linux,slave-24c32", },
+	{ .compatible = "linux,slave-24c32ro", },
+	{ .compatible = "linux,slave-24c64", },
+	{ .compatible = "linux,slave-24c64ro", },
+	{ .compatible = "linux,slave-24c512", },
+	{ .compatible = "linux,slave-24c512ro", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, i2c_slave_eeprom_match);
+
 static struct i2c_driver i2c_slave_eeprom_driver = {
 	.driver = {
 		.name = "i2c-slave-eeprom",
+		.of_match_table = i2c_slave_eeprom_match,
 	},
 	.probe = i2c_slave_eeprom_probe,
 	.remove = i2c_slave_eeprom_remove,
Signature · 1 line
2.20.1
#1 lore raw
Quoted 4 lines · Björn Ardö

This is needed since commit af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF").

I'm afraid we need a YAML file, too. checkpatch says:

WARNING: DT compatible string "linux,slave-24c02" appears un-documented -- check ./Documentation/devicetree/bindings/

author
#2 lore raw

Hi,

This is missing for the entire module, so maybe then it should be added for the existing DT-API as a separate patch and then this patch can just add the things it is actually adding to the API? Or do you think it should be included here?

/BA

Quoted 9 lines · Wolfram Sang
Quoted 4 lines · Björn Ardö

This is needed since commit af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF").

I'm afraid we need a YAML file, too. checkpatch says:

WARNING: DT compatible string "linux,slave-24c02" appears un-documented -- check ./Documentation/devicetree/bindings/