Lines Matching refs:part
29 struct sram_partition *part; in sram_read() local
31 part = container_of(attr, struct sram_partition, battr); in sram_read()
33 mutex_lock(&part->lock); in sram_read()
34 memcpy_fromio(buf, part->base + pos, count); in sram_read()
35 mutex_unlock(&part->lock); in sram_read()
44 struct sram_partition *part; in sram_write() local
46 part = container_of(attr, struct sram_partition, battr); in sram_write()
48 mutex_lock(&part->lock); in sram_write()
49 memcpy_toio(part->base + pos, buf, count); in sram_write()
50 mutex_unlock(&part->lock); in sram_write()
56 phys_addr_t start, struct sram_partition *part) in sram_add_pool() argument
60 part->pool = devm_gen_pool_create(sram->dev, ilog2(SRAM_GRANULARITY), in sram_add_pool()
62 if (IS_ERR(part->pool)) in sram_add_pool()
63 return PTR_ERR(part->pool); in sram_add_pool()
65 ret = gen_pool_add_virt(part->pool, (unsigned long)part->base, start, in sram_add_pool()
76 phys_addr_t start, struct sram_partition *part) in sram_add_export() argument
78 sysfs_bin_attr_init(&part->battr); in sram_add_export()
79 part->battr.attr.name = devm_kasprintf(sram->dev, GFP_KERNEL, in sram_add_export()
82 if (!part->battr.attr.name) in sram_add_export()
85 part->battr.attr.mode = S_IRUSR | S_IWUSR; in sram_add_export()
86 part->battr.read = sram_read; in sram_add_export()
87 part->battr.write = sram_write; in sram_add_export()
88 part->battr.size = block->size; in sram_add_export()
90 return device_create_bin_file(sram->dev, &part->battr); in sram_add_export()
97 struct sram_partition *part = &sram->partition[sram->partitions]; in sram_add_partition() local
99 mutex_init(&part->lock); in sram_add_partition()
100 part->base = sram->virt_base + block->start; in sram_add_partition()
103 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
108 ret = sram_add_export(sram, block, start, part); in sram_add_partition()
113 ret = sram_check_protect_exec(sram, block, part); in sram_add_partition()
117 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
121 sram_add_protect_exec(part); in sram_add_partition()
131 struct sram_partition *part; in sram_free_partitions() local
136 part = &sram->partition[sram->partitions - 1]; in sram_free_partitions()
137 for (; sram->partitions; sram->partitions--, part--) { in sram_free_partitions()
138 if (part->battr.size) in sram_free_partitions()
139 device_remove_bin_file(sram->dev, &part->battr); in sram_free_partitions()
141 if (part->pool && in sram_free_partitions()
142 gen_pool_avail(part->pool) < gen_pool_size(part->pool)) in sram_free_partitions()