From: linux@prisktech.co.nz (Tony Prisk)
To: linux-arm-kernel@lists.infradead.org
Subject: Platform data from devicetree
Date: Thu, 09 Aug 2012 11:06:26 +1200 [thread overview]
Message-ID: <1344467186.6707.6.camel@gitbox> (raw)
Quick question regarding platform_devices created from devicetree.
At the moment, we do a of_match_device() against vt8500_gpio_dt_ids[] to
get an of_device_id that contains the .data field to pass into the
driver.
Given that pdev is created from a match against vt8500_gpio_dt_ids[] as
well, why does pdev->dev.of_node.data == NULL? Is this data not
populated into this field? What data can be passed into this field?
Regards
Tony Prisk
Example code below:
static struct of_device_id vt8500_gpio_dt_ids[] = {
{ .compatible = "via,vt8500-gpio", .data = &vt8500_data, },
{ .compatible = "wm,wm8505-gpio", .data = &wm8505_data, },
{ .compatible = "wm,wm8650-gpio", .data = &wm8650_data, },
{ /* Sentinel */ },
};
static int __devinit vt8500_gpio_probe(struct platform_device *pdev)
{
void __iomem *gpio_base;
struct device_node *np;
const struct of_device_id *of_id =
of_match_device(vt8500_gpio_dt_ids, &pdev->dev);
if (!of_id) {
dev_err(&pdev->dev, "Failed to find gpio controller\n");
return -ENODEV;
}
np = pdev->dev.of_node;
...
}
static struct platform_driver vt8500_gpio_driver = {
.probe = vt8500_gpio_probe,
.driver = {
.name = "vt8500-gpio",
.owner = THIS_MODULE,
.of_match_table = vt8500_gpio_dt_ids,
},
};
next reply other threads:[~2012-08-08 23:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-08 23:06 Tony Prisk [this message]
2012-08-08 23:23 ` Platform data from devicetree Rob Herring
2012-08-09 0:35 ` Tony Prisk
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=1344467186.6707.6.camel@gitbox \
--to=linux@prisktech.co.nz \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).