Skip to content

Commit 3128aae

Browse files
Alex Elderdavem330
authored andcommitted
net: ipa: redefine struct ipa_mem_data
The ipa_mem_data structure type was never actually used. Instead, the IPA memory regions were defined using the ipa_mem structure. Redefine struct ipa_mem_data so it encapsulates the array of IPA-local memory region descriptors along with the count of entries in that array. Pass just an ipa_mem structure pointer to ipa_mem_init(). Rename the ipa_mem_data[] array ipa_mem_local_data[] to emphasize that the memory regions it defines are IPA-local memory. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8456c54 commit 3128aae

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

drivers/net/ipa/ipa_data-sc7180.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static const struct ipa_resource_data ipa_resource_data = {
193193
};
194194

195195
/* IPA-resident memory region configuration for the SC7180 SoC. */
196-
static const struct ipa_mem ipa_mem_data[] = {
196+
static const struct ipa_mem ipa_mem_local_data[] = {
197197
[IPA_MEM_UC_SHARED] = {
198198
.offset = 0x0000,
199199
.size = 0x0080,
@@ -296,12 +296,16 @@ static const struct ipa_mem ipa_mem_data[] = {
296296
},
297297
};
298298

299+
static struct ipa_mem_data ipa_mem_data = {
300+
.local_count = ARRAY_SIZE(ipa_mem_local_data),
301+
.local = ipa_mem_local_data,
302+
};
303+
299304
/* Configuration data for the SC7180 SoC. */
300305
const struct ipa_data ipa_data_sc7180 = {
301306
.version = IPA_VERSION_4_2,
302307
.endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
303308
.endpoint_data = ipa_gsi_endpoint_data,
304309
.resource_data = &ipa_resource_data,
305-
.mem_count = ARRAY_SIZE(ipa_mem_data),
306-
.mem_data = ipa_mem_data,
310+
.mem_data = &ipa_mem_data,
307311
};

drivers/net/ipa/ipa_data-sdm845.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static const struct ipa_resource_data ipa_resource_data = {
235235
};
236236

237237
/* IPA-resident memory region configuration for the SDM845 SoC. */
238-
static const struct ipa_mem ipa_mem_data[] = {
238+
static const struct ipa_mem ipa_mem_local_data[] = {
239239
[IPA_MEM_UC_SHARED] = {
240240
.offset = 0x0000,
241241
.size = 0x0080,
@@ -318,12 +318,16 @@ static const struct ipa_mem ipa_mem_data[] = {
318318
},
319319
};
320320

321+
static struct ipa_mem_data ipa_mem_data = {
322+
.local_count = ARRAY_SIZE(ipa_mem_local_data),
323+
.local = ipa_mem_local_data,
324+
};
325+
321326
/* Configuration data for the SDM845 SoC. */
322327
const struct ipa_data ipa_data_sdm845 = {
323328
.version = IPA_VERSION_3_5_1,
324329
.endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
325330
.endpoint_data = ipa_gsi_endpoint_data,
326331
.resource_data = &ipa_resource_data,
327-
.mem_count = ARRAY_SIZE(ipa_mem_data),
328-
.mem_data = ipa_mem_data,
332+
.mem_data = &ipa_mem_data,
329333
};

drivers/net/ipa/ipa_data.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,12 @@ struct ipa_resource_data {
246246

247247
/**
248248
* struct ipa_mem - IPA-local memory region description
249-
* @offset: offset in IPA memory space to base of the region
250-
* @size: size in bytes base of the region
251-
* @canary_count: number of 32-bit "canary" values that precede region
249+
* @local_count: number of regions defined in the local[] array
250+
* @local: array of IPA-local memory region descriptors
252251
*/
253252
struct ipa_mem_data {
254-
u32 offset;
255-
u16 size;
256-
u16 canary_count;
253+
u32 local_count;
254+
const struct ipa_mem *local;
257255
};
258256

259257
/**
@@ -270,8 +268,7 @@ struct ipa_data {
270268
u32 endpoint_count; /* # entries in endpoint_data[] */
271269
const struct ipa_gsi_endpoint_data *endpoint_data;
272270
const struct ipa_resource_data *resource_data;
273-
u32 mem_count; /* # entries in mem_data[] */
274-
const struct ipa_mem *mem_data;
271+
const struct ipa_mem_data *mem_data;
275272
};
276273

277274
extern const struct ipa_data ipa_data_sdm845;

drivers/net/ipa/ipa_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ static int ipa_probe(struct platform_device *pdev)
778778
if (ret)
779779
goto err_kfree_ipa;
780780

781-
ret = ipa_mem_init(ipa, data->mem_count, data->mem_data);
781+
ret = ipa_mem_init(ipa, data->mem_data);
782782
if (ret)
783783
goto err_reg_exit;
784784

drivers/net/ipa/ipa_mem.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "ipa.h"
1414
#include "ipa_reg.h"
15+
#include "ipa_data.h"
1516
#include "ipa_cmd.h"
1617
#include "ipa_mem.h"
1718
#include "ipa_data.h"
@@ -266,15 +267,15 @@ int ipa_mem_zero_modem(struct ipa *ipa)
266267
}
267268

268269
/* Perform memory region-related initialization */
269-
int ipa_mem_init(struct ipa *ipa, u32 count, const struct ipa_mem *mem)
270+
int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data)
270271
{
271272
struct device *dev = &ipa->pdev->dev;
272273
struct resource *res;
273274
int ret;
274275

275-
if (count > IPA_MEM_COUNT) {
276+
if (mem_data->local_count > IPA_MEM_COUNT) {
276277
dev_err(dev, "to many memory regions (%u > %u)\n",
277-
count, IPA_MEM_COUNT);
278+
mem_data->local_count, IPA_MEM_COUNT);
278279
return -EINVAL;
279280
}
280281

@@ -302,7 +303,7 @@ int ipa_mem_init(struct ipa *ipa, u32 count, const struct ipa_mem *mem)
302303
ipa->mem_size = resource_size(res);
303304

304305
/* The ipa->mem[] array is indexed by enum ipa_mem_id values */
305-
ipa->mem = mem;
306+
ipa->mem = mem_data->local;
306307

307308
return 0;
308309
}

drivers/net/ipa/ipa_mem.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define _IPA_MEM_H_
88

99
struct ipa;
10+
struct ipa_mem_data;
1011

1112
/**
1213
* DOC: IPA Local Memory
@@ -84,7 +85,7 @@ void ipa_mem_teardown(struct ipa *ipa);
8485

8586
int ipa_mem_zero_modem(struct ipa *ipa);
8687

87-
int ipa_mem_init(struct ipa *ipa, u32 count, const struct ipa_mem *mem);
88+
int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data);
8889
void ipa_mem_exit(struct ipa *ipa);
8990

9091
#endif /* _IPA_MEM_H_ */

0 commit comments

Comments
 (0)