[linux-yocto] [PATCH 07/12] misc/at24: Register memory accessor functions with of_memory_accessor
Chandrakala Chavva
cchavva.cavm at gmail.com
Thu Jan 29 07:32:06 PST 2015
From: Abhishek Paliwal <abhishek.paliwal at aricent.com>
From: Aaron Williams <aaron.williams at cavium.com>
The at24 module will now register its memory accessor functions with its
device tree entry so that other modules may call these functions based on
the device tree node.
Signed-off-by: Aaron Williams <aaron.williams at cavium.com>
Signed-off-by: Leonid Rosenboim <lrosenboim at caviumnetworks.com>
Signed-off-by: Abhishek Paliwal <abhishek.paliwal at aricent.com>
---
drivers/misc/eeprom/at24.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index d87f77f..fdd5a6c 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -23,6 +23,7 @@
#include <linux/of.h>
#include <linux/i2c.h>
#include <linux/platform_data/at24.h>
+#include <linux/of_memory_accessor.h>
/*
* I2C EEPROMs from most vendors are inexpensive and mostly interchangeable.
@@ -637,6 +638,9 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
if (chip.setup)
chip.setup(&at24->macc, chip.context);
+ if (client->dev.of_node)
+ of_memory_accessor_register(&client->dev, &at24->macc);
+
return 0;
err_clients:
@@ -655,6 +659,9 @@ static int at24_remove(struct i2c_client *client)
at24 = i2c_get_clientdata(client);
sysfs_remove_bin_file(&client->dev.kobj, &at24->bin);
+ if (client->dev.of_node)
+ of_memory_accessor_remove(&client->dev);
+
for (i = 1; i < at24->num_addresses; i++)
i2c_unregister_device(at24->client[i]);
--
1.8.1.4
More information about the linux-yocto
mailing list