From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
David Brownell
<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH] spi: add a bits_per_word to struct spi_board_info
Date: Wed, 1 Sep 2010 09:10:10 -0600 [thread overview]
Message-ID: <20100901151010.GB13421@angua.secretlab.ca> (raw)
In-Reply-To: <1283322289-2545-1-git-send-email-feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
On Wed, Sep 01, 2010 at 02:24:49PM +0800, Feng Tang wrote:
> Currently a spi device's bits_per_word can only be inited
> inside protocol driver's probe func, this patch will enable
> platform code to specify this info when registering the
> spi_board_info
What is the use case that you would want to do this. Knowing what the bits_per_word should be is the responsibility of the spi device driver. What is the use-case where the driver wouldn't know what bits_per_word should be?
g.
>
> Signed-off-by: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> ---
> drivers/spi/spi.c | 1 +
> include/linux/spi/spi.h | 3 +++
> 2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index a9e5c79..a8690e7 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -350,6 +350,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
> proxy->chip_select = chip->chip_select;
> proxy->max_speed_hz = chip->max_speed_hz;
> proxy->mode = chip->mode;
> + proxy->bits_per_word = chip->bits_per_word;
> proxy->irq = chip->irq;
> strlcpy(proxy->modalias, chip->modalias, sizeof(proxy->modalias));
> proxy->dev.platform_data = (void *) chip->platform_data;
> diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
> index 92e52a1..f36d0d5 100644
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -698,6 +698,8 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
> * @mode: Initializes spi_device.mode; based on the chip datasheet, board
> * wiring (some devices support both 3WIRE and standard modes), and
> * possibly presence of an inverter in the chipselect path.
> + * @bits_per_word: Initializes spi_device.bits_per_word, usually it will
> + * be from 8 to 32 bits
> *
> * When adding new SPI devices to the device tree, these structures serve
> * as a partial device template. They hold information which can't always
> @@ -742,6 +744,7 @@ struct spi_board_info {
> * where the default of SPI_CS_HIGH = 0 is wrong.
> */
> u8 mode;
> + u8 bits_per_word;
>
> /* ... may need additional spi_device chip config data here.
> * avoid stuff protocol drivers can set; but include stuff
> --
> 1.7.0.4
>
------------------------------------------------------------------------------
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-01 15:10 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 [this message]
[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
[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=20100901151010.GB13421@angua.secretlab.ca \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@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).