[riot-notifications] [RIOT-OS/RIOT] drivers/at24cxxx: MTD wrapper for at24cxxx (#14110)

fabian18 notifications at github.com
Thu May 21 16:04:10 CEST 2020


@fabian18 commented on this pull request.



> +    assert(PARAMS(mtd));
+    int init = at24cxxx_init(DEV(mtd), PARAMS(mtd));
+    if (init != AT24CXXX_OK) {
+        return init;
+    }
+    mtd->page_size = DEV(mtd)->params.page_size;
+    mtd->pages_per_sector = 1;
+    mtd->sector_count = DEV(mtd)->params.eeprom_size /
+                        DEV(mtd)->params.page_size;
+    return 0;
+}
+
+static int _mtd_at24cxxx_read(mtd_dev_t *mtd, void *dest, uint32_t addr,
+                              uint32_t size)
+{
+    return at24cxxx_read(DEV(mtd), addr, dest, size) == AT24CXXX_OK ? 0 : -EIO;

Are you sure this makes a difference?
```
at24cxxx_read(...) {
...
    return check == AT24CXXX_OK ? check : -EIO;
}
```
It just propagates the value checking to a lower level, while the requirement to return `-EIO` exists on `MTD` level.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14110#discussion_r428671628
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200521/97be517e/attachment.htm>


More information about the notifications mailing list