From: Kevin Hilman <khilman@deeprootsystems.com>
To: "Hald, Ulrik Bech" <ubh@ti.com>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 2/2] watchdog:OMAP3:Enable support for IVA2 and SECURE
Date: Wed, 17 Jun 2009 07:33:43 -0700 [thread overview]
Message-ID: <87y6rrylo8.fsf@deeprootsystems.com> (raw)
In-Reply-To: <00695C9C8F8B4448856F48142B4AA201BD8D89BE@dnce02.ent.ti.com> (Ulrik Bech Hald's message of "Wed\, 17 Jun 2009 16\:17\:02 +0200")
"Hald, Ulrik Bech" <ubh@ti.com> writes:
[...]
>>
>> Drop this and just use the inode match.
>>
> Was considering that, but ended up defaulting value instead of error checking later. I'll change the above.
>
>> > + /* Find match between device node and wdt device */
>> > + int i;
>> > + for (i = 0; i < NUM_WDTS; i++) {
>> > + if (omap_wdt_dev[i]) {
>> > + wdev = platform_get_drvdata(omap_wdt_dev[i]);
>> > + if (iminor(inode) == wdev->omap_wdt_miscdev.minor)
>> > + break;
>> > + }
>> > + }
>>
>> You should check for a valid match here.
>>
> The sanity check I would choose here is
>
> struct omap_wdt_dev *wdev = NULL;
> ...
> <inode matching>
> ...
> if(!wdev)
> return -ENODEV;
>
Looks fine.
[...]
>>
>> The more think about this, the more I don't like this pdev->id
>> switching in the driver. The only thing it is needed for
>> is to set the name of the node.
>>
>> Instead, why not set the name in devices.c and pass it in
>> using platform_data.
>>
>> Then you can drop the enum and the pdev->id switching.
>>
>
> That does simplify things a bit. Had overlooked that way of sharing info between device and driver.
> So, devices.c would have something like:
>
> static struct platform_device omap_secure_wdt_device = {
> .name = "omap_wdt",
> .id = 1,
> .num_resources = ARRAY_SIZE(secure_wdt_resources),
> .resource = secure_wdt_resources,
> .dev = {
> .platform_data = "watchdog_secure",
> },
> };
>
> And omap_wdt.c would have in probe():
>
> wdev->omap_wdt_miscdev.name = (char *) pdev->dev.platform_data;
>
> Is that more like what you had in mind?
>
Exactly.
This is typically done with a platform_data struct, and a pointer to
the struct is passed as the platform_data, but in this case since the
struct would only have one field for the name pointer, this should be
fine.
Kevin
next prev parent reply other threads:[~2009-06-17 14:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 21:11 [PATCH 0/2] watchdog:OMAP3:Add support for IVA2, SECURE WDTs Ulrik Bech Hald
2009-06-15 21:11 ` [PATCH 1/2] watchdog:OMAP3:Register IVA and SECURE WDT, make clks accessible Ulrik Bech Hald
2009-06-15 21:11 ` [PATCH 2/2] watchdog:OMAP3:Enable support for IVA2 and SECURE Ulrik Bech Hald
2009-06-16 15:27 ` Kevin Hilman
2009-06-17 14:17 ` Hald, Ulrik Bech
2009-06-17 14:33 ` Kevin Hilman [this message]
2009-06-16 15:02 ` [PATCH 1/2] watchdog:OMAP3:Register IVA and SECURE WDT, make clks accessible Kevin Hilman
-- strict thread matches above, loose matches on Subject: below --
2009-07-09 18:04 [PATCH 0/2] watchdog:OMAP3:Add support for IVA2, SECURE WDTs Ulrik Bech Hald
2009-07-09 18:04 ` [PATCH 1/2] watchdog:OMAP3:Register IVA and SECURE WDT, make clks ac Ulrik Bech Hald
2009-07-09 18:04 ` [PATCH 2/2] watchdog:OMAP3:Enable support for IVA2 and SECURE Ulrik Bech Hald
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=87y6rrylo8.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=linux-omap@vger.kernel.org \
--cc=ubh@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.