On Fri, Jun 17, 2011 at 04:23, Bob Liu wrote:
> On Fri, Jun 17, 2011 at 4:16 PM, Mike Frysinger wrote:
>> --- a/drivers/spi/spi_bfin5xx.c
>> +++ b/drivers/spi/spi_bfin5xx.c
>> @@ -687,7 +687,7 @@ static void bfin_spi_pump_transfers(unsigned long data)
>>               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;
>>
>
> I think this change still not work. Sorry for that.
> By this change drv_data->n_bytes will be set to 0 which isn't correct.
>
> In my opinion it should be like this, but i am still have no time to test it .
>
> --- drivers/spi/spi_bfin5xx.c   (revision 9946)
> +++ drivers/spi/spi_bfin5xx.c   (working copy)
> @@ -682,6 +682,9 @@
>
>        /* Bits per word setup */
>        bits_per_word = transfer->bits_per_word ? : 
> message->spi->bits_per_word;
> +       if (!bits_per_word)
> +               bits_per_word = 8;      /* set default value */
> +
>        if ((bits_per_word > 0) && (bits_per_word % 16 == 0)) {
>                drv_data->n_bytes = bits_per_word/8;
>                drv_data->len = (transfer->len) >> 1;

makes sense.  i'll go with this tweaked version:
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -641,8 +641,9 @@
    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;
-mike
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to