]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: use to_platform_device() instead of container_of()
authorLuoxi Li <lee.lockhey@gmail.com>
Thu, 23 Jan 2025 03:39:37 +0000 (11:39 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 23 Jan 2025 11:29:38 +0000 (11:29 +0000)
Use the to_platform_device() macro where possible.

Signed-off-by: Luoxi Li <lee.lockhey@gmail.com>
Link: https://patch.msgid.link/20250123033937.3587880-1-lee.lockhey@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5514.c
sound/soc/sof/imx/imx8.c
sound/soc/sof/imx/imx8m.c
sound/soc/sof/imx/imx8ulp.c
sound/soc/sof/intel/bdw.c
sound/soc/sof/intel/byt.c
sound/soc/sof/mediatek/mt8186/mt8186.c
sound/soc/sof/mediatek/mt8195/mt8195.c

index 2b3c0f9e178ccb44d74bf484434ca5b308df5de0..9cb74962161a0a2c1a72bb2b1a26f088c246ecf1 100644 (file)
@@ -1091,8 +1091,7 @@ static int rt5514_set_bias_level(struct snd_soc_component *component,
 static int rt5514_probe(struct snd_soc_component *component)
 {
        struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
-       struct platform_device *pdev = container_of(component->dev,
-                                                  struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(component->dev);
 
        rt5514->mclk = devm_clk_get_optional(component->dev, "mclk");
        if (IS_ERR(rt5514->mclk))
index 0b85b29d1067f65f398bd725948e4d0296d380a6..3f6080e6b8a1b4c70697c6e4f741686c147f3421 100644 (file)
@@ -175,8 +175,7 @@ static int imx8_run(struct snd_sof_dev *sdev)
 
 static int imx8_probe(struct snd_sof_dev *sdev)
 {
-       struct platform_device *pdev =
-               container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        struct device_node *np = pdev->dev.of_node;
        struct device_node *res_node;
        struct resource *mmio;
index 4ab5814e9117eef9568d93534ad15de8f4234eb6..8b60e55b106a73171a8794933e52d44db213ce27 100644 (file)
@@ -144,8 +144,7 @@ static int imx8m_reset(struct snd_sof_dev *sdev)
 
 static int imx8m_probe(struct snd_sof_dev *sdev)
 {
-       struct platform_device *pdev =
-               container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        struct device_node *np = pdev->dev.of_node;
        struct device_node *res_node;
        struct resource *mmio;
index 6965791ab6ef64a577358fcf1ff0e5a9288e34f0..0704da27e69d980336e7146d69756a9b6e221aff 100644 (file)
@@ -155,8 +155,7 @@ static int imx8ulp_reset(struct snd_sof_dev *sdev)
 
 static int imx8ulp_probe(struct snd_sof_dev *sdev)
 {
-       struct platform_device *pdev =
-               container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        struct device_node *np = pdev->dev.of_node;
        struct device_node *res_node;
        struct resource *mmio;
index 5282c0071534d47e1029bd1e46285283ba9881b7..e1f0e38c24076b7e9e1614b49a4cbceca726b487 100644 (file)
@@ -410,8 +410,7 @@ static int bdw_probe(struct snd_sof_dev *sdev)
 {
        struct snd_sof_pdata *pdata = sdev->pdata;
        const struct sof_dev_desc *desc = pdata->desc;
-       struct platform_device *pdev =
-               container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        const struct sof_intel_dsp_desc *chip;
        struct resource *mmio;
        u32 base, size;
index 536d4c89d2f02c4ee9ec2595ae1f5164cd8bfa8f..cae7dc0036c6a876503d53b99102103713a94a56 100644 (file)
@@ -109,8 +109,7 @@ static int byt_acpi_probe(struct snd_sof_dev *sdev)
 {
        struct snd_sof_pdata *pdata = sdev->pdata;
        const struct sof_dev_desc *desc = pdata->desc;
-       struct platform_device *pdev =
-               container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        const struct sof_intel_dsp_desc *chip;
        struct resource *mmio;
        u32 base, size;
index 9955dfa520ae2f944884ce464379ed96adb2b9d4..31437fdd4e922a29b349d32e66098bc1b462770f 100644 (file)
@@ -238,7 +238,7 @@ static int mt8186_run(struct snd_sof_dev *sdev)
 
 static int mt8186_dsp_probe(struct snd_sof_dev *sdev)
 {
-       struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        struct adsp_priv *priv;
        int ret;
 
index 6032b566c6795833d2b3e432c7af5eaf436489ce..371563d7ce7952303e47be65dadda2f3996a1271 100644 (file)
@@ -228,7 +228,7 @@ static int mt8195_run(struct snd_sof_dev *sdev)
 
 static int mt8195_dsp_probe(struct snd_sof_dev *sdev)
 {
-       struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        struct adsp_priv *priv;
        int ret;
 
@@ -341,7 +341,7 @@ static int mt8195_dsp_shutdown(struct snd_sof_dev *sdev)
 
 static void mt8195_dsp_remove(struct snd_sof_dev *sdev)
 {
-       struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        struct adsp_priv *priv = sdev->pdata->hw_pdata;
 
        platform_device_unregister(priv->ipc_dev);
@@ -351,7 +351,7 @@ static void mt8195_dsp_remove(struct snd_sof_dev *sdev)
 
 static int mt8195_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)
 {
-       struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(sdev->dev);
        int ret;
        u32 reset_sw, dbg_pc;