All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: boards: Use temporary variable for struct device
@ 2022-03-10  6:53 ` Zhen Ni
  0 siblings, 0 replies; 7+ messages in thread
From: Zhen Ni @ 2022-03-10  6:53 UTC (permalink / raw)
  To: broonie, tiwai, perex; +Cc: alsa-devel, linux-kernel, Zhen Ni

Use temporary variable for struct device to make code neater.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index 1bc21434c9de..d9f4206e1f96 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -538,7 +538,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	const char *platform_name;
 	bool sof_parent;
 
-	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
+	drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL);
 	if (!drv)
 		return -ENOMEM;
 
@@ -559,8 +559,8 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	}
 
 	/* override plaform name, if required */
-	snd_soc_card_cht.dev = &pdev->dev;
-	mach = pdev->dev.platform_data;
+	snd_soc_card_cht.dev = dev;
+	mach = dev->platform_data;
 	platform_name = mach->mach_params.platform;
 
 	ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
@@ -576,9 +576,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	else
 		mclk_name = "pmc_plt_clk_3";
 
-	drv->mclk = devm_clk_get(&pdev->dev, mclk_name);
+	drv->mclk = devm_clk_get(dev, mclk_name);
 	if (IS_ERR(drv->mclk)) {
-		dev_err(&pdev->dev,
+		dev_err(dev,
 			"Failed to get MCLK from %s: %ld\n",
 			mclk_name, PTR_ERR(drv->mclk));
 		return PTR_ERR(drv->mclk);
@@ -594,12 +594,12 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	if (drv->quirks & QUIRK_PMC_PLT_CLK_0) {
 		ret_val = clk_prepare_enable(drv->mclk);
 		if (ret_val < 0) {
-			dev_err(&pdev->dev, "MCLK enable error: %d\n", ret_val);
+			dev_err(dev, "MCLK enable error: %d\n", ret_val);
 			return ret_val;
 		}
 	}
 
-	sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
+	sof_parent = snd_soc_acpi_sof_parent(dev);
 
 	/* set card and driver name */
 	if (sof_parent) {
@@ -614,9 +614,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	if (sof_parent)
 		dev->driver->pm = &snd_soc_pm_ops;
 
-	ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
+	ret_val = devm_snd_soc_register_card(dev, &snd_soc_card_cht);
 	if (ret_val) {
-		dev_err(&pdev->dev,
+		dev_err(dev,
 			"snd_soc_register_card failed %d\n", ret_val);
 		return ret_val;
 	}
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] ASoC: Intel: boards: Use temporary variable for struct device
@ 2022-03-10  6:53 ` Zhen Ni
  0 siblings, 0 replies; 7+ messages in thread
From: Zhen Ni @ 2022-03-10  6:53 UTC (permalink / raw)
  To: broonie, tiwai, perex; +Cc: Zhen Ni, alsa-devel, linux-kernel

Use temporary variable for struct device to make code neater.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index 1bc21434c9de..d9f4206e1f96 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -538,7 +538,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	const char *platform_name;
 	bool sof_parent;
 
-	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
+	drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL);
 	if (!drv)
 		return -ENOMEM;
 
@@ -559,8 +559,8 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	}
 
 	/* override plaform name, if required */
-	snd_soc_card_cht.dev = &pdev->dev;
-	mach = pdev->dev.platform_data;
+	snd_soc_card_cht.dev = dev;
+	mach = dev->platform_data;
 	platform_name = mach->mach_params.platform;
 
 	ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
@@ -576,9 +576,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	else
 		mclk_name = "pmc_plt_clk_3";
 
-	drv->mclk = devm_clk_get(&pdev->dev, mclk_name);
+	drv->mclk = devm_clk_get(dev, mclk_name);
 	if (IS_ERR(drv->mclk)) {
-		dev_err(&pdev->dev,
+		dev_err(dev,
 			"Failed to get MCLK from %s: %ld\n",
 			mclk_name, PTR_ERR(drv->mclk));
 		return PTR_ERR(drv->mclk);
@@ -594,12 +594,12 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	if (drv->quirks & QUIRK_PMC_PLT_CLK_0) {
 		ret_val = clk_prepare_enable(drv->mclk);
 		if (ret_val < 0) {
-			dev_err(&pdev->dev, "MCLK enable error: %d\n", ret_val);
+			dev_err(dev, "MCLK enable error: %d\n", ret_val);
 			return ret_val;
 		}
 	}
 
-	sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
+	sof_parent = snd_soc_acpi_sof_parent(dev);
 
 	/* set card and driver name */
 	if (sof_parent) {
@@ -614,9 +614,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	if (sof_parent)
 		dev->driver->pm = &snd_soc_pm_ops;
 
-	ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
+	ret_val = devm_snd_soc_register_card(dev, &snd_soc_card_cht);
 	if (ret_val) {
-		dev_err(&pdev->dev,
+		dev_err(dev,
 			"snd_soc_register_card failed %d\n", ret_val);
 		return ret_val;
 	}
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: Intel: boards: Use temporary variable for struct device
  2022-03-10  6:53 ` Zhen Ni
  (?)
@ 2022-03-10 15:30 ` Pierre-Louis Bossart
  -1 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2022-03-10 15:30 UTC (permalink / raw)
  To: Zhen Ni, broonie, tiwai, perex; +Cc: alsa-devel, linux-kernel



On 3/10/22 00:53, Zhen Ni wrote:
> Use temporary variable for struct device to make code neater. >
> Signed-off-by: Zhen Ni <nizhen@uniontech.com>

There's quite a few Intel machine drivers where we have the same sort of 
code, we'll need to do a wider cleanup at some point.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   sound/soc/intel/boards/cht_bsw_max98090_ti.c | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
> index 1bc21434c9de..d9f4206e1f96 100644
> --- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
> +++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
> @@ -538,7 +538,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
>   	const char *platform_name;
>   	bool sof_parent;
>   
> -	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
> +	drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL);
>   	if (!drv)
>   		return -ENOMEM;
>   
> @@ -559,8 +559,8 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
>   	}
>   
>   	/* override plaform name, if required */
> -	snd_soc_card_cht.dev = &pdev->dev;
> -	mach = pdev->dev.platform_data;
> +	snd_soc_card_cht.dev = dev;
> +	mach = dev->platform_data;
>   	platform_name = mach->mach_params.platform;
>   
>   	ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
> @@ -576,9 +576,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
>   	else
>   		mclk_name = "pmc_plt_clk_3";
>   
> -	drv->mclk = devm_clk_get(&pdev->dev, mclk_name);
> +	drv->mclk = devm_clk_get(dev, mclk_name);
>   	if (IS_ERR(drv->mclk)) {
> -		dev_err(&pdev->dev,
> +		dev_err(dev,
>   			"Failed to get MCLK from %s: %ld\n",
>   			mclk_name, PTR_ERR(drv->mclk));
>   		return PTR_ERR(drv->mclk);
> @@ -594,12 +594,12 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
>   	if (drv->quirks & QUIRK_PMC_PLT_CLK_0) {
>   		ret_val = clk_prepare_enable(drv->mclk);
>   		if (ret_val < 0) {
> -			dev_err(&pdev->dev, "MCLK enable error: %d\n", ret_val);
> +			dev_err(dev, "MCLK enable error: %d\n", ret_val);
>   			return ret_val;
>   		}
>   	}
>   
> -	sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
> +	sof_parent = snd_soc_acpi_sof_parent(dev);
>   
>   	/* set card and driver name */
>   	if (sof_parent) {
> @@ -614,9 +614,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
>   	if (sof_parent)
>   		dev->driver->pm = &snd_soc_pm_ops;
>   
> -	ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
> +	ret_val = devm_snd_soc_register_card(dev, &snd_soc_card_cht);
>   	if (ret_val) {
> -		dev_err(&pdev->dev,
> +		dev_err(dev,
>   			"snd_soc_register_card failed %d\n", ret_val);
>   		return ret_val;
>   	}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: Intel: boards: Use temporary variable for struct device
  2022-03-10  6:53 ` Zhen Ni
@ 2022-03-11 13:42   ` Mark Brown
  -1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-03-11 13:42 UTC (permalink / raw)
  To: Zhen Ni; +Cc: tiwai, perex, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

On Thu, Mar 10, 2022 at 02:53:54PM +0800, Zhen Ni wrote:
> Use temporary variable for struct device to make code neater.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: Intel: boards: Use temporary variable for struct device
@ 2022-03-11 13:42   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-03-11 13:42 UTC (permalink / raw)
  To: Zhen Ni; +Cc: linux-kernel, alsa-devel, tiwai

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

On Thu, Mar 10, 2022 at 02:53:54PM +0800, Zhen Ni wrote:
> Use temporary variable for struct device to make code neater.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: Intel: boards: Use temporary variable for struct device
  2022-03-11 13:42   ` Mark Brown
  (?)
@ 2022-03-14  3:37   ` 倪振
  -1 siblings, 0 replies; 7+ messages in thread
From: 倪振 @ 2022-03-14  3:37 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, alsa-devel, tiwai



在 2022/3/11 21:42, Mark Brown 写道:
> On Thu, Mar 10, 2022 at 02:53:54PM +0800, Zhen Ni wrote:
>> Use temporary variable for struct device to make code neater.
> 
> This doesn't apply against current code, please check and resend.

I will resend a v2 soon.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: Intel: boards: Use temporary variable for struct device
  2022-03-10  6:53 ` Zhen Ni
                   ` (2 preceding siblings ...)
  (?)
@ 2022-04-07  9:38 ` Mark Brown
  -1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-04-07  9:38 UTC (permalink / raw)
  To: tiwai, perex, nizhen; +Cc: alsa-devel, linux-kernel

On Thu, 10 Mar 2022 14:53:54 +0800, Zhen Ni wrote:
> Use temporary variable for struct device to make code neater.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: Intel: boards: Use temporary variable for struct device
      commit: 8b3520f7f6f6b54bb6b6e50b88f707a6b8113887

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-07  9:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10  6:53 [PATCH] ASoC: Intel: boards: Use temporary variable for struct device Zhen Ni
2022-03-10  6:53 ` Zhen Ni
2022-03-10 15:30 ` Pierre-Louis Bossart
2022-03-11 13:42 ` Mark Brown
2022-03-11 13:42   ` Mark Brown
2022-03-14  3:37   ` 倪振
2022-04-07  9:38 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.