From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>,
"spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH] spi: add a bits_per_word to struct spi_board_info
Date: Wed, 8 Sep 2010 21:18:27 -0600 [thread overview]
Message-ID: <20100909031827.GA10389@angua.secretlab.ca> (raw)
In-Reply-To: <20100909111445.47145de9@feng-i7>
On Thu, Sep 09, 2010 at 11:14:45AM +0800, Feng Tang wrote:
> Hi Grant,
>
> On Thu, 9 Sep 2010 04:21:59 +0800
> Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>
> > > >
> > > > Yes, driver itself
> > > > > know the bits_per_word info best in most case, but there
> > > > > is
> > > > > some device (Option GTM501L spi modem) which supports
> > > > > multiple
> > > > > bits_per_mode option, and here platform code
> > > > is the good place to set it.
> > > >
> > > >
> > > > Not unless it knows which mode the driver uses...
> > > > a kind of layering violation.
> > >
> > > spi_board_info has a member of "mode", so for my platform, I prefer
> > > to set all these infos in platform code, while protocol driver can
> > > check if the preset infos like speed_hz/mode/bits_per_word are
> > > supported.
> >
> > The real problem is that spi_drivers are normally allowed to change
> > bits_per_word as needed.
>
> For drivers who don't accept bits_per_word comes from platform code, it
> could just ignores it and set the value it wants.
>
> > If the spi_driver gets unbound and
> > rebound, then the original platform-set value for bits_per_word is
> > lost and the behaviour changes.
>
> Um, if you are talking about driver load/unload, then the bits_per_word
> info won't get lost as it is set to spi_device from spi_board_info when
> spi_new_device get called.
No, I'm talking about a specific device's spi_driver being unloaded
and reloaded. spi_new_device would only be called if the spi bus
driver was reloaded, triggering a call to spi_register_master().
> > If you really want to give the driver
> > hints about the best setting for bits_per_word or similar, then you
> > should probably use a driver-specific pdata structure.
>
> Good point, really a solution to the GTM501L modem driver. But still,
> adding the bits_per_word to spi_board_info will be more generic when
> more devices which support multiple bits models show up.
As described above, anything that a driver can legally modify cannot
be "preset" by the platform code because the initial preset values
will get lost. A different mechanism must be used so that initial
conditions remain unchanged between successive binding of a driver.
g.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
next prev parent reply other threads:[~2010-09-09 3:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-01 6:24 [PATCH] spi: add a bits_per_word to struct spi_board_info Feng Tang
[not found] ` <1283322289-2545-1-git-send-email-feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2010-09-01 15:10 ` Grant Likely
[not found] ` <220308.75070.qm@web180310.mail.gq1.yahoo.com>
[not found] ` <220308.75070.qm-4JhmkcZgSkk/JfqJOfUXs/u2YVrzzGjVVpNB7YpNyf8@public.gmane.org>
2010-09-02 2:01 ` Feng Tang
2010-09-02 5:23 ` David Brownell
[not found] ` <930634.1250.qm-4JhmkcZgSkk/JfqJOfUXs/u2YVrzzGjVVpNB7YpNyf8@public.gmane.org>
2010-09-02 6:13 ` Feng Tang
2010-09-08 20:21 ` Grant Likely
[not found] ` <20100908202159.GG7065-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-09-09 3:14 ` Feng Tang
2010-09-09 3:18 ` Grant Likely [this message]
[not found] ` <20100909031827.GA10389-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-09-09 3:48 ` David Brownell
[not found] ` <570796.22556.qm-g47maUHHHF8P4eY3Ra60wvu2YVrzzGjVVpNB7YpNyf8@public.gmane.org>
2010-09-09 4:36 ` Grant Likely
2010-09-09 6:06 ` Feng Tang
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=20100909031827.GA10389@angua.secretlab.ca \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
--cc=feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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).