* [PATCH] ASoC: fsl-sai: Add device tree nodes and its availiable check
@ 2014-01-10 2:05 Xiubo Li
2014-01-10 11:09 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Xiubo Li @ 2014-01-10 2:05 UTC (permalink / raw)
To: broonie, lgirdwood; +Cc: alsa-devel, linux-kernel, Xiubo Li
SAIs that are not connected on the board should have a
status = "disabled" property in their device tree nodes.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
sound/soc/fsl/fsl_sai.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index cdd3fa8..6b2ab91 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -404,6 +404,9 @@ static int fsl_sai_probe(struct platform_device *pdev)
struct resource *res;
int ret;
+ if (!np || !of_device_is_available(np))
+ return -ENODEV;
+
sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
if (!sai)
return -ENOMEM;
--
1.8.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: fsl-sai: Add device tree nodes and its availiable check
2014-01-10 2:05 [PATCH] ASoC: fsl-sai: Add device tree nodes and its availiable check Xiubo Li
@ 2014-01-10 11:09 ` Mark Brown
2014-01-13 6:15 ` Li.Xiubo
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2014-01-10 11:09 UTC (permalink / raw)
To: Xiubo Li; +Cc: lgirdwood, alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
On Fri, Jan 10, 2014 at 10:05:50AM +0800, Xiubo Li wrote:
> + if (!np || !of_device_is_available(np))
> + return -ENODEV;
> +
I would expect the of_device_is_available() check to be done by the
driver core rather than by individual drivers - every single driver
should have that check. Is this not happening? The check for np is OK
though.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] ASoC: fsl-sai: Add device tree nodes and its availiable check
2014-01-10 11:09 ` Mark Brown
@ 2014-01-13 6:15 ` Li.Xiubo
2014-01-13 16:10 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Li.Xiubo @ 2014-01-13 6:15 UTC (permalink / raw)
To: Mark Brown; +Cc: lgirdwood, alsa-devel, linux-kernel
> > + if (!np || !of_device_is_available(np))
> > + return -ENODEV;
> > +
>
> I would expect the of_device_is_available() check to be done by the
> driver core rather than by individual drivers - every single driver
> should have that check. Is this not happening? The check for np is OK
> though.
Yes, I hasn't found the core driver does that for now...
And IMO this is needed since the SAI driver is only base dts. And maybe
the device is not presently operational, but it might become operational
in the future (for example, something is not plugged in, or switched off).
Or A serious error was detected in the device, and it is unlikely to become
operational without repair...
And for now for the individual drivers, before calling the of_device_is_available
the '!np' check is need, because:
While in __of_device_is_available:
> status = of_get_property(device, "status", &statlen);
> if (status == NULL)
> return 1;
The status value returned from 'of_get_property()' will be NULL in two cases:
Firstly: the 'device' value (device node) is NULL.
Secondly: the 'status' property is actaully not exist.
If the device node is NULL, the __of_device_is_available will return true too,
that will mean the absent state of the 'status' property.
Thanks,
--
Best Regards,
Xiubo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: fsl-sai: Add device tree nodes and its availiable check
2014-01-13 6:15 ` Li.Xiubo
@ 2014-01-13 16:10 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-01-13 16:10 UTC (permalink / raw)
To: Li.Xiubo; +Cc: lgirdwood, alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]
On Mon, Jan 13, 2014 at 06:15:24AM +0000, Li.Xiubo@freescale.com wrote:
> > I would expect the of_device_is_available() check to be done by the
> > driver core rather than by individual drivers - every single driver
> > should have that check. Is this not happening? The check for np is OK
> > though.
> Yes, I hasn't found the core driver does that for now...
Are you sure, we actively use the ability to mark devices as unavailable
on some systems?
> And IMO this is needed since the SAI driver is only base dts. And maybe
> the device is not presently operational, but it might become operational
> in the future (for example, something is not plugged in, or switched off).
> Or A serious error was detected in the device, and it is unlikely to become
> operational without repair...
I'm sorry but I don't understand what you're saying here at all. These
are all things that might happen but I don't see the connection between
them and the benefits of implementing things in the core - surely the
more functionality there is the more useful it's going to be to factor
all the code out into the driver core?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-13 16:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-10 2:05 [PATCH] ASoC: fsl-sai: Add device tree nodes and its availiable check Xiubo Li
2014-01-10 11:09 ` Mark Brown
2014-01-13 6:15 ` Li.Xiubo
2014-01-13 16:10 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®