Skip to content

Commit

Permalink
ASoC: use to_platform_device() instead of container_of()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luoxi Li authored and Mark Brown committed Jan 23, 2025
1 parent b9a8ea1 commit 8728483
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 16 deletions.
3 changes: 1 addition & 2 deletions sound/soc/codecs/rt5514.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/imx/imx8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/imx/imx8m.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/imx/imx8ulp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/intel/bdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/intel/byt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/sof/mediatek/mt8186/mt8186.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions sound/soc/sof/mediatek/mt8195/mt8195.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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;

Expand Down

0 comments on commit 8728483

Please sign in to comment.