LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in the probe function
@ 2021-08-11 11:55 Tang Bin
  2021-08-11 11:58 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Tang Bin @ 2021-08-11 11:55 UTC (permalink / raw)
  To: broonie, olivier.moysan, arnaud.pouliquen, lgirdwood, perex, tiwai
  Cc: linux-stm32, linux-arm-kernel, linux-kernel, Tang Bin, Zhang Shengju

The function stm32_spdifrx_parse_of() is only called by the function
stm32_spdifrx_probe(), and the probe function is only called with
an openfirmware platform device. Therefore there is no need to check
the device_node in probe function.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 sound/soc/stm/stm32_spdifrx.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c
index 48145f553..8fe822903 100644
--- a/sound/soc/stm/stm32_spdifrx.c
+++ b/sound/soc/stm/stm32_spdifrx.c
@@ -908,13 +908,9 @@ static const struct of_device_id stm32_spdifrx_ids[] = {
 static int stm32_spdifrx_parse_of(struct platform_device *pdev,
 				  struct stm32_spdifrx_data *spdifrx)
 {
-	struct device_node *np = pdev->dev.of_node;
 	const struct of_device_id *of_id;
 	struct resource *res;
 
-	if (!np)
-		return -ENODEV;
-
 	of_id = of_match_device(stm32_spdifrx_ids, &pdev->dev);
 	if (of_id)
 		spdifrx->regmap_conf =
-- 
2.20.1.windows.1




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

* Re: [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in the probe function
  2021-08-11 11:55 [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in the probe function Tang Bin
@ 2021-08-11 11:58 ` Mark Brown
  2021-08-11 12:09   ` [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in theprobe function tangbin
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2021-08-11 11:58 UTC (permalink / raw)
  To: Tang Bin
  Cc: olivier.moysan, arnaud.pouliquen, lgirdwood, perex, tiwai,
	linux-stm32, linux-arm-kernel, linux-kernel, Zhang Shengju

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

On Wed, Aug 11, 2021 at 07:55:23PM +0800, Tang Bin wrote:
> The function stm32_spdifrx_parse_of() is only called by the function
> stm32_spdifrx_probe(), and the probe function is only called with
> an openfirmware platform device. Therefore there is no need to check
> the device_node in probe function.

What is the benefit of not doing the check?  It seems like reasonable
defensive programming.

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

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

* Re: [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in theprobe function
  2021-08-11 11:58 ` Mark Brown
@ 2021-08-11 12:09   ` tangbin
  2021-08-11 12:19     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: tangbin @ 2021-08-11 12:09 UTC (permalink / raw)
  To: Mark Brown
  Cc: olivier.moysan, arnaud.pouliquen, lgirdwood, perex, tiwai,
	linux-stm32, linux-arm-kernel, linux-kernel, Zhang Shengju

Hi Mark:

On 2021/8/11 19:58, Mark Brown wrote:
> On Wed, Aug 11, 2021 at 07:55:23PM +0800, Tang Bin wrote:
>> The function stm32_spdifrx_parse_of() is only called by the function
>> stm32_spdifrx_probe(), and the probe function is only called with
>> an openfirmware platform device. Therefore there is no need to check
>> the device_node in probe function.
> What is the benefit of not doing the check?  It seems like reasonable
> defensive programming.

I think it's unnecessary, because we all know than the probe function is 
only trigger if

the device and the driver matches, and the trigger mode is just Device 
Tree. So the device_node

must be exist in the probe function if it works. That's the reason why I 
think it's redundant.

Thanks

Tang Bin




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

* Re: [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in theprobe function
  2021-08-11 12:09   ` [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in theprobe function tangbin
@ 2021-08-11 12:19     ` Mark Brown
  2021-08-11 12:28       ` [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in the probe function tangbin
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2021-08-11 12:19 UTC (permalink / raw)
  To: tangbin
  Cc: olivier.moysan, arnaud.pouliquen, lgirdwood, perex, tiwai,
	linux-stm32, linux-arm-kernel, linux-kernel, Zhang Shengju

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

On Wed, Aug 11, 2021 at 08:09:00PM +0800, tangbin wrote:
> On 2021/8/11 19:58, Mark Brown wrote:
> > On Wed, Aug 11, 2021 at 07:55:23PM +0800, Tang Bin wrote:

> > > The function stm32_spdifrx_parse_of() is only called by the function
> > > stm32_spdifrx_probe(), and the probe function is only called with
> > > an openfirmware platform device. Therefore there is no need to check
> > > the device_node in probe function.

> > What is the benefit of not doing the check?  It seems like reasonable
> > defensive programming.

> I think it's unnecessary, because we all know than the probe function is
> only trigger if

> the device and the driver matches, and the trigger mode is just Device Tree.
> So the device_node

> must be exist in the probe function if it works. That's the reason why I
> think it's redundant.

I see why it is redundant, I don't see what problem this redudnancy
causes.

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

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

* Re: [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in the probe function
  2021-08-11 12:19     ` Mark Brown
@ 2021-08-11 12:28       ` tangbin
  0 siblings, 0 replies; 5+ messages in thread
From: tangbin @ 2021-08-11 12:28 UTC (permalink / raw)
  To: Mark Brown
  Cc: olivier.moysan, arnaud.pouliquen, lgirdwood, perex, tiwai,
	linux-stm32, linux-arm-kernel, linux-kernel

Hi Mark:

On 2021/8/11 20:19, Mark Brown wrote:
> On Wed, Aug 11, 2021 at 08:09:00PM +0800, tangbin wrote:
>> On 2021/8/11 19:58, Mark Brown wrote:
>>> On Wed, Aug 11, 2021 at 07:55:23PM +0800, Tang Bin wrote:
>>>> The function stm32_spdifrx_parse_of() is only called by the function
>>>> stm32_spdifrx_probe(), and the probe function is only called with
>>>> an openfirmware platform device. Therefore there is no need to check
>>>> the device_node in probe function.
>>> What is the benefit of not doing the check?  It seems like reasonable
>>> defensive programming.
>> I think it's unnecessary, because we all know than the probe function is
>> only trigger if
>> the device and the driver matches, and the trigger mode is just Device Tree.
>> So the device_node
>> must be exist in the probe function if it works. That's the reason why I
>> think it's redundant.
> I see why it is redundant, I don't see what problem this redudnancy
> causes.

Maybe not, just be redundant. If you think that's ok, just drop this patch.

I'm sorry to trouble you.

Thanks

Tang Bin




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

end of thread, other threads:[~2021-08-11 12:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 11:55 [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in the probe function Tang Bin
2021-08-11 11:58 ` Mark Brown
2021-08-11 12:09   ` [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in theprobe function tangbin
2021-08-11 12:19     ` Mark Brown
2021-08-11 12:28       ` [PATCH] ASoC: stm32: spdifrx: Delete unnecessary check in the probe function tangbin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).