From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: Re: [PATCH 1/4 v2] spi/bfin_spi: fix handling of default bits per word setting Date: Fri, 17 Jun 2011 08:37:19 -0600 Message-ID: <20110617143719.GA21412@ponder.secretlab.ca> References: <1308298618-23461-1-git-send-email-vapier@gentoo.org> <1308299737-3806-1-git-send-email-vapier@gentoo.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, David Brownell , uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org To: Mike Frysinger Return-path: Content-Disposition: inline In-Reply-To: <1308299737-3806-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: uclinux-dist-devel-bounces-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org Errors-To: uclinux-dist-devel-bounces-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org List-Id: linux-spi.vger.kernel.org On Fri, Jun 17, 2011 at 04:35:37AM -0400, Mike Frysinger wrote: > The default bits per word setting should be 8 bits, but since most of our > devices have been explicitly setting this up, we didn't notice when the > default stopped working. > > At the moment, any default transfers without an explicit bit size setting > error out with: > bfin-spi bfin-spi.0: transfer: unsupported bits_per_word > > So in the transfer logic, have a bits_per_word setting of 0 fall into the > 8 bit transfer logic. > > Signed-off-by: Mike Frysinger Merged for v3.0, thanks. g. > --- > v2 > - wasn't quite as simple as i'd hope ... > > drivers/spi/spi_bfin5xx.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c > index ae30fa3..1f123b9 100644 > --- a/drivers/spi/spi_bfin5xx.c > +++ b/drivers/spi/spi_bfin5xx.c > @@ -681,13 +681,14 @@ static void bfin_spi_pump_transfers(unsigned long data) > drv_data->cs_change = transfer->cs_change; > > /* Bits per word setup */ > - bits_per_word = transfer->bits_per_word ? : message->spi->bits_per_word; > - if ((bits_per_word > 0) && (bits_per_word % 16 == 0)) { > + bits_per_word = transfer->bits_per_word ? : > + message->spi->bits_per_word ? : 8; > + if (bits_per_word % 16 == 0) { > drv_data->n_bytes = bits_per_word/8; > drv_data->len = (transfer->len) >> 1; > cr_width = BIT_CTL_WORDSIZE; > drv_data->ops = &bfin_bfin_spi_transfer_ops_u16; > - } else if ((bits_per_word > 0) && (bits_per_word % 8 == 0)) { > + } else if (bits_per_word % 8 == 0) { > drv_data->n_bytes = bits_per_word/8; > drv_data->len = transfer->len; > cr_width = 0; > -- > 1.7.5.3 >