From: Abhishek Paliwal <abhishek.pali...@aricent.com>

From: Aaron Williams <aaron.willi...@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.willi...@cavium.com>
Signed-off-by: Leonid Rosenboim <lrosenb...@caviumnetworks.com>
Signed-off-by: Abhishek Paliwal <abhishek.pali...@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

-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to