From: "Jon Smirl" <jonsmirl@gmail.com>
To: "Grant Likely" <grant.likely@secretlab.ca>
Cc: linuxppc-dev@ozlabs.org, devicetree-discuss@ozlabs.org
Subject: Re: [PATCH] of: i2c: improve last resort compatible entry selection
Date: Sun, 27 Jul 2008 10:21:24 -0400 [thread overview]
Message-ID: <9e4733910807270721h5777bb80u9f3d25413a62883c@mail.gmail.com> (raw)
In-Reply-To: <fa686aa40807262235l47bff0bfi15d86a6e171d6775@mail.gmail.com>
On 7/27/08, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Sun, Jul 27, 2008 at 1:05 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
> > On 7/26/08, Grant Likely <grant.likely@secretlab.ca> wrote:
> >> On Mon, Jul 14, 2008 at 09:54:37PM +0400, Anton Vorontsov wrote:
> >> > Currently of_i2c will select first compatible property as a last resort
> >> > option. This isn't best choice though, because generic compatible entries
> >> > are listed last, not first. For example, two compatible entries given for
> >> > the MCU node:
> >> >
> >> > "fsl,mc9s08qg8-mpc837xrdb", "fsl,mcu-mpc8349emitx";
> >> >
> >> > Since no sane driver will ever match specific devices, what we want is
> >> > to select most generic option (last). Then driver may call
> >> > of_device_is_compatible() if it is really interested in details.
> >>
> >>
> >> I highly suspect that this will actually be a rare condition and that
> >> most of the time the driver you want will bind against the first entry
> >> in the list (I'm basing this on what discussion I've seen on the list
> >> and it seems to me that Jiri does want i2c devices to list the exact set
> >> of chips that each driver binds against).
> >
> > Can we put a loop on request_module() and have it try each one down
> > the list until something matches? request_module() returns errors, but
> > I can't tell from the source if one of those errors is "no matching
> > module found" since it invokes a user space helper.
>
>
> What will request_module() do if the modules is compiled in
> statically? If it is workable then I'm not opposed to this approach.
I'm no expert on request_module, from the comments:
It appears to be synchronous with user space...
call_usermodehelper wait flag, and remove exec_usermodehelper.
Rusty Russell <rusty@rustcorp.com.au> Jan 2003
* Load a module using the user mode module loader. The function returns
* zero on success or a negative errno code on failure. Note that a
* successful module load does not mean the module did not then unload
* and exit on an error of its own. Callers must check that the service
* they requested is now available not blindly invoke it.
Is this really a problem? If the specific driver gets loaded and then
errors out, then something must be wrong. The appropriate action
probably should not be to load the next driver on the list.
It looks like it should work. Compiled in moduled and modules that are
already loaded are essentially the same so they should return 0 from
request module.
>
>
> > That would work for this compatible string:
> > compatible = "atmel,24c32wp", "24c32", "eeprom";
> >
> > request_module will always fail for the first entry. If you have at24
> > in your system the second one will succeed. If you have eeprom the
> > third one works. All of those names are valid in a device tree.
>
>
> I know this is just an example; but to keep thinks clear, the second
> and third values in this compatible property are completely bogus (for
> device trees). The manufacturer prefix needs to be present and
> 'eeprom' is far to vague.
Isn't 24c32 a generic, cross manufacturer term used for these devices?
What if I have a socket and use a different vendor's chip each week?
eeprom is the vague Linuxism that at24 is attempting to correct.
eeprom just goes and searches for anything resembling an eeprom. It
will trigger on chips that aren't eeproms.
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>
--
Jon Smirl
jonsmirl@gmail.com
next prev parent reply other threads:[~2008-07-27 14:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 17:54 [PATCH] of: i2c: improve last resort compatible entry selection Anton Vorontsov
2008-07-15 10:44 ` Jochen Friedrich
2008-07-15 13:40 ` Jon Smirl
2008-07-15 14:05 ` Jean Delvare
2008-07-15 14:52 ` Jochen Friedrich
2008-07-15 15:39 ` Jean Delvare
2008-07-27 0:11 ` Grant Likely
2008-07-27 5:05 ` Jon Smirl
2008-07-27 5:35 ` Grant Likely
2008-07-27 14:21 ` Jon Smirl [this message]
2008-07-27 21:52 ` Segher Boessenkool
2008-07-27 22:00 ` Jon Smirl
2008-07-28 4:16 ` M. Warner Losh
2008-07-28 7:47 ` Segher Boessenkool
2008-07-30 14:42 ` Grant Likely
2008-07-30 20:20 ` Jon Smirl
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=9e4733910807270721h5777bb80u9f3d25413a62883c@mail.gmail.com \
--to=jonsmirl@gmail.com \
--cc=devicetree-discuss@ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=linuxppc-dev@ozlabs.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).