Skip to content

Commit 8728483

Browse files
kaixa-leebroonie
authored andcommitted
ASoC: use to_platform_device() instead of container_of()
Use the to_platform_device() macro where possible. Signed-off-by: Luoxi Li <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b9a8ea1 commit 8728483

File tree

8 files changed

+10
-16
lines changed

8 files changed

+10
-16
lines changed

sound/soc/codecs/rt5514.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,8 +1091,7 @@ static int rt5514_set_bias_level(struct snd_soc_component *component,
10911091
static int rt5514_probe(struct snd_soc_component *component)
10921092
{
10931093
struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
1094-
struct platform_device *pdev = container_of(component->dev,
1095-
struct platform_device, dev);
1094+
struct platform_device *pdev = to_platform_device(component->dev);
10961095

10971096
rt5514->mclk = devm_clk_get_optional(component->dev, "mclk");
10981097
if (IS_ERR(rt5514->mclk))

sound/soc/sof/imx/imx8.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ static int imx8_run(struct snd_sof_dev *sdev)
175175

176176
static int imx8_probe(struct snd_sof_dev *sdev)
177177
{
178-
struct platform_device *pdev =
179-
container_of(sdev->dev, struct platform_device, dev);
178+
struct platform_device *pdev = to_platform_device(sdev->dev);
180179
struct device_node *np = pdev->dev.of_node;
181180
struct device_node *res_node;
182181
struct resource *mmio;

sound/soc/sof/imx/imx8m.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ static int imx8m_reset(struct snd_sof_dev *sdev)
144144

145145
static int imx8m_probe(struct snd_sof_dev *sdev)
146146
{
147-
struct platform_device *pdev =
148-
container_of(sdev->dev, struct platform_device, dev);
147+
struct platform_device *pdev = to_platform_device(sdev->dev);
149148
struct device_node *np = pdev->dev.of_node;
150149
struct device_node *res_node;
151150
struct resource *mmio;

sound/soc/sof/imx/imx8ulp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ static int imx8ulp_reset(struct snd_sof_dev *sdev)
155155

156156
static int imx8ulp_probe(struct snd_sof_dev *sdev)
157157
{
158-
struct platform_device *pdev =
159-
container_of(sdev->dev, struct platform_device, dev);
158+
struct platform_device *pdev = to_platform_device(sdev->dev);
160159
struct device_node *np = pdev->dev.of_node;
161160
struct device_node *res_node;
162161
struct resource *mmio;

sound/soc/sof/intel/bdw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ static int bdw_probe(struct snd_sof_dev *sdev)
410410
{
411411
struct snd_sof_pdata *pdata = sdev->pdata;
412412
const struct sof_dev_desc *desc = pdata->desc;
413-
struct platform_device *pdev =
414-
container_of(sdev->dev, struct platform_device, dev);
413+
struct platform_device *pdev = to_platform_device(sdev->dev);
415414
const struct sof_intel_dsp_desc *chip;
416415
struct resource *mmio;
417416
u32 base, size;

sound/soc/sof/intel/byt.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ static int byt_acpi_probe(struct snd_sof_dev *sdev)
109109
{
110110
struct snd_sof_pdata *pdata = sdev->pdata;
111111
const struct sof_dev_desc *desc = pdata->desc;
112-
struct platform_device *pdev =
113-
container_of(sdev->dev, struct platform_device, dev);
112+
struct platform_device *pdev = to_platform_device(sdev->dev);
114113
const struct sof_intel_dsp_desc *chip;
115114
struct resource *mmio;
116115
u32 base, size;

sound/soc/sof/mediatek/mt8186/mt8186.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static int mt8186_run(struct snd_sof_dev *sdev)
238238

239239
static int mt8186_dsp_probe(struct snd_sof_dev *sdev)
240240
{
241-
struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
241+
struct platform_device *pdev = to_platform_device(sdev->dev);
242242
struct adsp_priv *priv;
243243
int ret;
244244

sound/soc/sof/mediatek/mt8195/mt8195.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static int mt8195_run(struct snd_sof_dev *sdev)
228228

229229
static int mt8195_dsp_probe(struct snd_sof_dev *sdev)
230230
{
231-
struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
231+
struct platform_device *pdev = to_platform_device(sdev->dev);
232232
struct adsp_priv *priv;
233233
int ret;
234234

@@ -341,7 +341,7 @@ static int mt8195_dsp_shutdown(struct snd_sof_dev *sdev)
341341

342342
static void mt8195_dsp_remove(struct snd_sof_dev *sdev)
343343
{
344-
struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
344+
struct platform_device *pdev = to_platform_device(sdev->dev);
345345
struct adsp_priv *priv = sdev->pdata->hw_pdata;
346346

347347
platform_device_unregister(priv->ipc_dev);
@@ -351,7 +351,7 @@ static void mt8195_dsp_remove(struct snd_sof_dev *sdev)
351351

352352
static int mt8195_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)
353353
{
354-
struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
354+
struct platform_device *pdev = to_platform_device(sdev->dev);
355355
int ret;
356356
u32 reset_sw, dbg_pc;
357357

0 commit comments

Comments
 (0)