Skip to content

Commit 6b53609

Browse files
ujfalusikv2019i
authored andcommitted
ASoC: SOF: pipelines: Harmonize all functions to use struct snd_sof_dev
First thing the pipelines function which have "struct device *dev" as parameter do is: struct snd_sof_dev *sdev = dev_get_drvdata(dev); and in all cases the passed dev is actually coming from sdev->dev. Skip this steps and pass directly the sdev to all pipelines related functions as few of them already does this. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 5b851f4 commit 6b53609

4 files changed

Lines changed: 19 additions & 23 deletions

File tree

sound/soc/sof/pm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int sof_resume(struct device *dev, bool runtime_resume)
157157
}
158158

159159
/* restore pipelines */
160-
ret = sof_set_up_pipelines(sdev->dev, false);
160+
ret = sof_set_up_pipelines(sdev, false);
161161
if (ret < 0) {
162162
dev_err(sdev->dev,
163163
"error: failed to restore pipeline after resume %d\n",
@@ -208,7 +208,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
208208
if (target_state == SOF_DSP_PM_D0)
209209
goto suspend;
210210

211-
sof_tear_down_pipelines(dev, false);
211+
sof_tear_down_pipelines(sdev, false);
212212

213213
/* release trace */
214214
snd_sof_release_trace(sdev);

sound/soc/sof/sof-audio.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
204204
break;
205205
case snd_soc_dapm_scheduler:
206206
pipeline = swidget->private;
207-
ret = sof_load_pipeline_ipc(sdev->dev, pipeline, &r);
207+
ret = sof_load_pipeline_ipc(sdev, pipeline, &r);
208208
break;
209209
default:
210210
hdr = swidget->private;
@@ -414,7 +414,7 @@ int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, in
414414
if (pipe_widget->complete)
415415
continue;
416416

417-
pipe_widget->complete = snd_sof_complete_pipeline(sdev->dev, pipe_widget);
417+
pipe_widget->complete = snd_sof_complete_pipeline(sdev, pipe_widget);
418418
if (pipe_widget->complete < 0) {
419419
ret = pipe_widget->complete;
420420
goto widget_free;
@@ -579,9 +579,8 @@ const struct sof_ipc_pipe_new *snd_sof_pipeline_find(struct snd_sof_dev *sdev,
579579
return NULL;
580580
}
581581

582-
int sof_set_up_pipelines(struct device *dev, bool verify)
582+
int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify)
583583
{
584-
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
585584
struct snd_sof_widget *swidget;
586585
struct snd_sof_route *sroute;
587586
int ret;
@@ -638,7 +637,7 @@ int sof_set_up_pipelines(struct device *dev, bool verify)
638637
connect, sizeof(*connect),
639638
&reply, sizeof(reply));
640639
if (ret < 0) {
641-
dev_err(dev,
640+
dev_err(sdev->dev,
642641
"error: failed to load route sink %s control %s source %s\n",
643642
sroute->route->sink,
644643
sroute->route->control ? sroute->route->control
@@ -660,7 +659,7 @@ int sof_set_up_pipelines(struct device *dev, bool verify)
660659
continue;
661660

662661
swidget->complete =
663-
snd_sof_complete_pipeline(dev, swidget);
662+
snd_sof_complete_pipeline(sdev, swidget);
664663
break;
665664
default:
666665
break;
@@ -674,9 +673,8 @@ int sof_set_up_pipelines(struct device *dev, bool verify)
674673
* This function doesn't free widgets during suspend. It only resets the set up status for all
675674
* routes and use_count for all widgets.
676675
*/
677-
int sof_tear_down_pipelines(struct device *dev, bool verify)
676+
int sof_tear_down_pipelines(struct snd_sof_dev *sdev, bool verify)
678677
{
679-
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
680678
struct snd_sof_widget *swidget;
681679
struct snd_sof_route *sroute;
682680
int ret;

sound/soc/sof/sof-audio.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ void snd_sof_control_notify(struct snd_sof_dev *sdev,
181181
* be freed by snd_soc_unregister_component,
182182
*/
183183
int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file);
184-
int snd_sof_complete_pipeline(struct device *dev,
184+
int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
185185
struct snd_sof_widget *swidget);
186186

187-
int sof_load_pipeline_ipc(struct device *dev,
187+
int sof_load_pipeline_ipc(struct snd_sof_dev *sdev,
188188
struct sof_ipc_pipe_new *pipeline,
189189
struct sof_ipc_comp_reply *r);
190190
int sof_pipeline_core_enable(struct snd_sof_dev *sdev,
@@ -246,8 +246,8 @@ int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol,
246246
int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params);
247247

248248
/* PM */
249-
int sof_set_up_pipelines(struct device *dev, bool verify);
250-
int sof_tear_down_pipelines(struct device *dev, bool verify);
249+
int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify);
250+
int sof_tear_down_pipelines(struct snd_sof_dev *sdev, bool verify);
251251
int sof_set_hw_params_upon_resume(struct device *dev);
252252
bool snd_sof_stream_suspend_ignored(struct snd_sof_dev *sdev);
253253
bool snd_sof_dsp_only_d0i3_compatible_stream_active(struct snd_sof_dev *sdev);

sound/soc/sof/topology.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,11 +1690,10 @@ static int sof_widget_load_pcm(struct snd_soc_component *scomp, int index,
16901690
/*
16911691
* Pipeline Topology
16921692
*/
1693-
int sof_load_pipeline_ipc(struct device *dev,
1693+
int sof_load_pipeline_ipc(struct snd_sof_dev *sdev,
16941694
struct sof_ipc_pipe_new *pipeline,
16951695
struct sof_ipc_comp_reply *r)
16961696
{
1697-
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
16981697
int ret = sof_core_enable(sdev, pipeline->core);
16991698

17001699
if (ret < 0)
@@ -1703,7 +1702,7 @@ int sof_load_pipeline_ipc(struct device *dev,
17031702
ret = sof_ipc_tx_message(sdev->ipc, pipeline->hdr.cmd, pipeline,
17041703
sizeof(*pipeline), r, sizeof(*r));
17051704
if (ret < 0)
1706-
dev_err(dev, "error: load pipeline ipc failure\n");
1705+
dev_err(sdev->dev, "error: load pipeline ipc failure\n");
17071706

17081707
return ret;
17091708
}
@@ -3388,15 +3387,14 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
33883387
return ret;
33893388
}
33903389

3391-
int snd_sof_complete_pipeline(struct device *dev,
3390+
int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
33923391
struct snd_sof_widget *swidget)
33933392
{
3394-
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
33953393
struct sof_ipc_pipe_ready ready;
33963394
struct sof_ipc_reply reply;
33973395
int ret;
33983396

3399-
dev_dbg(dev, "tplg: complete pipeline %s id %d\n",
3397+
dev_dbg(sdev->dev, "tplg: complete pipeline %s id %d\n",
34003398
swidget->widget->name, swidget->comp_id);
34013399

34023400
memset(&ready, 0, sizeof(ready));
@@ -3475,21 +3473,21 @@ static int sof_complete(struct snd_soc_component *scomp)
34753473

34763474
/* verify topology components loading including dynamic pipelines */
34773475
if (sof_core_debug & SOF_DBG_VERIFY_TPLG) {
3478-
ret = sof_set_up_pipelines(scomp->dev, true);
3476+
ret = sof_set_up_pipelines(sdev, true);
34793477
if (ret < 0) {
34803478
dev_err(sdev->dev, "error: topology verification failed %d\n", ret);
34813479
return ret;
34823480
}
34833481

3484-
ret = sof_tear_down_pipelines(scomp->dev, true);
3482+
ret = sof_tear_down_pipelines(sdev, true);
34853483
if (ret < 0) {
34863484
dev_err(sdev->dev, "error: topology tear down pipelines failed %d\n", ret);
34873485
return ret;
34883486
}
34893487
}
34903488

34913489
/* set up static pipelines */
3492-
return sof_set_up_pipelines(scomp->dev, false);
3490+
return sof_set_up_pipelines(sdev, false);
34933491
}
34943492

34953493
/* manifest - optional to inform component of manifest */

0 commit comments

Comments
 (0)