Lines Matching refs:part

42 	struct sram_partition *part;  in sram_read()  local
44 part = container_of(attr, struct sram_partition, battr); in sram_read()
46 mutex_lock(&part->lock); in sram_read()
47 memcpy_fromio(buf, part->base + pos, count); in sram_read()
48 mutex_unlock(&part->lock); in sram_read()
57 struct sram_partition *part; in sram_write() local
59 part = container_of(attr, struct sram_partition, battr); in sram_write()
61 mutex_lock(&part->lock); in sram_write()
62 memcpy_toio(part->base + pos, buf, count); in sram_write()
63 mutex_unlock(&part->lock); in sram_write()
69 phys_addr_t start, struct sram_partition *part) in sram_add_pool() argument
73 part->pool = devm_gen_pool_create(sram->dev, ilog2(SRAM_GRANULARITY), in sram_add_pool()
75 if (IS_ERR(part->pool)) in sram_add_pool()
76 return PTR_ERR(part->pool); in sram_add_pool()
78 ret = gen_pool_add_virt(part->pool, (unsigned long)part->base, start, in sram_add_pool()
89 phys_addr_t start, struct sram_partition *part) in sram_add_export() argument
91 sysfs_bin_attr_init(&part->battr); in sram_add_export()
92 part->battr.attr.name = devm_kasprintf(sram->dev, GFP_KERNEL, in sram_add_export()
95 if (!part->battr.attr.name) in sram_add_export()
98 part->battr.attr.mode = S_IRUSR | S_IWUSR; in sram_add_export()
99 part->battr.read = sram_read; in sram_add_export()
100 part->battr.write = sram_write; in sram_add_export()
101 part->battr.size = block->size; in sram_add_export()
103 return device_create_bin_file(sram->dev, &part->battr); in sram_add_export()
110 struct sram_partition *part = &sram->partition[sram->partitions]; in sram_add_partition() local
112 mutex_init(&part->lock); in sram_add_partition()
113 part->base = sram->virt_base + block->start; in sram_add_partition()
116 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
121 ret = sram_add_export(sram, block, start, part); in sram_add_partition()
126 ret = sram_check_protect_exec(sram, block, part); in sram_add_partition()
130 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
134 sram_add_protect_exec(part); in sram_add_partition()
144 struct sram_partition *part; in sram_free_partitions() local
149 part = &sram->partition[sram->partitions - 1]; in sram_free_partitions()
150 for (; sram->partitions; sram->partitions--, part--) { in sram_free_partitions()
151 if (part->battr.size) in sram_free_partitions()
152 device_remove_bin_file(sram->dev, &part->battr); in sram_free_partitions()
154 if (part->pool && in sram_free_partitions()
155 gen_pool_avail(part->pool) < gen_pool_size(part->pool)) in sram_free_partitions()