Lines Matching refs:desc

481 static ssize_t spi_mem_no_dirmap_read(struct spi_mem_dirmap_desc *desc,  in spi_mem_no_dirmap_read()  argument
484 struct spi_mem_op op = desc->info.op_tmpl; in spi_mem_no_dirmap_read()
487 op.addr.val = desc->info.offset + offs; in spi_mem_no_dirmap_read()
490 ret = spi_mem_adjust_op_size(desc->mem, &op); in spi_mem_no_dirmap_read()
494 ret = spi_mem_exec_op(desc->mem, &op); in spi_mem_no_dirmap_read()
501 static ssize_t spi_mem_no_dirmap_write(struct spi_mem_dirmap_desc *desc, in spi_mem_no_dirmap_write() argument
504 struct spi_mem_op op = desc->info.op_tmpl; in spi_mem_no_dirmap_write()
507 op.addr.val = desc->info.offset + offs; in spi_mem_no_dirmap_write()
510 ret = spi_mem_adjust_op_size(desc->mem, &op); in spi_mem_no_dirmap_write()
514 ret = spi_mem_exec_op(desc->mem, &op); in spi_mem_no_dirmap_write()
539 struct spi_mem_dirmap_desc *desc; in spi_mem_dirmap_create() local
550 desc = kzalloc(sizeof(*desc), GFP_KERNEL); in spi_mem_dirmap_create()
551 if (!desc) in spi_mem_dirmap_create()
554 desc->mem = mem; in spi_mem_dirmap_create()
555 desc->info = *info; in spi_mem_dirmap_create()
557 ret = ctlr->mem_ops->dirmap_create(desc); in spi_mem_dirmap_create()
560 desc->nodirmap = true; in spi_mem_dirmap_create()
561 if (!spi_mem_supports_op(desc->mem, &desc->info.op_tmpl)) in spi_mem_dirmap_create()
568 kfree(desc); in spi_mem_dirmap_create()
572 return desc; in spi_mem_dirmap_create()
583 void spi_mem_dirmap_destroy(struct spi_mem_dirmap_desc *desc) in spi_mem_dirmap_destroy() argument
585 struct spi_controller *ctlr = desc->mem->spi->controller; in spi_mem_dirmap_destroy()
587 if (!desc->nodirmap && ctlr->mem_ops && ctlr->mem_ops->dirmap_destroy) in spi_mem_dirmap_destroy()
588 ctlr->mem_ops->dirmap_destroy(desc); in spi_mem_dirmap_destroy()
590 kfree(desc); in spi_mem_dirmap_destroy()
596 struct spi_mem_dirmap_desc *desc = *(struct spi_mem_dirmap_desc **)res; in devm_spi_mem_dirmap_release() local
598 spi_mem_dirmap_destroy(desc); in devm_spi_mem_dirmap_release()
617 struct spi_mem_dirmap_desc **ptr, *desc; in devm_spi_mem_dirmap_create() local
624 desc = spi_mem_dirmap_create(mem, info); in devm_spi_mem_dirmap_create()
625 if (IS_ERR(desc)) { in devm_spi_mem_dirmap_create()
628 *ptr = desc; in devm_spi_mem_dirmap_create()
632 return desc; in devm_spi_mem_dirmap_create()
656 struct spi_mem_dirmap_desc *desc) in devm_spi_mem_dirmap_destroy() argument
659 devm_spi_mem_dirmap_match, desc); in devm_spi_mem_dirmap_destroy()
679 ssize_t spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc, in spi_mem_dirmap_read() argument
682 struct spi_controller *ctlr = desc->mem->spi->controller; in spi_mem_dirmap_read()
685 if (desc->info.op_tmpl.data.dir != SPI_MEM_DATA_IN) in spi_mem_dirmap_read()
691 if (desc->nodirmap) { in spi_mem_dirmap_read()
692 ret = spi_mem_no_dirmap_read(desc, offs, len, buf); in spi_mem_dirmap_read()
694 ret = spi_mem_access_start(desc->mem); in spi_mem_dirmap_read()
698 ret = ctlr->mem_ops->dirmap_read(desc, offs, len, buf); in spi_mem_dirmap_read()
700 spi_mem_access_end(desc->mem); in spi_mem_dirmap_read()
725 ssize_t spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc, in spi_mem_dirmap_write() argument
728 struct spi_controller *ctlr = desc->mem->spi->controller; in spi_mem_dirmap_write()
731 if (desc->info.op_tmpl.data.dir != SPI_MEM_DATA_OUT) in spi_mem_dirmap_write()
737 if (desc->nodirmap) { in spi_mem_dirmap_write()
738 ret = spi_mem_no_dirmap_write(desc, offs, len, buf); in spi_mem_dirmap_write()
740 ret = spi_mem_access_start(desc->mem); in spi_mem_dirmap_write()
744 ret = ctlr->mem_ops->dirmap_write(desc, offs, len, buf); in spi_mem_dirmap_write()
746 spi_mem_access_end(desc->mem); in spi_mem_dirmap_write()