Lines Matching refs:cur

114 static int mtd_add_extra_offset(mtd_dev_state_t *cur, size_t *extra_offset)  in mtd_add_extra_offset()  argument
116 io_mtd_ops_t *ops = &cur->dev_spec->ops; in mtd_add_extra_offset()
123 ret = ops->seek(cur->base, cur->pos, extra_offset); in mtd_add_extra_offset()
135 mtd_dev_state_t *cur; in mtd_open() local
143 cur = (mtd_dev_state_t *)dev_info->info; in mtd_open()
144 entity->info = (uintptr_t)cur; in mtd_open()
145 cur->base = region->offset; in mtd_open()
146 cur->pos = 0U; in mtd_open()
147 cur->extra_offset = 0U; in mtd_open()
149 ret = mtd_add_extra_offset(cur, &extra_offset); in mtd_open()
154 cur->base += extra_offset; in mtd_open()
162 mtd_dev_state_t *cur; in mtd_seek() local
168 cur = (mtd_dev_state_t *)entity->info; in mtd_seek()
173 ((unsigned long long)offset >= cur->size)) { in mtd_seek()
177 cur->pos = offset; in mtd_seek()
180 if (((cur->base + cur->pos + (unsigned long long)offset) >= in mtd_seek()
181 cur->size) || in mtd_seek()
182 ((cur->base + cur->pos + (unsigned long long)offset) < in mtd_seek()
183 cur->base + cur->pos)) { in mtd_seek()
187 cur->pos += (unsigned long long)offset; in mtd_seek()
193 ret = mtd_add_extra_offset(cur, &extra_offset); in mtd_seek()
198 cur->extra_offset = extra_offset; in mtd_seek()
206 mtd_dev_state_t *cur; in mtd_read() local
213 cur = (mtd_dev_state_t *)entity->info; in mtd_read()
214 ops = &cur->dev_spec->ops; in mtd_read()
218 cur->base + cur->pos, buffer, length); in mtd_read()
219 if ((cur->base + cur->pos + length) > cur->dev_spec->device_size) { in mtd_read()
223 ret = ops->read(cur->base + cur->pos + cur->extra_offset, buffer, in mtd_read()
230 cur->pos += *out_length; in mtd_read()
244 mtd_dev_state_t *cur; in mtd_dev_open() local
254 cur = (mtd_dev_state_t *)info->info; in mtd_dev_open()
255 cur->dev_spec = (io_mtd_dev_spec_t *)dev_spec; in mtd_dev_open()
257 ops = &(cur->dev_spec->ops); in mtd_dev_open()
259 result = ops->init(&cur->dev_spec->device_size, in mtd_dev_open()
260 &cur->dev_spec->erase_size); in mtd_dev_open()
264 cur->size = cur->dev_spec->device_size; in mtd_dev_open()
266 cur->size = 0ULL; in mtd_dev_open()