Skip to content

Commit 1845165

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: cadence: remove PDI offset completely
This offset is set to exactly zero and serves no purpose. Remove. Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Rander Wang <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 8ee1b43 commit 1845165

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

drivers/soundwire/cadence_master.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ EXPORT_SYMBOL(sdw_cdns_enable_interrupt);
12361236

12371237
static int cdns_allocate_pdi(struct sdw_cdns *cdns,
12381238
struct sdw_cdns_pdi **stream,
1239-
u32 num, u32 pdi_offset)
1239+
u32 num)
12401240
{
12411241
struct sdw_cdns_pdi *pdi;
12421242
int i;
@@ -1249,7 +1249,7 @@ static int cdns_allocate_pdi(struct sdw_cdns *cdns,
12491249
return -ENOMEM;
12501250

12511251
for (i = 0; i < num; i++) {
1252-
pdi[i].num = i + pdi_offset;
1252+
pdi[i].num = i;
12531253
}
12541254

12551255
*stream = pdi;
@@ -1266,7 +1266,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
12661266
struct sdw_cdns_stream_config config)
12671267
{
12681268
struct sdw_cdns_streams *stream;
1269-
int offset;
12701269
int ret;
12711270

12721271
cdns->pcm.num_bd = config.pcm_bd;
@@ -1277,24 +1276,15 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
12771276
stream = &cdns->pcm;
12781277

12791278
/* we allocate PDI0 and PDI1 which are used for Bulk */
1280-
offset = 0;
1281-
1282-
ret = cdns_allocate_pdi(cdns, &stream->bd,
1283-
stream->num_bd, offset);
1279+
ret = cdns_allocate_pdi(cdns, &stream->bd, stream->num_bd);
12841280
if (ret)
12851281
return ret;
12861282

1287-
offset += stream->num_bd;
1288-
1289-
ret = cdns_allocate_pdi(cdns, &stream->in,
1290-
stream->num_in, offset);
1283+
ret = cdns_allocate_pdi(cdns, &stream->in, stream->num_in);
12911284
if (ret)
12921285
return ret;
12931286

1294-
offset += stream->num_in;
1295-
1296-
ret = cdns_allocate_pdi(cdns, &stream->out,
1297-
stream->num_out, offset);
1287+
ret = cdns_allocate_pdi(cdns, &stream->out, stream->num_out);
12981288
if (ret)
12991289
return ret;
13001290

@@ -1802,7 +1792,6 @@ EXPORT_SYMBOL(cdns_set_sdw_stream);
18021792
* cdns_find_pdi() - Find a free PDI
18031793
*
18041794
* @cdns: Cadence instance
1805-
* @offset: Starting offset
18061795
* @num: Number of PDIs
18071796
* @pdi: PDI instances
18081797
* @dai_id: DAI id
@@ -1811,14 +1800,13 @@ EXPORT_SYMBOL(cdns_set_sdw_stream);
18111800
* expected to match, return NULL otherwise.
18121801
*/
18131802
static struct sdw_cdns_pdi *cdns_find_pdi(struct sdw_cdns *cdns,
1814-
unsigned int offset,
18151803
unsigned int num,
18161804
struct sdw_cdns_pdi *pdi,
18171805
int dai_id)
18181806
{
18191807
int i;
18201808

1821-
for (i = offset; i < offset + num; i++)
1809+
for (i = 0; i < num; i++)
18221810
if (pdi[i].num == dai_id)
18231811
return &pdi[i];
18241812

@@ -1872,15 +1860,15 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,
18721860
struct sdw_cdns_pdi *pdi = NULL;
18731861

18741862
if (dir == SDW_DATA_DIR_RX)
1875-
pdi = cdns_find_pdi(cdns, 0, stream->num_in, stream->in,
1863+
pdi = cdns_find_pdi(cdns, stream->num_in, stream->in,
18761864
dai_id);
18771865
else
1878-
pdi = cdns_find_pdi(cdns, 0, stream->num_out, stream->out,
1866+
pdi = cdns_find_pdi(cdns, stream->num_out, stream->out,
18791867
dai_id);
18801868

18811869
/* check if we found a PDI, else find in bi-directional */
18821870
if (!pdi)
1883-
pdi = cdns_find_pdi(cdns, 0, stream->num_bd, stream->bd,
1871+
pdi = cdns_find_pdi(cdns, stream->num_bd, stream->bd,
18841872
dai_id);
18851873

18861874
if (pdi) {

0 commit comments

Comments
 (0)