Lines Matching refs:part
29 struct sram_partition *part; in sram_read() local
32 part = (struct sram_partition *)container_of(attr, struct sram_partition, battr); in sram_read()
34 mutex_lock(&part->lock); in sram_read()
35 memcpy_fromio(buf, part->base + pos, count); in sram_read()
36 mutex_unlock(&part->lock); in sram_read()
45 struct sram_partition *part; in sram_write() local
48 part = (struct sram_partition *)container_of(attr, struct sram_partition, battr); in sram_write()
50 mutex_lock(&part->lock); in sram_write()
51 memcpy_toio(part->base + pos, buf, count); in sram_write()
52 mutex_unlock(&part->lock); in sram_write()
58 phys_addr_t start, struct sram_partition *part) in sram_add_pool() argument
62 part->pool = devm_gen_pool_create(sram->dev, ilog2(SRAM_GRANULARITY), in sram_add_pool()
64 if (IS_ERR(part->pool)) in sram_add_pool()
65 return PTR_ERR(part->pool); in sram_add_pool()
67 ret = gen_pool_add_virt(part->pool, (unsigned long)part->base, start, in sram_add_pool()
78 phys_addr_t start, struct sram_partition *part) in sram_add_export() argument
80 sysfs_bin_attr_init(&part->battr); in sram_add_export()
81 part->battr.attr.name = devm_kasprintf(sram->dev, GFP_KERNEL, in sram_add_export()
84 if (!part->battr.attr.name) in sram_add_export()
87 part->battr.attr.mode = S_IRUSR | S_IWUSR; in sram_add_export()
88 part->battr.read = sram_read; in sram_add_export()
89 part->battr.write = sram_write; in sram_add_export()
90 part->battr.size = block->size; in sram_add_export()
92 return device_create_bin_file(sram->dev, &part->battr); in sram_add_export()
99 struct sram_partition *part = &sram->partition[sram->partitions]; in sram_add_partition() local
101 mutex_init(&part->lock); in sram_add_partition()
116 part->base = virt_base; in sram_add_partition()
118 part->base = sram->virt_base + block->start; in sram_add_partition()
122 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
127 ret = sram_add_export(sram, block, start, part); in sram_add_partition()
132 ret = sram_check_protect_exec(sram, block, part); in sram_add_partition()
136 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
140 sram_add_protect_exec(part); in sram_add_partition()
150 struct sram_partition *part; in sram_free_partitions() local
155 part = &sram->partition[sram->partitions - 1]; in sram_free_partitions()
156 for (; sram->partitions; sram->partitions--, part--) { in sram_free_partitions()
157 if (part->battr.size) in sram_free_partitions()
158 device_remove_bin_file(sram->dev, &part->battr); in sram_free_partitions()
160 if (part->pool && in sram_free_partitions()
161 gen_pool_avail(part->pool) < gen_pool_size(part->pool)) in sram_free_partitions()