* [PATCH] ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer
@ 2026-04-27 14:46 Sachin Mokashi
2026-04-27 15:19 ` Cezary Rojewski
2026-04-27 22:44 ` Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Sachin Mokashi @ 2026-04-27 14:46 UTC (permalink / raw)
To: broonie
Cc: linux-sound, alsa-devel, tiwai, pierre-louis.bossart,
cezary.rojewski, Sachin Mokashi
In snd_cht_mc_probe(), &pdev->dev is dereferenced repeatedly throughout
the function. Introduce a local dev pointer
early in the function and use it consistently in place of all open-coded
&pdev->dev references.
It reduces repetition, improves readability, and aligns with the common
kernel driver pattern of caching the device pointer at function entry.
Signed-off-by: Sachin Mokashi <sachin.mokashi@intel.com>
---
sound/soc/intel/boards/cht_bsw_rt5672.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index 359723f2700e..0c6a3b6829a7 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -450,12 +450,13 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
struct cht_mc_private *drv;
struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
const char *platform_name;
+ struct device *dev = &pdev->dev;
struct acpi_device *adev;
bool sof_parent;
int dai_index = 0;
int i;
- drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
+ drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL);
if (!drv)
return -ENOMEM;
@@ -477,7 +478,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
"i2c-%s", acpi_dev_name(adev));
cht_dailink[dai_index].codecs->name = drv->codec_name;
} else {
- dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+ dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
return -ENOENT;
}
@@ -490,7 +491,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
}
/* override platform name, if required */
- snd_soc_card_cht.dev = &pdev->dev;
+ snd_soc_card_cht.dev = dev;
platform_name = mach->mach_params.platform;
ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
@@ -500,16 +501,16 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
snd_soc_card_cht.components = rt5670_components();
- drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
+ drv->mclk = devm_clk_get(dev, "pmc_plt_clk_3");
if (IS_ERR(drv->mclk)) {
- dev_err(&pdev->dev,
+ dev_err(dev,
"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
PTR_ERR(drv->mclk));
return PTR_ERR(drv->mclk);
}
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
- 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) {
@@ -525,9 +526,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
pdev->dev.driver->pm = &snd_soc_pm_ops;
/* register the soc card */
- 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.34.1
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer
2026-04-27 14:46 [PATCH] ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer Sachin Mokashi
@ 2026-04-27 15:19 ` Cezary Rojewski
2026-04-28 12:54 ` Mokashi, Sachin
2026-04-27 22:44 ` Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Cezary Rojewski @ 2026-04-27 15:19 UTC (permalink / raw)
To: Sachin Mokashi
Cc: linux-sound, alsa-devel, tiwai, pierre-louis.bossart, Mark Brown
On 2026-04-27 4:46 PM, Sachin Mokashi wrote:
> In snd_cht_mc_probe(), &pdev->dev is dereferenced repeatedly throughout
> the function. Introduce a local dev pointer
> early in the function and use it consistently in place of all open-coded
> &pdev->dev references.
>
> It reduces repetition, improves readability, and aligns with the common
> kernel driver pattern of caching the device pointer at function entry.
One nit below but it's not a strong for v2. For the patch:
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
> @@ -450,12 +450,13 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
> struct cht_mc_private *drv;
> struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
> const char *platform_name;
> + struct device *dev = &pdev->dev;
Weird location for this declaration. Why in the middle of nowhere?
> struct acpi_device *adev;
> bool sof_parent;
> int dai_index = 0;
> int i;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer
2026-04-27 14:46 [PATCH] ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer Sachin Mokashi
2026-04-27 15:19 ` Cezary Rojewski
@ 2026-04-27 22:44 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-04-27 22:44 UTC (permalink / raw)
To: Sachin Mokashi
Cc: linux-sound, alsa-devel, tiwai, pierre-louis.bossart,
cezary.rojewski
On Mon, 27 Apr 2026 10:46:19 -0400, Sachin Mokashi wrote:
> ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2
Thanks!
[1/1] ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer
https://git.kernel.org/broonie/sound/c/cda1cf0526f1
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] 4+ messages in thread
* [PATCH] ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer
2026-04-27 15:19 ` Cezary Rojewski
@ 2026-04-28 12:54 ` Mokashi, Sachin
0 siblings, 0 replies; 4+ messages in thread
From: Mokashi, Sachin @ 2026-04-28 12:54 UTC (permalink / raw)
To: Rojewski, Cezary
Cc: linux-sound@vger.kernel.org, alsa-devel@alsa-project.org,
tiwai@suse.com, pierre-louis.bossart@linux.dev, Mark Brown
>On 2026-04-27 4:46 PM, Sachin Mokashi wrote:
>> In snd_cht_mc_probe(), &pdev->dev is dereferenced repeatedly
>> throughout the function. Introduce a local dev pointer early in the
>> function and use it consistently in place of all open-coded &pdev->dev
>> references.
>>
>> It reduces repetition, improves readability, and aligns with the
>> common kernel driver pattern of caching the device pointer at function entry.
>
>One nit below but it's not a strong for v2. For the patch:
>
>Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
>
>
>> @@ -450,12 +450,13 @@ static int snd_cht_mc_probe(struct platform_device
>*pdev)
>> struct cht_mc_private *drv;
>> struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
>> const char *platform_name;
>> + struct device *dev = &pdev->dev;
>
>Weird location for this declaration. Why in the middle of nowhere?
Agreed, will take care of it from the next time.
>
>> struct acpi_device *adev;
>> bool sof_parent;
>> int dai_index = 0;
>> int i;
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-28 12:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 14:46 [PATCH] ASoC: Intel: cht_bsw_rt5672: Simplify probe() with local 'dev' pointer Sachin Mokashi
2026-04-27 15:19 ` Cezary Rojewski
2026-04-28 12:54 ` Mokashi, Sachin
2026-04-27 22:44 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox