eeprom_at24c.c (3b35d4542c8537a9269f6372df531ced6c960084) eeprom_at24c.c (a9262f551eba44d4d0f9e396d7124c059a93e204)
1/*
2 * *AT24C* series I2C EEPROM
3 *
4 * Copyright (c) 2015 Michael Davidsaver
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2. See
7 * the LICENSE file in the top-level directory.
8 */

--- 50 unchanged lines hidden (view full) ---

59 switch (event) {
60 case I2C_START_SEND:
61 case I2C_FINISH:
62 ee->haveaddr = 0;
63 /* fallthrough */
64 case I2C_START_RECV:
65 DPRINTK("clear\n");
66 if (ee->blk && ee->changed) {
1/*
2 * *AT24C* series I2C EEPROM
3 *
4 * Copyright (c) 2015 Michael Davidsaver
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2. See
7 * the LICENSE file in the top-level directory.
8 */

--- 50 unchanged lines hidden (view full) ---

59 switch (event) {
60 case I2C_START_SEND:
61 case I2C_FINISH:
62 ee->haveaddr = 0;
63 /* fallthrough */
64 case I2C_START_RECV:
65 DPRINTK("clear\n");
66 if (ee->blk && ee->changed) {
67 int ret = blk_pwrite(ee->blk, 0, ee->mem, ee->rsize, 0);
67 int ret = blk_pwrite(ee->blk, 0, ee->rsize, ee->mem, 0);
68 if (ret < 0) {
69 ERR(TYPE_AT24C_EE
70 " : failed to write backing file\n");
71 }
72 DPRINTK("Wrote to backing file\n");
73 }
74 ee->changed = false;
75 break;

--- 84 unchanged lines hidden (view full) ---

160
161 ee->changed = false;
162 ee->cur = 0;
163 ee->haveaddr = 0;
164
165 memset(ee->mem, 0, ee->rsize);
166
167 if (ee->blk) {
68 if (ret < 0) {
69 ERR(TYPE_AT24C_EE
70 " : failed to write backing file\n");
71 }
72 DPRINTK("Wrote to backing file\n");
73 }
74 ee->changed = false;
75 break;

--- 84 unchanged lines hidden (view full) ---

160
161 ee->changed = false;
162 ee->cur = 0;
163 ee->haveaddr = 0;
164
165 memset(ee->mem, 0, ee->rsize);
166
167 if (ee->blk) {
168 int ret = blk_pread(ee->blk, 0, ee->mem, ee->rsize, 0);
168 int ret = blk_pread(ee->blk, 0, ee->rsize, ee->mem, 0);
169
170 if (ret < 0) {
171 ERR(TYPE_AT24C_EE
172 " : Failed initial sync with backing file\n");
173 }
174 DPRINTK("Reset read backing file\n");
175 }
176}

--- 38 unchanged lines hidden ---
169
170 if (ret < 0) {
171 ERR(TYPE_AT24C_EE
172 " : Failed initial sync with backing file\n");
173 }
174 DPRINTK("Reset read backing file\n");
175 }
176}

--- 38 unchanged lines hidden ---