Skip to content

Commit c79b39b

Browse files
committed
Revert "add resizing"
This reverts commit 6365975.
1 parent 6365975 commit c79b39b

1 file changed

Lines changed: 2 additions & 51 deletions

File tree

drivers/soc/samsung/cal-if/fvmap.c

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ static void fvmap_apply_gpu_manual_table(volatile struct fvmap_header *header,
9191
size_t capacity = fvmap_ratevolt_capacity(header);
9292
size_t idx;
9393

94-
/* 1. Safety Check: Truncate if physical SRAM map cannot hold it */
9594
if (capacity < manual_count) {
9695
pr_warn(" G3D manual table truncated to %zu entries (capacity %zu)\n",
9796
capacity, manual_count);
@@ -101,61 +100,13 @@ static void fvmap_apply_gpu_manual_table(volatile struct fvmap_header *header,
101100
if (!manual_count)
102101
return;
103102

104-
/* 2. Update SRAM Header (Physical Map) */
105103
memcpy(rate_table->table, g3d_manual_ratevolt,
106104
manual_count * sizeof(struct rate_volt));
107105
header->num_of_lv = manual_count;
108106

109-
/* 3. Reallocate Kernel LUT (Virtual Map) if needed */
110-
if (vclk && vclk->lut) {
111-
112-
/* Check if we are about to overflow the existing array */
113-
if (vclk->num_rates < manual_count) {
114-
pr_info(" G3D: Resizing LUT from %d to %zu entries\n",
115-
vclk->num_rates, manual_count);
116-
117-
/* Allocate new larger array (zero-initialized) */
118-
/* Using typeof avoids needing the exact struct name */
119-
void *new_lut = kcalloc(manual_count, sizeof(*vclk->lut), GFP_KERNEL);
120-
121-
if (!new_lut) {
122-
pr_err(" G3D: Failed to allocate memory for manual table!\n");
123-
return; /* Abort to prevent crash */
124-
}
125-
126-
/* Copy existing data to preserve params (dividers/mux settings) */
127-
/* We copy the amount that fit in the OLD array */
128-
memcpy(new_lut, vclk->lut, vclk->num_rates * sizeof(*vclk->lut));
129-
130-
/* * OPTIONAL: Duplicate parameters for the new extended entries.
131-
* New entries (11, 12) are currently 0. We usually want them
132-
* to have the same bus/divider params as the highest previous level.
133-
*/
134-
if (vclk->num_rates > 0) {
135-
size_t old_last = vclk->num_rates - 1;
136-
size_t entry_size = sizeof(*vclk->lut);
137-
char *lut_base = (char *)new_lut;
138-
139-
for (idx = vclk->num_rates; idx < manual_count; idx++) {
140-
memcpy(lut_base + (idx * entry_size),
141-
lut_base + (old_last * entry_size),
142-
entry_size);
143-
}
144-
}
145-
146-
/* Free the old small array */
147-
kfree(vclk->lut);
148-
149-
/* Point vclk to the new big array */
150-
vclk->lut = new_lut;
151-
152-
/* Update the size tracking variable */
153-
vclk->num_rates = manual_count;
154-
}
155-
}
107+
if (vclk && vclk->lut && vclk->num_rates < manual_count)
108+
vclk->num_rates = manual_count;
156109

157-
/* 4. Populate the Rates */
158-
/* Now this loop is safe because vclk->lut is 13 entries big */
159110
if (vclk && vclk->lut) {
160111
for (idx = 0; idx < manual_count && idx < vclk->num_rates; idx++)
161112
vclk->lut[idx].rate = g3d_manual_ratevolt[idx].rate;

0 commit comments

Comments
 (0)