RE: [PATCH 2/8] spi: spi-ep93xx: use bits_per_word_mask

2013-07-01 Thread H Hartley Sweeten
On Monday, July 01, 2013 11:23 AM, H Hartley Sweeten wrote:
> On Sunday, June 30, 2013 9:14 AM, Mika Westerberg wrote:
>> Please use SPI_BPW_RANGE_MASK(4, 16) here.
>
> I thought there was a macro for this, just couldn't find it. I'll fix this.

Doh... This patch is already in linux-next.

I'll need to rebase this series.

Regards,
Hartley
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 2/8] spi: spi-ep93xx: use bits_per_word_mask

2013-07-01 Thread H Hartley Sweeten
On Sunday, June 30, 2013 9:14 AM, Mika Westerberg wrote:
> On Fri, Jun 28, 2013 at 11:43:07AM -0700, H Hartley Sweeten wrote:
>> This driver supports 16 to 4 bits per work. Set the bits_per_word_mask
>> to allows the spi core to handle validation.
>> 
>> Signed-off-by: H Hartley Sweeten 
>> Cc: Ryan Mallon 
>> Cc: Mika Westerberg 
>> Cc: Mark Brown 
>> Cc: Grant Likely 
>> ---
>>  drivers/spi/spi-ep93xx.c | 11 +--
>>  1 file changed, 1 insertion(+), 10 deletions(-)
>> 
>> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
>> index c633cd0..93ae7b6 100644
>> --- a/drivers/spi/spi-ep93xx.c
>> +++ b/drivers/spi/spi-ep93xx.c
>> @@ -272,12 +272,6 @@ static int ep93xx_spi_setup(struct spi_device *spi)
>>  struct ep93xx_spi *espi = spi_master_get_devdata(spi->master);
>>  struct ep93xx_spi_chip *chip;
>>  
>> -if (spi->bits_per_word < 4 || spi->bits_per_word > 16) {
>> -dev_err(>pdev->dev, "invalid bits per word %d\n",
>> -spi->bits_per_word);
>> -return -EINVAL;
>> -}
>> -
>>  chip = spi_get_ctldata(spi);
>>  if (!chip) {
>>  dev_dbg(>pdev->dev, "initial setup for %s\n",
>> @@ -341,10 +335,6 @@ static int ep93xx_spi_transfer(struct spi_device *spi, 
>> struct spi_message *msg)
>>  
>>  /* first validate each transfer */
>>  list_for_each_entry(t, >transfers, transfer_list) {
>> -if (t->bits_per_word) {
>> -if (t->bits_per_word < 4 || t->bits_per_word > 16)
>> -return -EINVAL;
>> -}
>>  if (t->speed_hz && t->speed_hz < espi->min_rate)
>>  return -EINVAL;
>>  }
>> @@ -1022,6 +1012,7 @@ static int ep93xx_spi_probe(struct platform_device 
>> *pdev)
>>  master->bus_num = pdev->id;
>>  master->num_chipselect = info->num_chipselect;
>>  master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
>> +master->bits_per_word_mask = 0xfff8;/* 16 to 4 bits per word */
>
> Please use SPI_BPW_RANGE_MASK(4, 16) here.

I thought there was a macro for this, just couldn't find it. I'll fix this.

Thanks, 
Hartley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 2/8] spi: spi-ep93xx: use bits_per_word_mask

2013-07-01 Thread H Hartley Sweeten
On Sunday, June 30, 2013 9:14 AM, Mika Westerberg wrote:
 On Fri, Jun 28, 2013 at 11:43:07AM -0700, H Hartley Sweeten wrote:
 This driver supports 16 to 4 bits per work. Set the bits_per_word_mask
 to allows the spi core to handle validation.
 
 Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
 Cc: Ryan Mallon rmal...@gmail.com
 Cc: Mika Westerberg mika.westerb...@iki.fi
 Cc: Mark Brown broo...@kernel.org
 Cc: Grant Likely grant.lik...@linaro.org
 ---
  drivers/spi/spi-ep93xx.c | 11 +--
  1 file changed, 1 insertion(+), 10 deletions(-)
 
 diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
 index c633cd0..93ae7b6 100644
 --- a/drivers/spi/spi-ep93xx.c
 +++ b/drivers/spi/spi-ep93xx.c
 @@ -272,12 +272,6 @@ static int ep93xx_spi_setup(struct spi_device *spi)
  struct ep93xx_spi *espi = spi_master_get_devdata(spi-master);
  struct ep93xx_spi_chip *chip;
  
 -if (spi-bits_per_word  4 || spi-bits_per_word  16) {
 -dev_err(espi-pdev-dev, invalid bits per word %d\n,
 -spi-bits_per_word);
 -return -EINVAL;
 -}
 -
  chip = spi_get_ctldata(spi);
  if (!chip) {
  dev_dbg(espi-pdev-dev, initial setup for %s\n,
 @@ -341,10 +335,6 @@ static int ep93xx_spi_transfer(struct spi_device *spi, 
 struct spi_message *msg)
  
  /* first validate each transfer */
  list_for_each_entry(t, msg-transfers, transfer_list) {
 -if (t-bits_per_word) {
 -if (t-bits_per_word  4 || t-bits_per_word  16)
 -return -EINVAL;
 -}
  if (t-speed_hz  t-speed_hz  espi-min_rate)
  return -EINVAL;
  }
 @@ -1022,6 +1012,7 @@ static int ep93xx_spi_probe(struct platform_device 
 *pdev)
  master-bus_num = pdev-id;
  master-num_chipselect = info-num_chipselect;
  master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 +master-bits_per_word_mask = 0xfff8;/* 16 to 4 bits per word */

 Please use SPI_BPW_RANGE_MASK(4, 16) here.

I thought there was a macro for this, just couldn't find it. I'll fix this.

Thanks, 
Hartley

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 2/8] spi: spi-ep93xx: use bits_per_word_mask

2013-07-01 Thread H Hartley Sweeten
On Monday, July 01, 2013 11:23 AM, H Hartley Sweeten wrote:
 On Sunday, June 30, 2013 9:14 AM, Mika Westerberg wrote:
 Please use SPI_BPW_RANGE_MASK(4, 16) here.

 I thought there was a macro for this, just couldn't find it. I'll fix this.

Doh... This patch is already in linux-next.

I'll need to rebase this series.

Regards,
Hartley
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/8] spi: spi-ep93xx: use bits_per_word_mask

2013-06-30 Thread Mika Westerberg
On Fri, Jun 28, 2013 at 11:43:07AM -0700, H Hartley Sweeten wrote:
> This driver supports 16 to 4 bits per work. Set the bits_per_word_mask
> to allows the spi core to handle validation.
> 
> Signed-off-by: H Hartley Sweeten 
> Cc: Ryan Mallon 
> Cc: Mika Westerberg 
> Cc: Mark Brown 
> Cc: Grant Likely 
> ---
>  drivers/spi/spi-ep93xx.c | 11 +--
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> index c633cd0..93ae7b6 100644
> --- a/drivers/spi/spi-ep93xx.c
> +++ b/drivers/spi/spi-ep93xx.c
> @@ -272,12 +272,6 @@ static int ep93xx_spi_setup(struct spi_device *spi)
>   struct ep93xx_spi *espi = spi_master_get_devdata(spi->master);
>   struct ep93xx_spi_chip *chip;
>  
> - if (spi->bits_per_word < 4 || spi->bits_per_word > 16) {
> - dev_err(>pdev->dev, "invalid bits per word %d\n",
> - spi->bits_per_word);
> - return -EINVAL;
> - }
> -
>   chip = spi_get_ctldata(spi);
>   if (!chip) {
>   dev_dbg(>pdev->dev, "initial setup for %s\n",
> @@ -341,10 +335,6 @@ static int ep93xx_spi_transfer(struct spi_device *spi, 
> struct spi_message *msg)
>  
>   /* first validate each transfer */
>   list_for_each_entry(t, >transfers, transfer_list) {
> - if (t->bits_per_word) {
> - if (t->bits_per_word < 4 || t->bits_per_word > 16)
> - return -EINVAL;
> - }
>   if (t->speed_hz && t->speed_hz < espi->min_rate)
>   return -EINVAL;
>   }
> @@ -1022,6 +1012,7 @@ static int ep93xx_spi_probe(struct platform_device 
> *pdev)
>   master->bus_num = pdev->id;
>   master->num_chipselect = info->num_chipselect;
>   master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
> + master->bits_per_word_mask = 0xfff8;/* 16 to 4 bits per word */

Please use SPI_BPW_RANGE_MASK(4, 16) here.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/8] spi: spi-ep93xx: use bits_per_word_mask

2013-06-30 Thread Mika Westerberg
On Fri, Jun 28, 2013 at 11:43:07AM -0700, H Hartley Sweeten wrote:
 This driver supports 16 to 4 bits per work. Set the bits_per_word_mask
 to allows the spi core to handle validation.
 
 Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
 Cc: Ryan Mallon rmal...@gmail.com
 Cc: Mika Westerberg mika.westerb...@iki.fi
 Cc: Mark Brown broo...@kernel.org
 Cc: Grant Likely grant.lik...@linaro.org
 ---
  drivers/spi/spi-ep93xx.c | 11 +--
  1 file changed, 1 insertion(+), 10 deletions(-)
 
 diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
 index c633cd0..93ae7b6 100644
 --- a/drivers/spi/spi-ep93xx.c
 +++ b/drivers/spi/spi-ep93xx.c
 @@ -272,12 +272,6 @@ static int ep93xx_spi_setup(struct spi_device *spi)
   struct ep93xx_spi *espi = spi_master_get_devdata(spi-master);
   struct ep93xx_spi_chip *chip;
  
 - if (spi-bits_per_word  4 || spi-bits_per_word  16) {
 - dev_err(espi-pdev-dev, invalid bits per word %d\n,
 - spi-bits_per_word);
 - return -EINVAL;
 - }
 -
   chip = spi_get_ctldata(spi);
   if (!chip) {
   dev_dbg(espi-pdev-dev, initial setup for %s\n,
 @@ -341,10 +335,6 @@ static int ep93xx_spi_transfer(struct spi_device *spi, 
 struct spi_message *msg)
  
   /* first validate each transfer */
   list_for_each_entry(t, msg-transfers, transfer_list) {
 - if (t-bits_per_word) {
 - if (t-bits_per_word  4 || t-bits_per_word  16)
 - return -EINVAL;
 - }
   if (t-speed_hz  t-speed_hz  espi-min_rate)
   return -EINVAL;
   }
 @@ -1022,6 +1012,7 @@ static int ep93xx_spi_probe(struct platform_device 
 *pdev)
   master-bus_num = pdev-id;
   master-num_chipselect = info-num_chipselect;
   master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 + master-bits_per_word_mask = 0xfff8;/* 16 to 4 bits per word */

Please use SPI_BPW_RANGE_MASK(4, 16) here.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/