Lines Matching refs:part
63 struct sram_partition *part; in sram_read() local
65 part = container_of(attr, struct sram_partition, battr); in sram_read()
67 mutex_lock(&part->lock); in sram_read()
68 memcpy_fromio(buf, part->base + pos, count); in sram_read()
69 mutex_unlock(&part->lock); in sram_read()
78 struct sram_partition *part; in sram_write() local
80 part = container_of(attr, struct sram_partition, battr); in sram_write()
82 mutex_lock(&part->lock); in sram_write()
83 memcpy_toio(part->base + pos, buf, count); in sram_write()
84 mutex_unlock(&part->lock); in sram_write()
90 phys_addr_t start, struct sram_partition *part) in sram_add_pool() argument
94 part->pool = devm_gen_pool_create(sram->dev, ilog2(SRAM_GRANULARITY), in sram_add_pool()
96 if (IS_ERR(part->pool)) in sram_add_pool()
97 return PTR_ERR(part->pool); in sram_add_pool()
99 ret = gen_pool_add_virt(part->pool, (unsigned long)part->base, start, in sram_add_pool()
110 phys_addr_t start, struct sram_partition *part) in sram_add_export() argument
112 sysfs_bin_attr_init(&part->battr); in sram_add_export()
113 part->battr.attr.name = devm_kasprintf(sram->dev, GFP_KERNEL, in sram_add_export()
116 if (!part->battr.attr.name) in sram_add_export()
119 part->battr.attr.mode = S_IRUSR | S_IWUSR; in sram_add_export()
120 part->battr.read = sram_read; in sram_add_export()
121 part->battr.write = sram_write; in sram_add_export()
122 part->battr.size = block->size; in sram_add_export()
124 return device_create_bin_file(sram->dev, &part->battr); in sram_add_export()
131 struct sram_partition *part = &sram->partition[sram->partitions]; in sram_add_partition() local
133 mutex_init(&part->lock); in sram_add_partition()
134 part->base = sram->virt_base + block->start; in sram_add_partition()
137 ret = sram_add_pool(sram, block, start, part); in sram_add_partition()
142 ret = sram_add_export(sram, block, start, part); in sram_add_partition()
153 struct sram_partition *part; in sram_free_partitions() local
158 part = &sram->partition[sram->partitions - 1]; in sram_free_partitions()
159 for (; sram->partitions; sram->partitions--, part--) { in sram_free_partitions()
160 if (part->battr.size) in sram_free_partitions()
161 device_remove_bin_file(sram->dev, &part->battr); in sram_free_partitions()
163 if (part->pool && in sram_free_partitions()
164 gen_pool_avail(part->pool) < gen_pool_size(part->pool)) in sram_free_partitions()