From: "Li.Xiubo@freescale.com" <Li.Xiubo@freescale.com>
To: Mark Brown <broonie@kernel.org>
Cc: "lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] ASoC: fsl-sai: Add device tree nodes and its availiable check
Date: Mon, 13 Jan 2014 06:15:24 +0000 [thread overview]
Message-ID: <8ea36054cbe745cf9ce5c5d4a786f9ff@BY2PR03MB505.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20140110110900.GC29039@sirena.org.uk>
> > + 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
next prev parent reply other threads:[~2014-01-13 6:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 2:05 Xiubo Li
2014-01-10 11:09 ` Mark Brown
2014-01-13 6:15 ` Li.Xiubo [this message]
2014-01-13 16:10 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ea36054cbe745cf9ce5c5d4a786f9ff@BY2PR03MB505.namprd03.prod.outlook.com \
--to=li.xiubo@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®