Our last deal

2016-11-12 Thread Mr. Donald Lucas
Greetings,

I have interest of investing in your country. I am a Fund Management Executive 
with Prudential Plc Asset Management in the UK.

I am in search of a partner to assist me in the transfer of 36,000,000GBP and 
subsequent investment in properties and other lucrative businesses in your 
country.

You will be required to.

(1) Assist in the transfer of the said funds.

(2) Advise on lucrative areas for investment.

(3) Assist us in purchase of properties.

If you agree to render your service to me in this regard, 25% of the total sum 
of 36,000,000 GBP will be for you.

Kindly reply and consent to your continued Interest.

Thank you and God bless, as I wait in anticipation of your reply and 
co-operation.


Best Regards,
Mr. Donald Lucas
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Our last deal

2016-11-12 Thread Mr. Donald Lucas
Greetings,

I have interest of investing in your country. I am a Fund Management Executive 
with Prudential Plc Asset Management in the UK.

I am in search of a partner to assist me in the transfer of 36,000,000GBP and 
subsequent investment in properties and other lucrative businesses in your 
country.

You will be required to.

(1) Assist in the transfer of the said funds.

(2) Advise on lucrative areas for investment.

(3) Assist us in purchase of properties.

If you agree to render your service to me in this regard, 25% of the total sum 
of 36,000,000 GBP will be for you.

Kindly reply and consent to your continued Interest.

Thank you and God bless, as I wait in anticipation of your reply and 
co-operation.


Best Regards,
Mr. Donald Lucas
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 01/28] staging: iio: tsl2583: split out functionality of taos_chip_on()

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:25, Brian Masney wrote:
> taos_chip_on() reads an eight member array called taos_config
> that contains the desired state of the chip's registers. Only four
> of the registers actually need to be written to. The four that do
> not need to be written to are for the {low,high} byte of the lower
> interrupt threshold and the {low,high} byte of the upper interrupt
> threshold. Interrupts are currently not supported by this driver
> so there is no need to write to these registers.
> 
> This patch removes the taos_config array and separates out the
> i2c calls that write to the CONTROL, TIMING, INTERRUPT and ANALOG
> registers. This is part of a larger refactor that was split up to
> make the code review easier.
> 
> Signed-off-by: Brian Masney 
Looks good. Applied to the togreg branch of iio.git.

Thanks

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 122 
> +---
>  1 file changed, 58 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index d74e33b..c196a42 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -31,9 +31,6 @@
>  #include 
>  #include 
>  
> -/* Triton register offsets */
> -#define  TSL258X_REG_MAX 8
> -
>  /* Device Registers and Masks */
>  #define TSL258X_CNTRL0x00
>  #define TSL258X_ALS_TIME 0X01
> @@ -55,6 +52,7 @@
>  
>  /* tsl2583 cntrl reg masks */
>  #define TSL258X_CNTL_ADC_ENBL0x02
> +#define TSL258X_CNTL_PWR_OFF 0x00
>  #define TSL258X_CNTL_PWR_ON  0x01
>  
>  /* tsl2583 status reg masks */
> @@ -64,6 +62,8 @@
>  /* Lux calculation constants */
>  #define  TSL258X_LUX_CALC_OVER_FLOW  65535
>  
> +#define TSL2583_INTERRUPT_DISABLED   0x00
> +
>  #define TSL2583_CHIP_ID  0x90
>  #define TSL2583_CHIP_ID_MASK 0xf0
>  
> @@ -95,18 +95,8 @@ struct tsl2583_chip {
>   int als_time_scale;
>   int als_saturation;
>   int taos_chip_status;
> - u8 taos_config[8];
>  };
>  
> -/*
> - * Initial values for device - this values can/will be changed by driver.
> - * and applications as needed.
> - * These values are dynamic.
> - */
> -static const u8 taos_config[8] = {
> - 0x00, 0xee, 0x00, 0x03, 0x00, 0xFF, 0xFF, 0x00
> -}; /*cntrl atime intC  Athl0 Athl1 Athh0 Athh1 gain */
> -
>  struct taos_lux {
>   unsigned int ratio;
>   unsigned int ch0;
> @@ -362,16 +352,26 @@ static int taos_als_calibrate(struct iio_dev *indio_dev)
>   return (int)gain_trim_val;
>  }
>  
> +static int tsl2583_set_power_state(struct tsl2583_chip *chip, u8 state)
> +{
> + int ret;
> +
> + ret = i2c_smbus_write_byte_data(chip->client,
> + TSL258X_CMD_REG | TSL258X_CNTRL, state);
> + if (ret < 0)
> + dev_err(&chip->client->dev, "%s failed to set the power state 
> to %d\n",
> + __func__, state);
> +
> + return ret;
> +}
> +
>  /*
>   * Turn the device on.
>   * Configuration must be set before calling this function.
>   */
> -static int taos_chip_on(struct iio_dev *indio_dev)
> +static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
>  {
> - int i;
> - int ret;
> - u8 *uP;
> - u8 utmp;
> + int ret, val;
>   int als_count;
>   int als_time;
>   struct tsl2583_chip *chip = iio_priv(indio_dev);
> @@ -383,6 +383,20 @@ static int taos_chip_on(struct iio_dev *indio_dev)
>   return -EINVAL;
>   }
>  
> + /* Power on the device; ADC off. */
> + ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_ON);
> + if (ret < 0)
> + return ret;
> +
> + ret = i2c_smbus_write_byte_data(chip->client,
> + TSL258X_CMD_REG | TSL258X_INTERRUPT,
> + TSL2583_INTERRUPT_DISABLED);
> + if (ret < 0) {
> + dev_err(&chip->client->dev, "%s failed to disable interrupts\n",
> + __func__);
> + return ret;
> + }
> +
>   /* determine als integration register */
>   als_count = (chip->taos_settings.als_time * 100 + 135) / 270;
>   if (!als_count)
> @@ -390,62 +404,43 @@ static int taos_chip_on(struct iio_dev *indio_dev)
>  
>   /* convert back to time (encompasses overrides) */
>   als_time = (als_count * 27 + 5) / 10;
> - chip->taos_config[TSL258X_ALS_TIME] = 256 - als_count;
> +
> + val = 256 - als_count;
> + ret = i2c_smbus_write_byte_data(chip->client,
> + TSL258X_CMD_REG | TSL258X_ALS_TIME,
> + val);
> + if (ret < 0) {
> + dev_err(&chip->client->dev, "%s failed to set the als time to 
> %d\n",
> + __func__, val);
> + return ret;
> + }
>  
>   /* Set the gain based on taos_settin

Re: [PATCH v3 02/28] staging: iio: tsl2583: fix issue with changes to calibscale and int_time not being set on the chip

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:25, Brian Masney wrote:
> When updating the in_illuminance_calibscale and
> in_illuminance_integration_time sysfs attributes, these values were not
> actually written to the chip. The chip would continue to use the old
> parameters. Extracted out tsl2583_set_als_gain() and
> tsl2583_set_als_time() functions that are now called when these sysfs
> attributes are updated. The chip initialization also calls these these
> new functions.
> 
> Signed-off-by: Brian Masney 
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 85 
> +++--
>  1 file changed, 52 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index c196a42..1a7be12 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -352,6 +352,51 @@ static int taos_als_calibrate(struct iio_dev *indio_dev)
>   return (int)gain_trim_val;
>  }
>  
> +static int tsl2583_set_als_time(struct tsl2583_chip *chip)
> +{
> + int als_count, als_time, ret;
> + u8 val;
> +
> + /* determine als integration register */
> + als_count = (chip->taos_settings.als_time * 100 + 135) / 270;
> + if (!als_count)
> + als_count = 1; /* ensure at least one cycle */
> +
> + /* convert back to time (encompasses overrides) */
> + als_time = (als_count * 27 + 5) / 10;
> +
> + val = 256 - als_count;
> + ret = i2c_smbus_write_byte_data(chip->client,
> + TSL258X_CMD_REG | TSL258X_ALS_TIME,
> + val);
> + if (ret < 0) {
> + dev_err(&chip->client->dev, "%s failed to set the als time to 
> %d\n",
> + __func__, val);
> + return ret;
> + }
> +
> + /* set chip struct re scaling and saturation */
> + chip->als_saturation = als_count * 922; /* 90% of full scale */
> + chip->als_time_scale = (als_time + 25) / 50;
> +
> + return ret;
> +}
> +
> +static int tsl2583_set_als_gain(struct tsl2583_chip *chip)
> +{
> + int ret;
> +
> + /* Set the gain based on taos_settings struct */
> + ret = i2c_smbus_write_byte_data(chip->client,
> + TSL258X_CMD_REG | TSL258X_GAIN,
> + chip->taos_settings.als_gain);
> + if (ret < 0)
> + dev_err(&chip->client->dev, "%s failed to set the gain to %d\n",
> + __func__, chip->taos_settings.als_gain);
> +
> + return ret;
> +}
> +
>  static int tsl2583_set_power_state(struct tsl2583_chip *chip, u8 state)
>  {
>   int ret;
> @@ -371,10 +416,8 @@ static int tsl2583_set_power_state(struct tsl2583_chip 
> *chip, u8 state)
>   */
>  static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
>  {
> - int ret, val;
> - int als_count;
> - int als_time;
>   struct tsl2583_chip *chip = iio_priv(indio_dev);
> + int ret;
>  
>   /* and make sure we're not already on */
>   if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
> @@ -397,37 +440,13 @@ static int tsl2583_chip_init_and_power_on(struct 
> iio_dev *indio_dev)
>   return ret;
>   }
>  
> - /* determine als integration register */
> - als_count = (chip->taos_settings.als_time * 100 + 135) / 270;
> - if (!als_count)
> - als_count = 1; /* ensure at least one cycle */
> -
> - /* convert back to time (encompasses overrides) */
> - als_time = (als_count * 27 + 5) / 10;
> -
> - val = 256 - als_count;
> - ret = i2c_smbus_write_byte_data(chip->client,
> - TSL258X_CMD_REG | TSL258X_ALS_TIME,
> - val);
> - if (ret < 0) {
> - dev_err(&chip->client->dev, "%s failed to set the als time to 
> %d\n",
> - __func__, val);
> + ret = tsl2583_set_als_time(chip);
> + if (ret < 0)
>   return ret;
> - }
>  
> - /* Set the gain based on taos_settings struct */
> - ret = i2c_smbus_write_byte_data(chip->client,
> - TSL258X_CMD_REG | TSL258X_GAIN,
> - chip->taos_settings.als_gain);
> - if (ret < 0) {
> - dev_err(&chip->client->dev, "%s failed to set the gain to %d\n",
> - __func__, chip->taos_settings.als_gain);
> + ret = tsl2583_set_als_gain(chip);
> + if (ret < 0)
>   return ret;
> - }
> -
> - /* set chip struct re scaling and saturation */
> - chip->als_saturation = als_count * 922; /* 90% of full scale */
> - chip->als_time_scale = (als_time + 25) / 50;
>  
>   usleep_range(3000, 3500);
>  
> @@ -707,7 +726,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
>   

Re: [PATCH v3 03/28] staging: iio: tsl2583: check if chip is suspended in in_illuminance_calibrate_store

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:25, Brian Masney wrote:
> in_illuminance_calibrate_store() did not check to see if the chip is
> suspended. This patch adds the proper check. The return value from
> taos_als_calibrate() was also not checked in this function, so the
> proper check was also added while changes are being made here.
> 
> Signed-off-by: Brian Masney 
Applied.
> ---
>  drivers/staging/iio/light/tsl2583.c | 17 ++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index 1a7be12..eb59ea0 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -501,16 +501,27 @@ static ssize_t in_illuminance_calibrate_store(struct 
> device *dev,
>  {
>   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>   struct tsl2583_chip *chip = iio_priv(indio_dev);
> - int value;
> + int value, ret;
>  
>   if (kstrtoint(buf, 0, &value) || value != 1)
>   return -EINVAL;
>  
>   mutex_lock(&chip->als_mutex);
> - taos_als_calibrate(indio_dev);
> +
> + if (chip->suspended) {
> + ret = -EBUSY;
> + goto done;
> + }
> +
> + ret = taos_als_calibrate(indio_dev);
> + if (ret < 0)
> + goto done;
> +
> + ret = len;
> +done:
>   mutex_unlock(&chip->als_mutex);
>  
> - return len;
> + return ret;
>  }
>  
>  static ssize_t in_illuminance_lux_table_show(struct device *dev,
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 03/28] staging: iio: tsl2583: check if chip is suspended in in_illuminance_calibrate_store

2016-11-12 Thread Jonathan Cameron
On 12/11/16 16:24, Jonathan Cameron wrote:
> On 10/11/16 09:25, Brian Masney wrote:
>> in_illuminance_calibrate_store() did not check to see if the chip is
>> suspended. This patch adds the proper check. The return value from
>> taos_als_calibrate() was also not checked in this function, so the
>> proper check was also added while changes are being made here.
>>
>> Signed-off-by: Brian Masney 
> Applied.
And backed out. It doesn't build :(

drivers/staging/iio/light/tsl2583.c:511:10: error: ‘struct tsl2583_chip’ has no 
member named ‘suspended’
  if (chip->suspended) {
  ^~

>> ---
>>  drivers/staging/iio/light/tsl2583.c | 17 ++---
>>  1 file changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/iio/light/tsl2583.c 
>> b/drivers/staging/iio/light/tsl2583.c
>> index 1a7be12..eb59ea0 100644
>> --- a/drivers/staging/iio/light/tsl2583.c
>> +++ b/drivers/staging/iio/light/tsl2583.c
>> @@ -501,16 +501,27 @@ static ssize_t in_illuminance_calibrate_store(struct 
>> device *dev,
>>  {
>>  struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>>  struct tsl2583_chip *chip = iio_priv(indio_dev);
>> -int value;
>> +int value, ret;
>>  
>>  if (kstrtoint(buf, 0, &value) || value != 1)
>>  return -EINVAL;
>>  
>>  mutex_lock(&chip->als_mutex);
>> -taos_als_calibrate(indio_dev);
>> +
>> +if (chip->suspended) {
>> +ret = -EBUSY;
>> +goto done;
>> +}
>> +
>> +ret = taos_als_calibrate(indio_dev);
>> +if (ret < 0)
>> +goto done;
>> +
>> +ret = len;
>> +done:
>>  mutex_unlock(&chip->als_mutex);
>>  
>> -return len;
>> +return ret;
>>  }
>>  
>>  static ssize_t in_illuminance_lux_table_show(struct device *dev,
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 04/28] staging: iio: tsl2583: remove unnecessary chip status check in taos_get_lux

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:25, Brian Masney wrote:
> taos_get_lux checks to see if the chip is in a working state. This
> check is not necessary since it is only called from tsl2583_read_raw
> and in_illuminance_calibrate_store (via taos_als_calibrate). The chip
> state is already checked by these functions.
> 
> Signed-off-by: Brian Masney 
Looks good. Will pick up once patch 3 is sorted.
> ---
>  drivers/staging/iio/light/tsl2583.c | 7 ---
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index eb59ea0..170b8e9 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -178,13 +178,6 @@ static int taos_get_lux(struct iio_dev *indio_dev)
>   u32 ch0lux = 0;
>   u32 ch1lux = 0;
>  
> - if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
> - /* device is not enabled */
> - dev_err(&chip->client->dev, "taos_get_lux device is not 
> enabled\n");
> - ret = -EBUSY;
> - goto done;
> - }
> -
>   ret = i2c_smbus_read_byte_data(chip->client, TSL258X_CMD_REG);
>   if (ret < 0) {
>   dev_err(&chip->client->dev, "taos_get_lux failed to read 
> CMD_REG\n");
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 05/28] staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:25, Brian Masney wrote:
> The device probing and the suspend/resume code checks a flag internal to
> the driver that determines whether or not the chip is in a working
> state. These checks are not needed. This patch removes the unnecessary
> checks. It will do no harm to the hardware if the chip is
> reinitialized if it is already powered on.
> 
> Signed-off-by: Brian Masney 
Looks sensible to me.
> ---
>  drivers/staging/iio/light/tsl2583.c | 16 +++-
>  1 file changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index 170b8e9..29dd072 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -412,13 +412,6 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev 
> *indio_dev)
>   struct tsl2583_chip *chip = iio_priv(indio_dev);
>   int ret;
>  
> - /* and make sure we're not already on */
> - if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
> - /* if forcing a register update - turn off, then on */
> - dev_info(&chip->client->dev, "device is already enabled\n");
> - return -EINVAL;
> - }
> -
>   /* Power on the device; ADC off. */
>   ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_ON);
>   if (ret < 0)
> @@ -841,10 +834,8 @@ static int __maybe_unused taos_suspend(struct device 
> *dev)
>  
>   mutex_lock(&chip->als_mutex);
>  
> - if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
> - ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_OFF);
> - chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
> - }
> + ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_OFF);
> + chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
>  
>   mutex_unlock(&chip->als_mutex);
>   return ret;
> @@ -858,8 +849,7 @@ static int __maybe_unused taos_resume(struct device *dev)
>  
>   mutex_lock(&chip->als_mutex);
>  
> - if (chip->taos_chip_status == TSL258X_CHIP_SUSPENDED)
> - ret = tsl2583_chip_init_and_power_on(indio_dev);
> + ret = tsl2583_chip_init_and_power_on(indio_dev);
>  
>   mutex_unlock(&chip->als_mutex);
>   return ret;
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 16/28] staging: iio: tsl2583: updated code comment to match what the code does

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:25, Brian Masney wrote:
> If channel 0 does not have any data, then the code sets the lux to zero.
> The corresponding comment says that the last value is returned. This
> updates the comment to correctly reflect what the code does.
> 
> Signed-off-by: Brian Masney 
Better perhaps to just return an error, -EAGAIN perhaps?
I'm not sure why it would not give a value.
> ---
>  drivers/staging/iio/light/tsl2583.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index 52a39a6..390ff8b 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -221,7 +221,7 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
>   goto return_max;
>  
>   if (!ch0) {
> - /* have no data, so return LAST VALUE */
> + /* have no data, so return 0 */
>   ret = 0;
>   chip->als_cur_info.lux = 0;
>   goto done;
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 03/28] staging: iio: tsl2583: check if chip is suspended in in_illuminance_calibrate_store

2016-11-12 Thread Brian Masney
On Sat, Nov 12, 2016 at 04:27:32PM +, Jonathan Cameron wrote:
> On 12/11/16 16:24, Jonathan Cameron wrote:
> > On 10/11/16 09:25, Brian Masney wrote:
> >> in_illuminance_calibrate_store() did not check to see if the chip is
> >> suspended. This patch adds the proper check. The return value from
> >> taos_als_calibrate() was also not checked in this function, so the
> >> proper check was also added while changes are being made here.
> >>
> >> Signed-off-by: Brian Masney 
> > Applied.
> And backed out. It doesn't build :(
> 
> drivers/staging/iio/light/tsl2583.c:511:10: error: ‘struct tsl2583_chip’ has 
> no member named ‘suspended’
>   if (chip->suspended) {
>   ^~

Bummer! I'll get this fixed and send out an updated series in a little
bit.

Brian
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 20/28] staging: iio: tsl2583: don't assume an unsigned int is 32 bits

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:25, Brian Masney wrote:
> in_illuminance_lux_table_store assumes that an unsigned int is 32 bits.
> Replace this with sizeof(unsigned int).
> 
> Signed-off-by: Brian Masney 
Preferred to use sizeof(value[0]) in case it changes type sometime in the 
future?
> ---
>  drivers/staging/iio/light/tsl2583.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index 1b883b5..bcee31b 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -578,7 +578,7 @@ static ssize_t in_illuminance_lux_table_store(struct 
> device *dev,
>  
>   /* Zero out the table */
>   memset(tsl2583_device_lux, 0, sizeof(tsl2583_device_lux));
> - memcpy(tsl2583_device_lux, &value[1], value[0] * 4);
> + memcpy(tsl2583_device_lux, &value[1], value[0] * sizeof(unsigned int));
>  
>   ret = len;
>  
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 21/28] staging: iio: tsl2583: move from a global to a per device lux table

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:25, Brian Masney wrote:
> The driver contains a global lux table that can be updated via sysfs.
> Change this to a per device lux table so that multiple devices can be
> hooked up to the same system with different lux tables.
> 
> There are 10 entries, plus 1 for the termination segment, set aside for
> the entries in the lux table. When updating the lux table via sysfs,
> only 9 entries, plus the terminator, could be added. This changes
> the code to allow for the 10 entries, plus the terminator.
> 
> Signed-off-by: Brian Masney 
A follow through comment to make sure you carry over a change suggested
for an earlier patch.

Otherwise, looks good.

Jonathan
> ---
> I also included the change for the lux table size since I feel that it will
> make the review of the overall change easier.
> 
>  drivers/staging/iio/light/tsl2583.c | 80 
> +
>  1 file changed, 46 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index bcee31b..c9635e3 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -70,11 +70,34 @@ struct tsl2583_als_info {
>   u16 lux;
>  };
>  
> +struct tsl2583_lux {
> + unsigned int ratio;
> + unsigned int ch0;
> + unsigned int ch1;
> +};
> +
> +static const struct tsl2583_lux tsl2583_default_lux[] = {
> + {  9830,  8520, 15729 },
> + { 12452, 10807, 23344 },
> + { 14746,  6383, 11705 },
> + { 17695,  4063,  6554 },
> + { 0, 0, 0 }  /* Termination segment */
> +};
> +
> +#define TSL2583_MAX_LUX_TABLE_ENTRIES 11
> +
>  struct tsl2583_settings {
>   int als_time;
>   int als_gain;
>   int als_gain_trim;
>   int als_cal_target;
> +
> + /*
> +  * This structure is intentionally large to accommodate updates via
> +  * sysfs. Sized to 11 = max 10 segments + 1 termination segment.
> +  * Assumption is that one and only one type of glass used.
> +  */
> + struct tsl2583_lux als_device_lux[TSL2583_MAX_LUX_TABLE_ENTRIES];
>  };
>  
>  struct tsl2583_chip {
> @@ -87,24 +110,6 @@ struct tsl2583_chip {
>   bool suspended;
>  };
>  
> -struct tsl2583_lux {
> - unsigned int ratio;
> - unsigned int ch0;
> - unsigned int ch1;
> -};
> -
> -/*
> - * This structure is intentionally large to accommodate updates via sysfs.
> - * Sized to 11 = max 10 segments + 1 termination segment. Assumption is that
> - * one and only one type of glass used.
> - */
> -static struct tsl2583_lux tsl2583_device_lux[11] = {
> - {  9830,  8520, 15729 },
> - { 12452, 10807, 23344 },
> - { 14746,  6383, 11705 },
> - { 17695,  4063,  6554 },
> -};
> -
>  struct gainadj {
>   s16 ch0;
>   s16 ch1;
> @@ -142,6 +147,10 @@ static void tsl2583_defaults(struct tsl2583_chip *chip)
>  
>   /* Known external ALS reading used for calibration */
>   chip->als_settings.als_cal_target = 130;
> +
> + /* Default lux table. */
> + memcpy(chip->als_settings.als_device_lux, tsl2583_default_lux,
> +sizeof(tsl2583_default_lux));
>  }
>  
>  /*
> @@ -151,7 +160,7 @@ static void tsl2583_defaults(struct tsl2583_chip *chip)
>   * Time scale factor array values are adjusted based on the integration time.
>   * The raw values are multiplied by a scale factor, and device gain is 
> obtained
>   * using gain index. Limit checks are done next, then the ratio of a multiple
> - * of ch1 value, to the ch0 value, is calculated. The array 
> tsl2583_device_lux[]
> + * of ch1 value, to the ch0 value, is calculated. The array als_device_lux[]
>   * declared above is then scanned to find the first ratio value that is just
>   * above the ratio we just calculated. The ch0 and ch1 multiplier constants 
> in
>   * the array are then used along with the time scale factor array values, to
> @@ -229,7 +238,7 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
>   ratio = (ch1 << 15) / ch0;
>  
>   /* convert to unscaled lux using the pointer to the table */
> - for (p = (struct tsl2583_lux *)tsl2583_device_lux;
> + for (p = (struct tsl2583_lux *)chip->als_settings.als_device_lux;
>p->ratio != 0 && p->ratio < ratio; p++)
>   ;
>  
> @@ -266,7 +275,7 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
>  
>   /*
>* Adjust for active gain scale.
> -  * The tsl2583_device_lux tables above have a factor of 8192 built in,
> +  * The tsl2583_default_lux tables above have a factor of 8192 built in,
>* so we need to shift right.
>* User-specified gain provides a multiplier.
>* Apply user-specified gain before shifting right to retain precision.
> @@ -518,15 +527,17 @@ static ssize_t in_illuminance_lux_table_show(struct 
> device *dev,
>struct device_attribute *attr,
>char *buf)
>  {
> + st

Re: [PATCH v3 28/28] staging: iio: tsl2583: move out of staging

2016-11-12 Thread Jonathan Cameron
On 10/11/16 09:26, Brian Masney wrote:
> Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline.
> 
> Signed-off-by: Brian Masney 
The rest of the series (that I haven't commented on) looks good to me.

I'll pick them up once those few minor changes are sorted.

Thanks,

Jonathan
> ---
>  .../ABI/testing/sysfs-bus-iio-light-tsl2583|  20 +
>  drivers/iio/light/Kconfig  |   7 +
>  drivers/iio/light/Makefile |   1 +
>  drivers/iio/light/tsl2583.c| 909 
> +
>  .../light/sysfs-bus-iio-light-tsl2583  |  20 -
>  drivers/staging/iio/light/Kconfig  |   7 -
>  drivers/staging/iio/light/Makefile |   1 -
>  drivers/staging/iio/light/tsl2583.c| 909 
> -
>  8 files changed, 937 insertions(+), 937 deletions(-)
>  create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583
>  create mode 100644 drivers/iio/light/tsl2583.c
>  delete mode 100644 
> drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
>  delete mode 100644 drivers/staging/iio/light/tsl2583.c
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583 
> b/Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583
> new file mode 100644
> index 000..a2e1996
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583
> @@ -0,0 +1,20 @@
> +What:/sys/bus/iio/devices/device[n]/in_illuminance_calibrate
> +KernelVersion:   2.6.37
> +Contact: linux-...@vger.kernel.org
> +Description:
> + This property causes an internal calibration of the als gain 
> trim
> + value which is later used in calculating illuminance in lux.
> +
> +What:/sys/bus/iio/devices/device[n]/in_illuminance_lux_table
> +KernelVersion:   2.6.37
> +Contact: linux-...@vger.kernel.org
> +Description:
> + This property gets/sets the table of coefficients
> + used in calculating illuminance in lux.
> +
> +What:
> /sys/bus/iio/devices/device[n]/in_illuminance_input_target
> +KernelVersion:   2.6.37
> +Contact: linux-...@vger.kernel.org
> +Description:
> + This property is the known externally illuminance (in lux).
> + It is used in the process of calibrating the device accuracy.
> diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
> index d011720..298ea50 100644
> --- a/drivers/iio/light/Kconfig
> +++ b/drivers/iio/light/Kconfig
> @@ -338,6 +338,13 @@ config SENSORS_TSL2563
>This driver can also be built as a module.  If so, the module
>will be called tsl2563.
>  
> +config TSL2583
> + tristate "TAOS TSL2580, TSL2581 and TSL2583 light-to-digital converters"
> + depends on I2C
> + help
> +  Provides support for the TAOS tsl2580, tsl2581 and tsl2583 devices.
> +  Access ALS data via iio, sysfs.
> +
>  config TSL4531
>   tristate "TAOS TSL4531 ambient light sensors"
>   depends on I2C
> diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile
> index 15f24c5..4de5200 100644
> --- a/drivers/iio/light/Makefile
> +++ b/drivers/iio/light/Makefile
> @@ -31,6 +31,7 @@ obj-$(CONFIG_SI1145)+= si1145.o
>  obj-$(CONFIG_STK3310)  += stk3310.o
>  obj-$(CONFIG_TCS3414)+= tcs3414.o
>  obj-$(CONFIG_TCS3472)+= tcs3472.o
> +obj-$(CONFIG_TSL2583)+= tsl2583.o
>  obj-$(CONFIG_TSL4531)+= tsl4531.o
>  obj-$(CONFIG_US5182D)+= us5182d.o
>  obj-$(CONFIG_VCNL4000)   += vcnl4000.o
> diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
> new file mode 100644
> index 000..b6da79b
> --- /dev/null
> +++ b/drivers/iio/light/tsl2583.c
> @@ -0,0 +1,909 @@
> +/*
> + * Device driver for monitoring ambient light intensity (lux)
> + * within the TAOS tsl258x family of devices (tsl2580, tsl2581, tsl2583).
> + *
> + * Copyright (c) 2011, TAOS Corporation.
> + * Copyright (c) 2016 Brian Masney 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but 
> WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* Device Registers and Masks */
> +#define TSL2583_CNTRL0x00
> +#define TSL2583_ALS_TIME 0X01
> +#define TSL2583_INTERRUPT0x02
> +#

[PATCH] [STYLE 1/5]staging:speakup:speakup_soft.c Modify block text

2016-11-12 Thread Walt Feasel
Modified multiline comment to single

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_soft.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/speakup/speakup_soft.c 
b/drivers/staging/speakup/speakup_soft.c
index 6b1d0f5..c14a136 100644
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -55,9 +55,8 @@ static struct var_t vars[] = {
V_LAST_VAR
 };
 
-/*
- * These attributes will appear in /sys/accessibility/speakup/soft.
- */
+/* These attributes will appear in /sys/accessibility/speakup/soft. */
+
 static struct kobj_attribute caps_start_attribute =
__ATTR(caps_start, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute caps_stop_attribute =
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/5]staging:speakup:speakup_soft.c Space preferred around

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: CHECK: spaces preferred around that '|'

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_soft.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/speakup/speakup_soft.c 
b/drivers/staging/speakup/speakup_soft.c
index c14a136..17baebd 100644
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -58,23 +58,23 @@ static struct var_t vars[] = {
 /* These attributes will appear in /sys/accessibility/speakup/soft. */
 
 static struct kobj_attribute caps_start_attribute =
-   __ATTR(caps_start, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(caps_start, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute caps_stop_attribute =
-   __ATTR(caps_stop, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(caps_stop, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute freq_attribute =
-   __ATTR(freq, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(freq, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute pitch_attribute =
-   __ATTR(pitch, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(pitch, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute punct_attribute =
-   __ATTR(punct, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(punct, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute rate_attribute =
-   __ATTR(rate, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(rate, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute tone_attribute =
-   __ATTR(tone, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(tone, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute voice_attribute =
-   __ATTR(voice, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(voice, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute vol_attribute =
-   __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(vol, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 
 /*
  * We should uncomment the following definition, when we agree on a
@@ -84,15 +84,15 @@ static struct kobj_attribute vol_attribute =
  */
 
 static struct kobj_attribute delay_time_attribute =
-   __ATTR(delay_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(delay_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute direct_attribute =
-   __ATTR(direct, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(direct, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute full_time_attribute =
-   __ATTR(full_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(full_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute jiffy_delta_attribute =
-   __ATTR(jiffy_delta, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(jiffy_delta, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute trigger_time_attribute =
-   __ATTR(trigger_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(trigger_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 
 /*
  * Create a group of attributes so that we can create and destroy them all
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 3/5]staging:speakup:speakup_soft.c Align match parenthesis

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: CHECK: Alignment should match open parenthesis

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_soft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/speakup_soft.c 
b/drivers/staging/speakup/speakup_soft.c
index 17baebd..d19f8da 100644
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -277,7 +277,7 @@ static ssize_t softsynth_write(struct file *fp, const char 
__user *buf,
 }
 
 static unsigned int softsynth_poll(struct file *fp,
-   struct poll_table_struct *wait)
+  struct poll_table_struct *wait)
 {
unsigned long flags;
int ret = 0;
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 16/28] staging: iio: tsl2583: updated code comment to match what the code does

2016-11-12 Thread Brian Masney
On Sat, Nov 12, 2016 at 04:36:37PM +, Jonathan Cameron wrote:
> On 10/11/16 09:25, Brian Masney wrote:
> > If channel 0 does not have any data, then the code sets the lux to zero.
> > The corresponding comment says that the last value is returned. This
> > updates the comment to correctly reflect what the code does.
> > 
> > Signed-off-by: Brian Masney 
> Better perhaps to just return an error, -EAGAIN perhaps?
> I'm not sure why it would not give a value.

This check is to avoid a division by zero. Here is the relevant code
that wasn't shown in the diff:

if (!ch0) {
/* have no data, so return 0 */
ret = 0;
chip->als_cur_info.lux = 0;
goto done;
}

/* calculate ratio */
ratio = (ch1 << 15) / ch0;

Channel 0 is sensitive to both infrared and visible light. In total
darkness, the sensor should return 0. Correct me if I am wrong, but
I believe that returning 0 here is more correct than -EAGAIN.

Brian
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 4/5]staging:speakup:speakup_soft.c Logical continuations

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: CHECK: Logical continuations should be on the previous line

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_soft.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/speakup_soft.c 
b/drivers/staging/speakup/speakup_soft.c
index d19f8da..096d6e0 100644
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -161,8 +161,8 @@ static char *get_initstring(void)
cp = buf;
var = synth_soft.vars;
while (var->var_id != MAXVARS) {
-   if (var->var_id != CAPS_START && var->var_id != CAPS_STOP
-   && var->var_id != DIRECT)
+   if (var->var_id != CAPS_START && var->var_id != CAPS_STOP &&
+   var->var_id != DIRECT)
cp = cp + sprintf(cp, var->u.n.synth_fmt,
  var->u.n.value);
var++;
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 5/5]staging:speakup:speakup_soft.c Blank lines

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: CHECK: Please don't use multiple blank lines
CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_soft.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/speakup/speakup_soft.c 
b/drivers/staging/speakup/speakup_soft.c
index 096d6e0..9797bd1 100644
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -309,10 +309,8 @@ static const struct file_operations softsynth_fops = {
.release = softsynth_close,
 };
 
-
 static int softsynth_probe(struct spk_synth *synth)
 {
-
if (misc_registered != 0)
return 0;
memset(&synth_device, 0, sizeof(synth_device));
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 16/28] staging: iio: tsl2583: updated code comment to match what the code does

2016-11-12 Thread Jonathan Cameron
On 12/11/16 16:59, Brian Masney wrote:
> On Sat, Nov 12, 2016 at 04:36:37PM +, Jonathan Cameron wrote:
>> On 10/11/16 09:25, Brian Masney wrote:
>>> If channel 0 does not have any data, then the code sets the lux to zero.
>>> The corresponding comment says that the last value is returned. This
>>> updates the comment to correctly reflect what the code does.
>>>
>>> Signed-off-by: Brian Masney 
>> Better perhaps to just return an error, -EAGAIN perhaps?
>> I'm not sure why it would not give a value.
> 
> This check is to avoid a division by zero. Here is the relevant code
> that wasn't shown in the diff:
> 
>   if (!ch0) {
>   /* have no data, so return 0 */
>   ret = 0;
>   chip->als_cur_info.lux = 0;
>   goto done;
>   }
> 
>   /* calculate ratio */
>   ratio = (ch1 << 15) / ch0;
> 
> Channel 0 is sensitive to both infrared and visible light. In total
> darkness, the sensor should return 0. Correct me if I am wrong, but
> I believe that returning 0 here is more correct than -EAGAIN.
> 
> Brian
> 
Fair enough I hadn't understood that.  Maybe expand the comment
to cover that?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/2]staging:speakup:speakup_spkout.c Block comment align

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: WARNING: Block comments should align the * on each line
Modified multiline text to single
Removed blankline at end

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_spkout.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/speakup/speakup_spkout.c 
b/drivers/staging/speakup/speakup_spkout.c
index e449f27..2146fff 100644
--- a/drivers/staging/speakup/speakup_spkout.c
+++ b/drivers/staging/speakup/speakup_spkout.c
@@ -1,6 +1,6 @@
 /*
  * originally written by: Kirk Reiser 
-* this version considerably modified by David Borowski, david...@rogers.com
+ * this version considerably modified by David Borowski, david...@rogers.com
  *
  * Copyright (C) 1998-99  Kirk Reiser.
  * Copyright (C) 2003 David Borowski.
@@ -40,9 +40,8 @@ static struct var_t vars[] = {
V_LAST_VAR
 };
 
-/*
- * These attributes will appear in /sys/accessibility/speakup/spkout.
- */
+/* These attributes will appear in /sys/accessibility/speakup/spkout. */
+
 static struct kobj_attribute caps_start_attribute =
__ATTR(caps_start, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute caps_stop_attribute =
@@ -149,4 +148,3 @@ MODULE_AUTHOR("David Borowski");
 MODULE_DESCRIPTION("Speakup support for Speak Out synthesizers");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/2]staging:speakup:speakup_spkout.c Spaces preferred around

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: CHECK: spaces preferred around that '|'

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_spkout.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/speakup/speakup_spkout.c 
b/drivers/staging/speakup/speakup_spkout.c
index 2146fff..93b4530 100644
--- a/drivers/staging/speakup/speakup_spkout.c
+++ b/drivers/staging/speakup/speakup_spkout.c
@@ -43,30 +43,30 @@ static struct var_t vars[] = {
 /* These attributes will appear in /sys/accessibility/speakup/spkout. */
 
 static struct kobj_attribute caps_start_attribute =
-   __ATTR(caps_start, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(caps_start, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute caps_stop_attribute =
-   __ATTR(caps_stop, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(caps_stop, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute pitch_attribute =
-   __ATTR(pitch, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(pitch, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute punct_attribute =
-   __ATTR(punct, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(punct, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute rate_attribute =
-   __ATTR(rate, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(rate, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute tone_attribute =
-   __ATTR(tone, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(tone, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute vol_attribute =
-   __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(vol, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 
 static struct kobj_attribute delay_time_attribute =
-   __ATTR(delay_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(delay_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute direct_attribute =
-   __ATTR(direct, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(direct, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute full_time_attribute =
-   __ATTR(full_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(full_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute jiffy_delta_attribute =
-   __ATTR(jiffy_delta, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(jiffy_delta, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute trigger_time_attribute =
-   __ATTR(trigger_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(trigger_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 
 /*
  * Create a group of attributes so that we can create and destroy them all
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/2]staging:speakup:speakup_txprt.c Block comment align

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: WARNING: Block comments should align the * on each line
Modified multiline comment to single
Removed blank line at end

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_txprt.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/speakup/speakup_txprt.c 
b/drivers/staging/speakup/speakup_txprt.c
index fd98d4f..4d33e72 100644
--- a/drivers/staging/speakup/speakup_txprt.c
+++ b/drivers/staging/speakup/speakup_txprt.c
@@ -1,6 +1,6 @@
 /*
  * originally written by: Kirk Reiser 
-* this version considerably modified by David Borowski, david...@rogers.com
+ * this version considerably modified by David Borowski, david...@rogers.com
  *
  * Copyright (C) 1998-99  Kirk Reiser.
  * Copyright (C) 2003 David Borowski.
@@ -36,9 +36,8 @@ static struct var_t vars[] = {
V_LAST_VAR
 };
 
-/*
- * These attributes will appear in /sys/accessibility/speakup/txprt.
- */
+/* These attributes will appear in /sys/accessibility/speakup/txprt. */
+
 static struct kobj_attribute caps_start_attribute =
__ATTR(caps_start, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute caps_stop_attribute =
@@ -130,4 +129,3 @@ MODULE_AUTHOR("David Borowski");
 MODULE_DESCRIPTION("Speakup support for Transport synthesizers");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/2]staging:speakup:speakup_txprt.c Spaces preferred around

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: CHECK: spaces preferred around that '|'

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/speakup_txprt.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/speakup/speakup_txprt.c 
b/drivers/staging/speakup/speakup_txprt.c
index 4d33e72..6ac1f9e 100644
--- a/drivers/staging/speakup/speakup_txprt.c
+++ b/drivers/staging/speakup/speakup_txprt.c
@@ -39,28 +39,28 @@ static struct var_t vars[] = {
 /* These attributes will appear in /sys/accessibility/speakup/txprt. */
 
 static struct kobj_attribute caps_start_attribute =
-   __ATTR(caps_start, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(caps_start, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute caps_stop_attribute =
-   __ATTR(caps_stop, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(caps_stop, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute pitch_attribute =
-   __ATTR(pitch, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(pitch, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute rate_attribute =
-   __ATTR(rate, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(rate, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute tone_attribute =
-   __ATTR(tone, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(tone, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute vol_attribute =
-   __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(vol, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 
 static struct kobj_attribute delay_time_attribute =
-   __ATTR(delay_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(delay_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute direct_attribute =
-   __ATTR(direct, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(direct, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute full_time_attribute =
-   __ATTR(full_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(full_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute jiffy_delta_attribute =
-   __ATTR(jiffy_delta, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(jiffy_delta, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute trigger_time_attribute =
-   __ATTR(trigger_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(trigger_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 
 /*
  * Create a group of attributes so that we can create and destroy them all
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:speakup:spk_priv_keyinfo.h Spaces preferred around

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: spaces preferred around that '+'

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/spk_priv_keyinfo.h | 44 +++---
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/speakup/spk_priv_keyinfo.h 
b/drivers/staging/speakup/spk_priv_keyinfo.h
index 130e9cb..29bbcc0 100644
--- a/drivers/staging/speakup/spk_priv_keyinfo.h
+++ b/drivers/staging/speakup/spk_priv_keyinfo.h
@@ -80,27 +80,27 @@
 
 /* keys for setting variables, must be ordered same as the enum for var_ids */
 /* with dec being even and inc being 1 greater */
-#define SPELL_DELAY_DEC (VAR_START+0)
-#define SPELL_DELAY_INC (SPELL_DELAY_DEC+1)
-#define PUNC_LEVEL_DEC (SPELL_DELAY_DEC+2)
-#define PUNC_LEVEL_INC (PUNC_LEVEL_DEC+1)
-#define READING_PUNC_DEC (PUNC_LEVEL_DEC+2)
-#define READING_PUNC_INC (READING_PUNC_DEC+1)
-#define ATTRIB_BLEEP_DEC (READING_PUNC_DEC+2)
-#define ATTRIB_BLEEP_INC (ATTRIB_BLEEP_DEC+1)
-#define BLEEPS_DEC (ATTRIB_BLEEP_DEC+2)
-#define BLEEPS_INC (BLEEPS_DEC+1)
-#define RATE_DEC (BLEEPS_DEC+2)
-#define RATE_INC (RATE_DEC+1)
-#define PITCH_DEC (RATE_DEC+2)
-#define PITCH_INC (PITCH_DEC+1)
-#define VOL_DEC (PITCH_DEC+2)
-#define VOL_INC (VOL_DEC+1)
-#define TONE_DEC (VOL_DEC+2)
-#define TONE_INC (TONE_DEC+1)
-#define PUNCT_DEC (TONE_DEC+2)
-#define PUNCT_INC (PUNCT_DEC+1)
-#define VOICE_DEC (PUNCT_DEC+2)
-#define VOICE_INC (VOICE_DEC+1)
+#define SPELL_DELAY_DEC (VAR_START + 0)
+#define SPELL_DELAY_INC (SPELL_DELAY_DEC + 1)
+#define PUNC_LEVEL_DEC (SPELL_DELAY_DEC + 2)
+#define PUNC_LEVEL_INC (PUNC_LEVEL_DEC + 1)
+#define READING_PUNC_DEC (PUNC_LEVEL_DEC + 2)
+#define READING_PUNC_INC (READING_PUNC_DEC + 1)
+#define ATTRIB_BLEEP_DEC (READING_PUNC_DEC + 2)
+#define ATTRIB_BLEEP_INC (ATTRIB_BLEEP_DEC + 1)
+#define BLEEPS_DEC (ATTRIB_BLEEP_DEC + 2)
+#define BLEEPS_INC (BLEEPS_DEC + 1)
+#define RATE_DEC (BLEEPS_DEC + 2)
+#define RATE_INC (RATE_DEC + 1)
+#define PITCH_DEC (RATE_DEC + 2)
+#define PITCH_INC (PITCH_DEC + 1)
+#define VOL_DEC (PITCH_DEC + 2)
+#define VOL_INC (VOL_DEC + 1)
+#define TONE_DEC (VOL_DEC + 2)
+#define TONE_INC (TONE_DEC + 1)
+#define PUNCT_DEC (TONE_DEC + 2)
+#define PUNCT_INC (PUNCT_DEC + 1)
+#define VOICE_DEC (PUNCT_DEC + 2)
+#define VOICE_INC (VOICE_DEC + 1)
 
 #endif
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:speakup:spk_types.h Align match parenthesis

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: Alignment should match open parenthesis

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/spk_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/spk_types.h 
b/drivers/staging/speakup/spk_types.h
index e8ff5d7..7c635d4 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -169,7 +169,7 @@ struct spk_synth {
int (*probe)(struct spk_synth *synth);
void (*release)(void);
const char *(*synth_immediate)(struct spk_synth *synth,
-   const char *buff);
+  const char *buff);
void (*catch_up)(struct spk_synth *synth);
void (*flush)(struct spk_synth *synth);
int (*is_alive)(struct spk_synth *synth);
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: vc04_services: rework ioctl code path

2016-11-12 Thread Stefan Wahren
Hi Michael,

> Michael Zoran  hat am 11. November 2016 um 07:15
> geschrieben:
> 
> 
> VCHIQ/vc04_services has a userland device interface
> that includes ioctls. The current ioctl implementation
> is a single monolithic function over 1,000+ lines
> that handles 17 different ioctls through a complex
> maze of switch and if statements.
> 
> The change reimplements that code path by breaking
> up the code into smaller, easier to maintain functions
> and uses a dispatch table to invoke the correct function.

nice. But please always use scripts/checkpatch.pl before submitting your
patches. 

And yes it is not necessary to fix all "line over 80 chars" warnings.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/5]staging:speakup:synth.c Modified block text

2016-11-12 Thread Walt Feasel
Modified block comment for alignment consistency

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/synth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 54b2f39..29efdb1 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -8,7 +8,7 @@
 #include/* for loops_per_sec */
 #include 
 #include 
-#include  /* for copy_from_user */
+#include  /* for copy_from_user */
 #include 
 #include 
 #include 
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] [STYLE 1/5]staging:speakup:synth.c Modified block text

2016-11-12 Thread Walt Feasel
Modified block comment for alignment consistency

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/synth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 54b2f39..800fbbf 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -8,7 +8,7 @@
 #include/* for loops_per_sec */
 #include 
 #include 
-#include  /* for copy_from_user */
+#include  /* for copy_from_user */
 #include 
 #include 
 #include 
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/5]staging:speakup:synth.c Logical continuation previous

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: Logical continuations should be on the previous line

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/synth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 800fbbf..a53bdce 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -406,8 +406,8 @@ static int do_synth_init(struct spk_synth *in_synth)
speakup_register_var(var);
if (!spk_quiet_boot)
synth_printf("%s found\n", synth->long_name);
-   if (synth->attributes.name
-   && sysfs_create_group(speakup_kobj, &synth->attributes) < 0)
+   if (synth->attributes.name &&
+   sysfs_create_group(speakup_kobj, &synth->attributes) < 0)
return -ENOMEM;
synth_flags = synth->flags;
wake_up_interruptible_all(&speakup_event);
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 3/5]staging:speakup:synth.c Space preferred around

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: spaces preferred around that '/,+,-'

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/synth.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index a53bdce..aac3f3b 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -303,11 +303,11 @@ void spk_get_index_count(int *linecount, int *sentcount)
sentence_count = ind % 10;
 
if ((ind / 10) <= synth->indexing.currindex)
-   index_count = synth->indexing.currindex-(ind/10);
+   index_count = synth->indexing.currindex - (ind / 10);
else
index_count = synth->indexing.currindex
-   -synth->indexing.lowindex
-   + synth->indexing.highindex-(ind/10)+1;
+   - synth->indexing.lowindex
+   + synth->indexing.highindex - (ind / 10) + 1;
 
}
*sentcount = sentence_count;
@@ -476,10 +476,10 @@ void synth_remove(struct spk_synth *in_synth)
break;
}
for ( ; synths[i] != NULL; i++) /* compress table */
-   synths[i] = synths[i+1];
+   synths[i] = synths[i + 1];
module_status = 0;
mutex_unlock(&spk_mutex);
 }
 EXPORT_SYMBOL_GPL(synth_remove);
 
-short spk_punc_masks[] = { 0, SOME, MOST, PUNC, PUNC|B_SYM };
+short spk_punc_masks[] = { 0, SOME, MOST, PUNC, PUNC | B_SYM };
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 4/5]staging:speakup:synth.c Align match parenthesis

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: Alignment should match open parenthesis

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/synth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index aac3f3b..57ab7a2 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -66,8 +66,8 @@ int spk_serial_synth_probe(struct spk_synth *synth)
pr_info("%s: not found\n", synth->long_name);
return -ENODEV;
}
-   pr_info("%s: ttyS%i, Driver Version %s\n",
-   synth->long_name, synth->ser, synth->version);
+   pr_info("%s: ttyS%i, Driver Version %s\n", synth->long_name, synth->ser,
+   synth->version);
synth->alive = 1;
return 0;
 }
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 5/5]staging:speakup:synth.c Blankline before close }

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/synth.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 57ab7a2..7b84513 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -308,7 +308,6 @@ void spk_get_index_count(int *linecount, int *sentcount)
index_count = synth->indexing.currindex
- synth->indexing.lowindex
+ synth->indexing.highindex - (ind / 10) + 1;
-
}
*sentcount = sentence_count;
*linecount = index_count;
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/2]staging:speakup:thread.c Modified block comment

2016-11-12 Thread Walt Feasel
Modified block comment to multiline style

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/thread.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/thread.c b/drivers/staging/speakup/thread.c
index 90c383e..e4de7dc 100644
--- a/drivers/staging/speakup/thread.c
+++ b/drivers/staging/speakup/thread.c
@@ -47,7 +47,8 @@ int speakup_thread(void *data)
if (our_sound.active)
kd_mksound(our_sound.freq, our_sound.jiffies);
if (synth && synth->catch_up && synth->alive) {
-   /* It is up to the callee to take the lock, so that it
+   /*
+* It is up to the callee to take the lock, so that it
 * can sleep whenever it likes
 */
synth->catch_up(synth);
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/2]staging:speakup:thread.c Align match parenthesis

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: CHECK: Alignment should match open parenthesis

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/thread.c b/drivers/staging/speakup/thread.c
index e4de7dc..8c64f1a 100644
--- a/drivers/staging/speakup/thread.c
+++ b/drivers/staging/speakup/thread.c
@@ -27,7 +27,7 @@ int speakup_thread(void *data)
our_sound = spk_unprocessed_sound;
spk_unprocessed_sound.active = 0;
prepare_to_wait(&speakup_event, &wait,
-   TASK_INTERRUPTIBLE);
+   TASK_INTERRUPTIBLE);
should_break = kthread_should_stop() ||
our_sound.active ||
(synth && synth->catch_up && synth->alive &&
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 00/26] staging: iio: tsl2583: move out of staging

2016-11-12 Thread Brian Masney
This patch set continues my work to clean up the tsl2583 driver to move
it out of staging. Some highlights include:

- Eliminated some unnecessary i2c calls to the sensor.
- Fixed issue with changes to calibscale and int_time not being set on
  the chip.
- Moved from a global lux table to a per device lux table.
- Combined redundant sysfs ABI documentation.
- Made log messages clearer.
- Fixes for some return values that were not checked.
- Chip state is now represented as a boolean instead of a tristate.
- Removed unnecessary chip status checks.
- Use a unified prefix for all symbols (tsl2583_).
- Code style and formatting cleanups.
- Comment cleanups.
- Staging graduation.

I verified that the driver functions correctly using a TSL2581 hooked
up to a Raspberry Pi 2.

Changes from V3 to V4
- Fixed patch 03/28 so that it compiles properly. It was fixed later
  in the old series but this needs to be corrected so that people can
  use git bisect. I verified that every patch in this series compiles
  when incrementally applied.
- Clarified comment on patch 14 in this series.
- Use sizeof(value[1]) instead of sizeof(unsigned int) when updating
  the lux table on patch 18 of this series.

Changes from V2 to V3
- Fixed patch #09 to use "%s: ", __func__ consistently. Added
  missing terminating "\n" to one of the log messages. Issues reported
  by Joe Perches.
- Fixed issues found by Jonathan Cameron: comment cleanups, improved the
  wording of two log messages, removed an unnecessary memset call,
  removed unnecessary variable initialization, and multiple driver
  authors can be specified with multiple calls to MODULE_AUTHOR().
- Fixed warning found by make C=1 in the per device lux table:
  warning: Variable length array is used.

Changes from V1 to V2
- The first 7 patches in this series contains version 2 of the patches
  7-9 that I sent out on 2016-11-03. The only change is that the patches
  are split up further to make the code review easier.

Brian Masney (26):
  staging: iio: tsl2583: check if chip is in a working state in
in_illuminance_calibrate_store
  staging: iio: tsl2583: remove unnecessary chip status check in
taos_get_lux
  staging: iio: tsl2583: remove unnecessary chip status checks in
suspend/resume
  staging: iio: tsl2583: change current chip state from a tristate to a
bool
  staging: iio: tsl2583: remove redundant write to the control register
in taos_probe()
  staging: iio: tsl2583: remove the FSF's mailing address
  staging: iio: tsl2583: cleaned up logging
  staging: iio: tsl2583: unify function and variable prefix to tsl2583_
  staging: iio: tsl2583: fix alignment of #define values
  staging: iio: tsl2583: fix comparison between signed and unsigned
integers
  staging: iio: tsl2583: change newlines to improve readability
  staging: iio: tsl2583: combine sysfs documentation
  staging: iio: tsl2583: fix multiline comment syntax
  staging: iio: tsl2583: updated code comment to match what the code
does
  staging: iio: tsl2583: moved code block inside else statement
  staging: iio: tsl2583: change tsl2583_als_calibrate() to return 0 on
success
  staging: iio: tsl2583: remove unnecessary parentheses
  staging: iio: tsl2583: don't assume an unsigned int is 32 bits
  staging: iio: tsl2583: move from a global to a per device lux table
  staging: iio: tsl2583: add tsl2583 to list of supported devices in the
header
  staging: iio: tsl2583: clarified comment about clearing interrupts
  staging: iio: tsl2583: remove comment for tsl2583_probe()
  staging: iio: tsl2583: remove unnecessary memset call
  staging: iio: tsl2583: remove unnecessary variable initialization
  staging: iio: tsl2583: add copyright and MODULE_AUTHOR
  staging: iio: tsl2583: move out of staging

 .../ABI/testing/sysfs-bus-iio-light-tsl2583|  20 +
 drivers/iio/light/Kconfig  |   7 +
 drivers/iio/light/Makefile |   1 +
 drivers/iio/light/tsl2583.c| 913 +
 .../light/sysfs-bus-iio-light-tsl2583  |   6 -
 .../iio/Documentation/sysfs-bus-iio-light-tsl2583  |  20 -
 drivers/staging/iio/light/Kconfig  |   7 -
 drivers/staging/iio/light/Makefile |   1 -
 drivers/staging/iio/light/tsl2583.c| 896 
 9 files changed, 941 insertions(+), 930 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583
 create mode 100644 drivers/iio/light/tsl2583.c
 delete mode 100644 
drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
 delete mode 100644 
drivers/staging/iio/Documentation/sysfs-bus-iio-light-tsl2583
 delete mode 100644 drivers/staging/iio/light/tsl2583.c

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/2]staging:speakup:varhandlers.c Moddified block comment

2016-11-12 Thread Walt Feasel
Modified block comment to multiline style

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/varhandlers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/varhandlers.c 
b/drivers/staging/speakup/varhandlers.c
index 21186e3..5ab7245 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -266,7 +266,8 @@ int spk_set_string_var(const char *page, struct 
st_var_header *var, int len)
return 0;
 }
 
-/* spk_set_mask_bits sets or clears the punc/delim/repeat bits,
+/*
+ * spk_set_mask_bits sets or clears the punc/delim/repeat bits,
  * if input is null uses the defaults.
  * values for how: 0 clears bits of chars supplied,
  * 1 clears allk, 2 sets bits for chars
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 02/26] staging: iio: tsl2583: remove unnecessary chip status check in taos_get_lux

2016-11-12 Thread Brian Masney
taos_get_lux checks to see if the chip is in a working state. This
check is not necessary since it is only called from tsl2583_read_raw
and in_illuminance_calibrate_store (via taos_als_calibrate). The chip
state is already checked by these functions.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index de54e74..a550023 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -178,13 +178,6 @@ static int taos_get_lux(struct iio_dev *indio_dev)
u32 ch0lux = 0;
u32 ch1lux = 0;
 
-   if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
-   /* device is not enabled */
-   dev_err(&chip->client->dev, "taos_get_lux device is not 
enabled\n");
-   ret = -EBUSY;
-   goto done;
-   }
-
ret = i2c_smbus_read_byte_data(chip->client, TSL258X_CMD_REG);
if (ret < 0) {
dev_err(&chip->client->dev, "taos_get_lux failed to read 
CMD_REG\n");
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 03/26] staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume

2016-11-12 Thread Brian Masney
The device probing and the suspend/resume code checks a flag internal to
the driver that determines whether or not the chip is in a working
state. These checks are not needed. This patch removes the unnecessary
checks. It will do no harm to the hardware if the chip is
reinitialized if it is already powered on.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 16 +++-
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index a550023..40aa78e 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -412,13 +412,6 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev 
*indio_dev)
struct tsl2583_chip *chip = iio_priv(indio_dev);
int ret;
 
-   /* and make sure we're not already on */
-   if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
-   /* if forcing a register update - turn off, then on */
-   dev_info(&chip->client->dev, "device is already enabled\n");
-   return -EINVAL;
-   }
-
/* Power on the device; ADC off. */
ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_ON);
if (ret < 0)
@@ -841,10 +834,8 @@ static int __maybe_unused taos_suspend(struct device *dev)
 
mutex_lock(&chip->als_mutex);
 
-   if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
-   ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_OFF);
-   chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
-   }
+   ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_OFF);
+   chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
 
mutex_unlock(&chip->als_mutex);
return ret;
@@ -858,8 +849,7 @@ static int __maybe_unused taos_resume(struct device *dev)
 
mutex_lock(&chip->als_mutex);
 
-   if (chip->taos_chip_status == TSL258X_CHIP_SUSPENDED)
-   ret = tsl2583_chip_init_and_power_on(indio_dev);
+   ret = tsl2583_chip_init_and_power_on(indio_dev);
 
mutex_unlock(&chip->als_mutex);
return ret;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 01/26] staging: iio: tsl2583: check if chip is in a working state in in_illuminance_calibrate_store

2016-11-12 Thread Brian Masney
in_illuminance_calibrate_store() did not check to see if the chip is
in a working state. This patch adds the proper check. The return value
from taos_als_calibrate() was also not checked in this function, so the
proper check was also added while changes are being made here.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 1a7be12..de54e74 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -501,16 +501,27 @@ static ssize_t in_illuminance_calibrate_store(struct 
device *dev,
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct tsl2583_chip *chip = iio_priv(indio_dev);
-   int value;
+   int value, ret;
 
if (kstrtoint(buf, 0, &value) || value != 1)
return -EINVAL;
 
mutex_lock(&chip->als_mutex);
-   taos_als_calibrate(indio_dev);
+
+   if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
+   ret = -EBUSY;
+   goto done;
+   }
+
+   ret = taos_als_calibrate(indio_dev);
+   if (ret < 0)
+   goto done;
+
+   ret = len;
+done:
mutex_unlock(&chip->als_mutex);
 
-   return len;
+   return ret;
 }
 
 static ssize_t in_illuminance_lux_table_show(struct device *dev,
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 12/26] staging: iio: tsl2583: combine sysfs documentation

2016-11-12 Thread Brian Masney
There are two separate files describing the tsl2583 sysfs attributes.
Combine the two files into one. Updated the name of the sysfs attributes
to match the current ABI.

Signed-off-by: Brian Masney 
Suggested-by: Peter Meerwald-Stadler 
---
 .../Documentation/light/sysfs-bus-iio-light-tsl2583  | 16 +++-
 .../iio/Documentation/sysfs-bus-iio-light-tsl2583| 20 
 2 files changed, 15 insertions(+), 21 deletions(-)
 delete mode 100644 
drivers/staging/iio/Documentation/sysfs-bus-iio-light-tsl2583

diff --git 
a/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583 
b/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
index 470f7ad..a2e1996 100644
--- a/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
+++ b/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
@@ -1,6 +1,20 @@
-What:  /sys/bus/iio/devices/device[n]/in_illuminance0_calibrate
+What:  /sys/bus/iio/devices/device[n]/in_illuminance_calibrate
 KernelVersion: 2.6.37
 Contact:   linux-...@vger.kernel.org
 Description:
This property causes an internal calibration of the als gain 
trim
value which is later used in calculating illuminance in lux.
+
+What:  /sys/bus/iio/devices/device[n]/in_illuminance_lux_table
+KernelVersion: 2.6.37
+Contact:   linux-...@vger.kernel.org
+Description:
+   This property gets/sets the table of coefficients
+   used in calculating illuminance in lux.
+
+What:  /sys/bus/iio/devices/device[n]/in_illuminance_input_target
+KernelVersion: 2.6.37
+Contact:   linux-...@vger.kernel.org
+Description:
+   This property is the known externally illuminance (in lux).
+   It is used in the process of calibrating the device accuracy.
diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-light-tsl2583 
b/drivers/staging/iio/Documentation/sysfs-bus-iio-light-tsl2583
deleted file mode 100644
index 660781d..000
--- a/drivers/staging/iio/Documentation/sysfs-bus-iio-light-tsl2583
+++ /dev/null
@@ -1,20 +0,0 @@
-What:  /sys/bus/iio/devices/device[n]/lux_table
-KernelVersion: 2.6.37
-Contact:   linux-...@vger.kernel.org
-Description:
-   This property gets/sets the table of coefficients
-   used in calculating illuminance in lux.
-
-What:  /sys/bus/iio/devices/device[n]/illuminance0_calibrate
-KernelVersion: 2.6.37
-Contact:   linux-...@vger.kernel.org
-Description:
-   This property causes an internal calibration of the als gain 
trim
-   value which is later used in calculating illuminance in lux.
-
-What:  /sys/bus/iio/devices/device[n]/illuminance0_input_target
-KernelVersion: 2.6.37
-Contact:   linux-...@vger.kernel.org
-Description:
-   This property is the known externally illuminance (in lux).
-   It is used in the process of calibrating the device accuracy.
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 05/26] staging: iio: tsl2583: remove redundant write to the control register in taos_probe()

2016-11-12 Thread Brian Masney
taos_probe() calls i2c_smbus_write_byte() to select the control
register, however there are no subsequent calls to
i2c_smbus_read_byte(). The write call is unnecessary and is removed by
this patch.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 5a32102..449506b 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -788,14 +788,6 @@ static int taos_probe(struct i2c_client *clientp,
return -EINVAL;
}
 
-   ret = i2c_smbus_write_byte(clientp, (TSL258X_CMD_REG | TSL258X_CNTRL));
-   if (ret < 0) {
-   dev_err(&clientp->dev,
-   "i2c_smbus_write_byte() to cmd reg failed in 
taos_probe(), err = %d\n",
-   ret);
-   return ret;
-   }
-
indio_dev->info = &tsl2583_info;
indio_dev->channels = tsl2583_channels;
indio_dev->num_channels = ARRAY_SIZE(tsl2583_channels);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 08/26] staging: iio: tsl2583: unify function and variable prefix to tsl2583_

2016-11-12 Thread Brian Masney
Some functions and variables were prefixed with either taos, tsl258x,
taos2583, or tsl2583. Change everything to use the tsl2583 prefix since
that is the name of the .c file. The taos_settings member inside the
taos_settings struct was renamed to als_settings.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 214 ++--
 1 file changed, 107 insertions(+), 107 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 5d74e0c1..5a82a26 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -28,35 +28,35 @@
 #include 
 
 /* Device Registers and Masks */
-#define TSL258X_CNTRL  0x00
-#define TSL258X_ALS_TIME   0X01
-#define TSL258X_INTERRUPT  0x02
-#define TSL258X_GAIN   0x07
-#define TSL258X_REVID  0x11
-#define TSL258X_CHIPID 0x12
-#define TSL258X_ALS_CHAN0LO0x14
-#define TSL258X_ALS_CHAN0HI0x15
-#define TSL258X_ALS_CHAN1LO0x16
-#define TSL258X_ALS_CHAN1HI0x17
-#define TSL258X_TMR_LO 0x18
-#define TSL258X_TMR_HI 0x19
+#define TSL2583_CNTRL  0x00
+#define TSL2583_ALS_TIME   0X01
+#define TSL2583_INTERRUPT  0x02
+#define TSL2583_GAIN   0x07
+#define TSL2583_REVID  0x11
+#define TSL2583_CHIPID 0x12
+#define TSL2583_ALS_CHAN0LO0x14
+#define TSL2583_ALS_CHAN0HI0x15
+#define TSL2583_ALS_CHAN1LO0x16
+#define TSL2583_ALS_CHAN1HI0x17
+#define TSL2583_TMR_LO 0x18
+#define TSL2583_TMR_HI 0x19
 
 /* tsl2583 cmd reg masks */
-#define TSL258X_CMD_REG0x80
-#define TSL258X_CMD_SPL_FN 0x60
-#define TSL258X_CMD_ALS_INT_CLR0X01
+#define TSL2583_CMD_REG0x80
+#define TSL2583_CMD_SPL_FN 0x60
+#define TSL2583_CMD_ALS_INT_CLR0X01
 
 /* tsl2583 cntrl reg masks */
-#define TSL258X_CNTL_ADC_ENBL  0x02
-#define TSL258X_CNTL_PWR_OFF   0x00
-#define TSL258X_CNTL_PWR_ON0x01
+#define TSL2583_CNTL_ADC_ENBL  0x02
+#define TSL2583_CNTL_PWR_OFF   0x00
+#define TSL2583_CNTL_PWR_ON0x01
 
 /* tsl2583 status reg masks */
-#define TSL258X_STA_ADC_VALID  0x01
-#define TSL258X_STA_ADC_INTR   0x10
+#define TSL2583_STA_ADC_VALID  0x01
+#define TSL2583_STA_ADC_INTR   0x10
 
 /* Lux calculation constants */
-#defineTSL258X_LUX_CALC_OVER_FLOW  65535
+#defineTSL2583_LUX_CALC_OVER_FLOW  65535
 
 #define TSL2583_INTERRUPT_DISABLED 0x00
 
@@ -64,13 +64,13 @@
 #define TSL2583_CHIP_ID_MASK   0xf0
 
 /* Per-device data */
-struct taos_als_info {
+struct tsl2583_als_info {
u16 als_ch0;
u16 als_ch1;
u16 lux;
 };
 
-struct taos_settings {
+struct tsl2583_settings {
int als_time;
int als_gain;
int als_gain_trim;
@@ -80,14 +80,14 @@ struct taos_settings {
 struct tsl2583_chip {
struct mutex als_mutex;
struct i2c_client *client;
-   struct taos_als_info als_cur_info;
-   struct taos_settings taos_settings;
+   struct tsl2583_als_info als_cur_info;
+   struct tsl2583_settings als_settings;
int als_time_scale;
int als_saturation;
bool suspended;
 };
 
-struct taos_lux {
+struct tsl2583_lux {
unsigned int ratio;
unsigned int ch0;
unsigned int ch1;
@@ -96,7 +96,7 @@ struct taos_lux {
 /* This structure is intentionally large to accommodate updates via sysfs. */
 /* Sized to 11 = max 10 segments + 1 termination segment */
 /* Assumption is one and only one type of glass used  */
-static struct taos_lux taos_device_lux[11] = {
+static struct tsl2583_lux tsl2583_device_lux[11] = {
{  9830,  8520, 15729 },
{ 12452, 10807, 23344 },
{ 14746,  6383, 11705 },
@@ -121,25 +121,25 @@ static const struct gainadj gainadj[] = {
  * Provides initial operational parameter defaults.
  * These defaults may be changed through the device's sysfs files.
  */
-static void taos_defaults(struct tsl2583_chip *chip)
+static void tsl2583_defaults(struct tsl2583_chip *chip)
 {
/*
 * The integration time must be a multiple of 50ms and within the
 * range [50, 600] ms.
 */
-   chip->taos_settings.als_time = 100;
+   chip->als_settings.als_time = 100;
 
/*
 * This is an index into the gainadj table. Assume clear glass as the
 * default.
 */
-   chip->taos_settings.als_gain = 0;
+   chip->als_settings.als_gain = 0;
 
/* Default gain trim to account for aperture effects */
-   chip->taos_settings.als_gain_trim = 1000;
+   chip->als_settings.als_gain_trim = 1000;
 
/* Known external ALS reading used for calib

[PATCH v4 13/26] staging: iio: tsl2583: fix multiline comment syntax

2016-11-12 Thread Brian Masney
The definition of the tsl2583_device_lux struct has a series of single
line comments. There are two other cases where the multiline comments
did not have an initial blank line. Change these comments to use the
proper multiline syntax.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 8303753..52a39a6 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -93,9 +93,11 @@ struct tsl2583_lux {
unsigned int ch1;
 };
 
-/* This structure is intentionally large to accommodate updates via sysfs. */
-/* Sized to 11 = max 10 segments + 1 termination segment */
-/* Assumption is one and only one type of glass used  */
+/*
+ * This structure is intentionally large to accommodate updates via sysfs.
+ * Sized to 11 = max 10 segments + 1 termination segment. Assumption is that
+ * one and only one type of glass used.
+ */
 static struct tsl2583_lux tsl2583_device_lux[11] = {
{  9830,  8520, 15729 },
{ 12452, 10807, 23344 },
@@ -261,7 +263,8 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
lux = (lux + (chip->als_time_scale >> 1)) /
chip->als_time_scale;
 
-   /* Adjust for active gain scale.
+   /*
+* Adjust for active gain scale.
 * The tsl2583_device_lux tables above have a factor of 8192 built in,
 * so we need to shift right.
 * User-specified gain provides a multiplier.
@@ -553,7 +556,8 @@ static ssize_t in_illuminance_lux_table_store(struct device 
*dev,
 
get_options(buf, ARRAY_SIZE(value), value);
 
-   /* We now have an array of ints starting at value[1], and
+   /*
+* We now have an array of ints starting at value[1], and
 * enumerated by value[0].
 * We expect each group of three ints is one table entry,
 * and the last table entry is all 0.
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 16/26] staging: iio: tsl2583: change tsl2583_als_calibrate() to return 0 on success

2016-11-12 Thread Brian Masney
tsl2583_als_calibrate() returns the newly computed gain_trim if the
calibration was successful. This function is only called by
in_illuminance_calibrate_store() and the return value inside that
sysfs attribute is only checked to see if an error was returned.
This patch changes tsl2583_als_calibrate() to return 0 on success.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index bcdf095..fc58074 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -348,7 +348,7 @@ static int tsl2583_als_calibrate(struct iio_dev *indio_dev)
 
chip->als_settings.als_gain_trim = (int)gain_trim_val;
 
-   return (int)gain_trim_val;
+   return 0;
 }
 
 static int tsl2583_set_als_time(struct tsl2583_chip *chip)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 11/26] staging: iio: tsl2583: change newlines to improve readability

2016-11-12 Thread Brian Masney
Add and remove newlines to improve code readability in preparation for
moving the driver out of staging.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index be3cbae..8303753 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -202,7 +202,6 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
ret = i2c_smbus_write_byte(chip->client,
   (TSL2583_CMD_REG | TSL2583_CMD_SPL_FN |
TSL2583_CMD_ALS_INT_CLR));
-
if (ret < 0) {
dev_err(&chip->client->dev, "%s: failed to clear the interrupt 
bit\n",
__func__);
@@ -225,8 +224,10 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
chip->als_cur_info.lux = 0;
goto done;
}
+
/* calculate ratio */
ratio = (ch1 << 15) / ch0;
+
/* convert to unscaled lux using the pointer to the table */
for (p = (struct tsl2583_lux *)tsl2583_device_lux;
 p->ratio != 0 && p->ratio < ratio; p++)
@@ -273,6 +274,7 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
lux64 >>= 13;
lux = lux64;
lux = (lux + 500) / 1000;
+
if (lux > TSL2583_LUX_CALC_OVER_FLOW) { /* check for overflow */
 return_max:
lux = TSL2583_LUX_CALC_OVER_FLOW;
@@ -319,21 +321,23 @@ static int tsl2583_als_calibrate(struct iio_dev 
*indio_dev)
__func__);
return -ENODATA;
}
+
lux_val = tsl2583_get_lux(indio_dev);
if (lux_val < 0) {
dev_err(&chip->client->dev, "%s: failed to get lux\n",
__func__);
return lux_val;
}
+
gain_trim_val = (unsigned int)(((chip->als_settings.als_cal_target)
* chip->als_settings.als_gain_trim) / lux_val);
-
if ((gain_trim_val < 250) || (gain_trim_val > 4000)) {
dev_err(&chip->client->dev,
"%s: trim_val of %d is not within the range [250, 
4000]\n",
__func__, gain_trim_val);
return -ENODATA;
}
+
chip->als_settings.als_gain_trim = (int)gain_trim_val;
 
return (int)gain_trim_val;
@@ -529,6 +533,7 @@ static ssize_t in_illuminance_lux_table_show(struct device 
*dev,
}
 
offset += sprintf(buf + offset, "\n");
+
return offset;
 }
 
@@ -776,6 +781,7 @@ static int tsl2583_probe(struct i2c_client *clientp,
indio_dev = devm_iio_device_alloc(&clientp->dev, sizeof(*chip));
if (!indio_dev)
return -ENOMEM;
+
chip = iio_priv(indio_dev);
chip->client = clientp;
i2c_set_clientdata(clientp, indio_dev);
@@ -803,6 +809,7 @@ static int tsl2583_probe(struct i2c_client *clientp,
indio_dev->dev.parent = &clientp->dev;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->name = chip->client->name;
+
ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
if (ret) {
dev_err(&clientp->dev, "%s: iio registration failed\n",
@@ -819,6 +826,7 @@ static int tsl2583_probe(struct i2c_client *clientp,
return ret;
 
dev_info(&clientp->dev, "Light sensor found.\n");
+
return 0;
 }
 
@@ -834,6 +842,7 @@ static int __maybe_unused tsl2583_suspend(struct device 
*dev)
chip->suspended = true;
 
mutex_unlock(&chip->als_mutex);
+
return ret;
 }
 
@@ -848,6 +857,7 @@ static int __maybe_unused tsl2583_resume(struct device *dev)
ret = tsl2583_chip_init_and_power_on(indio_dev);
 
mutex_unlock(&chip->als_mutex);
+
return ret;
 }
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 15/26] staging: iio: tsl2583: moved code block inside else statement

2016-11-12 Thread Brian Masney
The check for ch1lux > ch0lux inside tsl2583_get_lux is only valid if
the ratio is not equal to zero. Move the code block inside the else
statement. This does away with the need to initialize the variables to
zero.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index dbb7f6a..bcdf095 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -167,8 +167,6 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
struct tsl2583_lux *p;
struct tsl2583_chip *chip = iio_priv(indio_dev);
int i, ret;
-   u32 ch0lux = 0;
-   u32 ch1lux = 0;
 
ret = i2c_smbus_read_byte_data(chip->client, TSL2583_CMD_REG);
if (ret < 0) {
@@ -242,22 +240,25 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
if (p->ratio == 0) {
lux = 0;
} else {
+   u32 ch0lux, ch1lux;
+
ch0lux = ((ch0 * p->ch0) +
  (gainadj[chip->als_settings.als_gain].ch0 >> 1))
 / gainadj[chip->als_settings.als_gain].ch0;
ch1lux = ((ch1 * p->ch1) +
  (gainadj[chip->als_settings.als_gain].ch1 >> 1))
 / gainadj[chip->als_settings.als_gain].ch1;
-   lux = ch0lux - ch1lux;
-   }
 
-   /* note: lux is 31 bit max at this point */
-   if (ch1lux > ch0lux) {
-   dev_dbg(&chip->client->dev, "%s: No Data - Returning 0\n",
-   __func__);
-   ret = 0;
-   chip->als_cur_info.lux = 0;
-   goto done;
+   /* note: lux is 31 bit max at this point */
+   if (ch1lux > ch0lux) {
+   dev_dbg(&chip->client->dev, "%s: No Data - Returning 
0\n",
+   __func__);
+   ret = 0;
+   chip->als_cur_info.lux = 0;
+   goto done;
+   }
+
+   lux = ch0lux - ch1lux;
}
 
/* adjust for active time scale */
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 04/26] staging: iio: tsl2583: change current chip state from a tristate to a bool

2016-11-12 Thread Brian Masney
The current chip state is represented as a tristate (working, suspended,
and unknown). The unknown state was not used. This patch changes the
chip state so that it is now represented as a single boolean value
(suspended).

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 20 +++-
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 40aa78e..5a32102 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -67,12 +67,6 @@
 #define TSL2583_CHIP_ID0x90
 #define TSL2583_CHIP_ID_MASK   0xf0
 
-enum {
-   TSL258X_CHIP_UNKNOWN = 0,
-   TSL258X_CHIP_WORKING = 1,
-   TSL258X_CHIP_SUSPENDED = 2
-};
-
 /* Per-device data */
 struct taos_als_info {
u16 als_ch0;
@@ -94,7 +88,7 @@ struct tsl2583_chip {
struct taos_settings taos_settings;
int als_time_scale;
int als_saturation;
-   int taos_chip_status;
+   bool suspended;
 };
 
 struct taos_lux {
@@ -441,7 +435,7 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev 
*indio_dev)
if (ret < 0)
return ret;
 
-   chip->taos_chip_status = TSL258X_CHIP_WORKING;
+   chip->suspended = false;
 
return ret;
 }
@@ -494,7 +488,7 @@ static ssize_t in_illuminance_calibrate_store(struct device 
*dev,
 
mutex_lock(&chip->als_mutex);
 
-   if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
+   if (chip->suspended) {
ret = -EBUSY;
goto done;
}
@@ -627,7 +621,7 @@ static int tsl2583_read_raw(struct iio_dev *indio_dev,
 
mutex_lock(&chip->als_mutex);
 
-   if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
+   if (chip->suspended) {
ret = -EBUSY;
goto read_done;
}
@@ -704,7 +698,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
 
mutex_lock(&chip->als_mutex);
 
-   if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
+   if (chip->suspended) {
ret = -EBUSY;
goto write_done;
}
@@ -778,7 +772,7 @@ static int taos_probe(struct i2c_client *clientp,
i2c_set_clientdata(clientp, indio_dev);
 
mutex_init(&chip->als_mutex);
-   chip->taos_chip_status = TSL258X_CHIP_UNKNOWN;
+   chip->suspended = true;
 
ret = i2c_smbus_read_byte_data(clientp,
   TSL258X_CMD_REG | TSL258X_CHIPID);
@@ -835,7 +829,7 @@ static int __maybe_unused taos_suspend(struct device *dev)
mutex_lock(&chip->als_mutex);
 
ret = tsl2583_set_power_state(chip, TSL258X_CNTL_PWR_OFF);
-   chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
+   chip->suspended = true;
 
mutex_unlock(&chip->als_mutex);
return ret;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 06/26] staging: iio: tsl2583: remove the FSF's mailing address

2016-11-12 Thread Brian Masney
Address warning from checkpatch:

CHECK: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already
includes a copy of the GPL.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 449506b..57279f7 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -13,10 +13,6 @@
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 09/26] staging: iio: tsl2583: fix alignment of #define values

2016-11-12 Thread Brian Masney
Most of the values in the #defines have their values aligned on a single
column, but some do not. This changes the remaining defines to use
consistent alignment with the majority to improve code readability.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 5a82a26..d482a84 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -44,19 +44,19 @@
 /* tsl2583 cmd reg masks */
 #define TSL2583_CMD_REG0x80
 #define TSL2583_CMD_SPL_FN 0x60
-#define TSL2583_CMD_ALS_INT_CLR0X01
+#define TSL2583_CMD_ALS_INT_CLR0x01
 
 /* tsl2583 cntrl reg masks */
-#define TSL2583_CNTL_ADC_ENBL  0x02
+#define TSL2583_CNTL_ADC_ENBL  0x02
 #define TSL2583_CNTL_PWR_OFF   0x00
 #define TSL2583_CNTL_PWR_ON0x01
 
 /* tsl2583 status reg masks */
-#define TSL2583_STA_ADC_VALID  0x01
-#define TSL2583_STA_ADC_INTR   0x10
+#define TSL2583_STA_ADC_VALID  0x01
+#define TSL2583_STA_ADC_INTR   0x10
 
 /* Lux calculation constants */
-#defineTSL2583_LUX_CALC_OVER_FLOW  65535
+#defineTSL2583_LUX_CALC_OVER_FLOW  65535
 
 #define TSL2583_INTERRUPT_DISABLED 0x00
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 07/26] staging: iio: tsl2583: cleaned up logging

2016-11-12 Thread Brian Masney
There are several places in the code where the function name is
hardcoded in the log message. Use the __func__ constant string to build
the log message. This also clarifies some of the error messages to match
the code and ensures that the correct priority is used since the message
is already being changed.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 73 ++---
 1 file changed, 43 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 57279f7..5d74e0c1 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -170,13 +170,15 @@ static int taos_get_lux(struct iio_dev *indio_dev)
 
ret = i2c_smbus_read_byte_data(chip->client, TSL258X_CMD_REG);
if (ret < 0) {
-   dev_err(&chip->client->dev, "taos_get_lux failed to read 
CMD_REG\n");
+   dev_err(&chip->client->dev, "%s: failed to read CMD_REG 
register\n",
+   __func__);
goto done;
}
 
/* is data new & valid */
if (!(ret & TSL258X_STA_ADC_INTR)) {
-   dev_err(&chip->client->dev, "taos_get_lux data not valid\n");
+   dev_err(&chip->client->dev, "%s: data not valid; returning last 
value\n",
+   __func__);
ret = chip->als_cur_info.lux; /* return LAST VALUE */
goto done;
}
@@ -186,9 +188,8 @@ static int taos_get_lux(struct iio_dev *indio_dev)
 
ret = i2c_smbus_read_byte_data(chip->client, reg);
if (ret < 0) {
-   dev_err(&chip->client->dev,
-   "taos_get_lux failed to read register %x\n",
-   reg);
+   dev_err(&chip->client->dev, "%s: failed to read 
register %x\n",
+   __func__, reg);
goto done;
}
buf[i] = ret;
@@ -203,9 +204,8 @@ static int taos_get_lux(struct iio_dev *indio_dev)
TSL258X_CMD_ALS_INT_CLR));
 
if (ret < 0) {
-   dev_err(&chip->client->dev,
-   "taos_i2c_write_command failed in taos_get_lux, err = 
%d\n",
-   ret);
+   dev_err(&chip->client->dev, "%s: failed to clear the interrupt 
bit\n",
+   __func__);
goto done; /* have no data, so return failure */
}
 
@@ -246,7 +246,8 @@ static int taos_get_lux(struct iio_dev *indio_dev)
 
/* note: lux is 31 bit max at this point */
if (ch1lux > ch0lux) {
-   dev_dbg(&chip->client->dev, "No Data - Return last value\n");
+   dev_dbg(&chip->client->dev, "%s: No Data - Returning 0\n",
+   __func__);
ret = 0;
chip->als_cur_info.lux = 0;
goto done;
@@ -301,7 +302,7 @@ static int taos_als_calibrate(struct iio_dev *indio_dev)
   TSL258X_CMD_REG | TSL258X_CNTRL);
if (ret < 0) {
dev_err(&chip->client->dev,
-   "%s failed to read from the CNTRL register\n",
+   "%s: failed to read from the CNTRL register\n",
__func__);
return ret;
}
@@ -309,16 +310,19 @@ static int taos_als_calibrate(struct iio_dev *indio_dev)
if ((ret & (TSL258X_CNTL_ADC_ENBL | TSL258X_CNTL_PWR_ON))
!= (TSL258X_CNTL_ADC_ENBL | TSL258X_CNTL_PWR_ON)) {
dev_err(&chip->client->dev,
-   "taos_als_calibrate failed: device not powered on with 
ADC enabled\n");
+   "%s: Device is not powered on and/or ADC is not 
enabled\n",
+   __func__);
return -EINVAL;
} else if ((ret & TSL258X_STA_ADC_VALID) != TSL258X_STA_ADC_VALID) {
dev_err(&chip->client->dev,
-   "taos_als_calibrate failed: STATUS - ADC not valid.\n");
+   "%s: The two ADC channels have not completed an 
integration cycle\n",
+   __func__);
return -ENODATA;
}
lux_val = taos_get_lux(indio_dev);
if (lux_val < 0) {
-   dev_err(&chip->client->dev, "taos_als_calibrate failed to get 
lux\n");
+   dev_err(&chip->client->dev, "%s: failed to get lux\n",
+   __func__);
return lux_val;
}
gain_trim_val = (unsigned int)(((chip->taos_settings.als_cal_target)
@@ -326,8 +330,8 @@ static int taos_als_calibrate(struct iio_dev *indio_dev)
 
if ((gain_trim_val < 250) || (gain_trim_val > 4000)) {
dev_err(&chip->client->dev,
-   "taos_als_calibrate failed: trim_val of %d is out of 
range\n",
-   

[PATCH v4 18/26] staging: iio: tsl2583: don't assume an unsigned int is 32 bits

2016-11-12 Thread Brian Masney
in_illuminance_lux_table_store assumes that an unsigned int is 32 bits.
Replace this with sizeof(value[1]).

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index fe9d777..78967dc 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -582,7 +582,7 @@ static ssize_t in_illuminance_lux_table_store(struct device 
*dev,
 
/* Zero out the table */
memset(tsl2583_device_lux, 0, sizeof(tsl2583_device_lux));
-   memcpy(tsl2583_device_lux, &value[1], value[0] * 4);
+   memcpy(tsl2583_device_lux, &value[1], value[0] * sizeof(value[1]));
 
ret = len;
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 10/26] staging: iio: tsl2583: fix comparison between signed and unsigned integers

2016-11-12 Thread Brian Masney
Fixed warning found by make W=2:

warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index d482a84..be3cbae 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -510,7 +510,7 @@ static ssize_t in_illuminance_lux_table_show(struct device 
*dev,
 struct device_attribute *attr,
 char *buf)
 {
-   int i;
+   unsigned int i;
int offset = 0;
 
for (i = 0; i < ARRAY_SIZE(tsl2583_device_lux); i++) {
@@ -541,7 +541,8 @@ static ssize_t in_illuminance_lux_table_store(struct device 
*dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct tsl2583_chip *chip = iio_priv(indio_dev);
int value[ARRAY_SIZE(tsl2583_device_lux) * 3 + 1];
-   int n, ret = -EINVAL;
+   int ret = -EINVAL;
+   unsigned int n;
 
mutex_lock(&chip->als_mutex);
 
@@ -719,7 +720,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
break;
case IIO_CHAN_INFO_CALIBSCALE:
if (chan->type == IIO_LIGHT) {
-   int i;
+   unsigned int i;
 
for (i = 0; i < ARRAY_SIZE(gainadj); i++) {
if (gainadj[i].mean == val) {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 20/26] staging: iio: tsl2583: add tsl2583 to list of supported devices in the header

2016-11-12 Thread Brian Masney
The header only listed the tsl2580 and tsl2581 devices as supported by
this driver. This patch adds the tsl2583 since it is also supported by
this driver.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 3818ffa..806cb0a 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -1,6 +1,6 @@
 /*
  * Device driver for monitoring ambient light intensity (lux)
- * within the TAOS tsl258x family of devices (tsl2580, tsl2581).
+ * within the TAOS tsl258x family of devices (tsl2580, tsl2581, tsl2583).
  *
  * Copyright (c) 2011, TAOS Corporation.
  *
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 14/26] staging: iio: tsl2583: updated code comment to match what the code does

2016-11-12 Thread Brian Masney
If channel 0 does not have any data, then the code sets the lux to zero.
The corresponding comment says that the last value is returned. This
updates the comment to correctly reflect what the code does. It also
clarifies the comment about why 0 is returned.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 52a39a6..dbb7f6a 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -221,7 +221,11 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
goto return_max;
 
if (!ch0) {
-   /* have no data, so return LAST VALUE */
+   /*
+* The sensor appears to be in total darkness so set the
+* calculated lux to 0 and return early to avoid a division by
+* zero below when calculating the ratio.
+*/
ret = 0;
chip->als_cur_info.lux = 0;
goto done;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 17/26] staging: iio: tsl2583: remove unnecessary parentheses

2016-11-12 Thread Brian Masney
in_illuminance_lux_table_store() contains some unnecessary parentheses.
This patch removes them since they provide no value.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index fc58074..fe9d777 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -574,7 +574,7 @@ static ssize_t in_illuminance_lux_table_store(struct device 
*dev,
__func__, TSL2583_MAX_LUX_INTS);
goto done;
}
-   if ((value[(n - 2)] | value[(n - 1)] | value[n]) != 0) {
+   if ((value[n - 2] | value[n - 1] | value[n]) != 0) {
dev_err(dev, "%s: The last 3 entries in the lux table must be 
zeros.\n",
__func__);
goto done;
@@ -582,7 +582,7 @@ static ssize_t in_illuminance_lux_table_store(struct device 
*dev,
 
/* Zero out the table */
memset(tsl2583_device_lux, 0, sizeof(tsl2583_device_lux));
-   memcpy(tsl2583_device_lux, &value[1], (value[0] * 4));
+   memcpy(tsl2583_device_lux, &value[1], value[0] * 4);
 
ret = len;
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 21/26] staging: iio: tsl2583: clarified comment about clearing interrupts

2016-11-12 Thread Brian Masney
The comment that describes the code that clears the interrupt bit was
vague and didn't provide much value. This patch adds more detail about
why that bit needs to be cleared.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 806cb0a..727ed49 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -205,8 +205,9 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
}
 
/*
-* clear status, really interrupt status (interrupts are off), but
-* we use the bit anyway - don't forget 0x80 - this is a command
+* Clear the pending interrupt status bit on the chip to allow the next
+* integration cycle to start. This has to be done even though this
+* driver currently does not support interrupts.
 */
ret = i2c_smbus_write_byte(chip->client,
   (TSL2583_CMD_REG | TSL2583_CMD_SPL_FN |
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 25/26] staging: iio: tsl2583: add copyright and MODULE_AUTHOR

2016-11-12 Thread Brian Masney
Add Brian Masney's copyright to the header and to the MODULE_AUTHOR
for all of the staging cleanups that has been done to this driver.

The original MODULE_AUTHOR() did not have a space between his name and
email address. This patch also adds the missing space.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index b787952..ca26444 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -3,6 +3,7 @@
  * within the TAOS tsl258x family of devices (tsl2580, tsl2581, tsl2583).
  *
  * Copyright (c) 2011, TAOS Corporation.
+ * Copyright (c) 2016 Brian Masney 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -906,6 +907,7 @@ static struct i2c_driver tsl2583_driver = {
 };
 module_i2c_driver(tsl2583_driver);
 
-MODULE_AUTHOR("J. August Brenner");
+MODULE_AUTHOR("J. August Brenner ");
+MODULE_AUTHOR("Brian Masney ");
 MODULE_DESCRIPTION("TAOS tsl2583 ambient light sensor driver");
 MODULE_LICENSE("GPL");
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 23/26] staging: iio: tsl2583: remove unnecessary memset call

2016-11-12 Thread Brian Masney
The entries in the lux table (als_device_lux) can be updated via sysfs
through the function in_illuminance_lux_table_store(). The last row in
the table must be terminated with values that are zero. The sysfs code
already ensures that the last row is all zeros. The call to memset to
clear out the table is not needed so this patch removes the unnecessary
call.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 9db191f..712f753 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -591,9 +591,6 @@ static ssize_t in_illuminance_lux_table_store(struct device 
*dev,
goto done;
}
 
-   /* Zero out the table */
-   memset(chip->als_settings.als_device_lux, 0,
-  sizeof(chip->als_settings.als_device_lux));
memcpy(chip->als_settings.als_device_lux, &value[1],
   value[0] * sizeof(value[1]));
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 22/26] staging: iio: tsl2583: remove comment for tsl2583_probe()

2016-11-12 Thread Brian Masney
The comment for tsl2583_probe() does not provide any useful value.
This patch removes the comment.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 727ed49..9db191f 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -782,10 +782,6 @@ static const struct iio_info tsl2583_info = {
.write_raw = tsl2583_write_raw,
 };
 
-/*
- * Client probe function - When a valid device is found, the driver's device
- * data structure is updated, and initialization completes successfully.
- */
 static int tsl2583_probe(struct i2c_client *clientp,
 const struct i2c_device_id *idp)
 {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 24/26] staging: iio: tsl2583: remove unnecessary variable initialization

2016-11-12 Thread Brian Masney
The ret variable in tsl2583_suspend() and tsl2583_resume() was
initialized to 0. This is not necessary so this patch removes the
initialization.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 712f753..b787952 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -849,7 +849,7 @@ static int __maybe_unused tsl2583_suspend(struct device 
*dev)
 {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
struct tsl2583_chip *chip = iio_priv(indio_dev);
-   int ret = 0;
+   int ret;
 
mutex_lock(&chip->als_mutex);
 
@@ -865,7 +865,7 @@ static int __maybe_unused tsl2583_resume(struct device *dev)
 {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
struct tsl2583_chip *chip = iio_priv(indio_dev);
-   int ret = 0;
+   int ret;
 
mutex_lock(&chip->als_mutex);
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 19/26] staging: iio: tsl2583: move from a global to a per device lux table

2016-11-12 Thread Brian Masney
The driver contains a global lux table that can be updated via sysfs.
Change this to a per device lux table so that multiple devices can be
hooked up to the same system with different lux tables.

There are 10 entries, plus 1 for the termination segment, set aside for
the entries in the lux table. When updating the lux table via sysfs,
only 9 entries, plus the terminator, could be added. This changes
the code to allow for the 10 entries, plus the terminator.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/tsl2583.c | 80 +
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index 78967dc..3818ffa 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -70,11 +70,34 @@ struct tsl2583_als_info {
u16 lux;
 };
 
+struct tsl2583_lux {
+   unsigned int ratio;
+   unsigned int ch0;
+   unsigned int ch1;
+};
+
+static const struct tsl2583_lux tsl2583_default_lux[] = {
+   {  9830,  8520, 15729 },
+   { 12452, 10807, 23344 },
+   { 14746,  6383, 11705 },
+   { 17695,  4063,  6554 },
+   { 0, 0, 0 }  /* Termination segment */
+};
+
+#define TSL2583_MAX_LUX_TABLE_ENTRIES 11
+
 struct tsl2583_settings {
int als_time;
int als_gain;
int als_gain_trim;
int als_cal_target;
+
+   /*
+* This structure is intentionally large to accommodate updates via
+* sysfs. Sized to 11 = max 10 segments + 1 termination segment.
+* Assumption is that one and only one type of glass used.
+*/
+   struct tsl2583_lux als_device_lux[TSL2583_MAX_LUX_TABLE_ENTRIES];
 };
 
 struct tsl2583_chip {
@@ -87,24 +110,6 @@ struct tsl2583_chip {
bool suspended;
 };
 
-struct tsl2583_lux {
-   unsigned int ratio;
-   unsigned int ch0;
-   unsigned int ch1;
-};
-
-/*
- * This structure is intentionally large to accommodate updates via sysfs.
- * Sized to 11 = max 10 segments + 1 termination segment. Assumption is that
- * one and only one type of glass used.
- */
-static struct tsl2583_lux tsl2583_device_lux[11] = {
-   {  9830,  8520, 15729 },
-   { 12452, 10807, 23344 },
-   { 14746,  6383, 11705 },
-   { 17695,  4063,  6554 },
-};
-
 struct gainadj {
s16 ch0;
s16 ch1;
@@ -142,6 +147,10 @@ static void tsl2583_defaults(struct tsl2583_chip *chip)
 
/* Known external ALS reading used for calibration */
chip->als_settings.als_cal_target = 130;
+
+   /* Default lux table. */
+   memcpy(chip->als_settings.als_device_lux, tsl2583_default_lux,
+  sizeof(tsl2583_default_lux));
 }
 
 /*
@@ -151,7 +160,7 @@ static void tsl2583_defaults(struct tsl2583_chip *chip)
  * Time scale factor array values are adjusted based on the integration time.
  * The raw values are multiplied by a scale factor, and device gain is obtained
  * using gain index. Limit checks are done next, then the ratio of a multiple
- * of ch1 value, to the ch0 value, is calculated. The array 
tsl2583_device_lux[]
+ * of ch1 value, to the ch0 value, is calculated. The array als_device_lux[]
  * declared above is then scanned to find the first ratio value that is just
  * above the ratio we just calculated. The ch0 and ch1 multiplier constants in
  * the array are then used along with the time scale factor array values, to
@@ -233,7 +242,7 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
ratio = (ch1 << 15) / ch0;
 
/* convert to unscaled lux using the pointer to the table */
-   for (p = (struct tsl2583_lux *)tsl2583_device_lux;
+   for (p = (struct tsl2583_lux *)chip->als_settings.als_device_lux;
 p->ratio != 0 && p->ratio < ratio; p++)
;
 
@@ -270,7 +279,7 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
 
/*
 * Adjust for active gain scale.
-* The tsl2583_device_lux tables above have a factor of 8192 built in,
+* The tsl2583_default_lux tables above have a factor of 8192 built in,
 * so we need to shift right.
 * User-specified gain provides a multiplier.
 * Apply user-specified gain before shifting right to retain precision.
@@ -522,15 +531,17 @@ static ssize_t in_illuminance_lux_table_show(struct 
device *dev,
 struct device_attribute *attr,
 char *buf)
 {
+   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+   struct tsl2583_chip *chip = iio_priv(indio_dev);
unsigned int i;
int offset = 0;
 
-   for (i = 0; i < ARRAY_SIZE(tsl2583_device_lux); i++) {
+   for (i = 0; i < ARRAY_SIZE(chip->als_settings.als_device_lux); i++) {
offset += sprintf(buf + offset, "%u,%u,%u,",
- tsl2583_device_lux[i].ratio,
- 

[PATCH v4 26/26] staging: iio: tsl2583: move out of staging

2016-11-12 Thread Brian Masney
Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline.

Signed-off-by: Brian Masney 
---
 .../ABI/testing/sysfs-bus-iio-light-tsl2583|  20 +
 drivers/iio/light/Kconfig  |   7 +
 drivers/iio/light/Makefile |   1 +
 drivers/iio/light/tsl2583.c| 913 +
 .../light/sysfs-bus-iio-light-tsl2583  |  20 -
 drivers/staging/iio/light/Kconfig  |   7 -
 drivers/staging/iio/light/Makefile |   1 -
 drivers/staging/iio/light/tsl2583.c| 913 -
 8 files changed, 941 insertions(+), 941 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583
 create mode 100644 drivers/iio/light/tsl2583.c
 delete mode 100644 
drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
 delete mode 100644 drivers/staging/iio/light/tsl2583.c

diff --git a/Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583 
b/Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583
new file mode 100644
index 000..a2e1996
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-iio-light-tsl2583
@@ -0,0 +1,20 @@
+What:  /sys/bus/iio/devices/device[n]/in_illuminance_calibrate
+KernelVersion: 2.6.37
+Contact:   linux-...@vger.kernel.org
+Description:
+   This property causes an internal calibration of the als gain 
trim
+   value which is later used in calculating illuminance in lux.
+
+What:  /sys/bus/iio/devices/device[n]/in_illuminance_lux_table
+KernelVersion: 2.6.37
+Contact:   linux-...@vger.kernel.org
+Description:
+   This property gets/sets the table of coefficients
+   used in calculating illuminance in lux.
+
+What:  /sys/bus/iio/devices/device[n]/in_illuminance_input_target
+KernelVersion: 2.6.37
+Contact:   linux-...@vger.kernel.org
+Description:
+   This property is the known externally illuminance (in lux).
+   It is used in the process of calibrating the device accuracy.
diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
index d011720..298ea50 100644
--- a/drivers/iio/light/Kconfig
+++ b/drivers/iio/light/Kconfig
@@ -338,6 +338,13 @@ config SENSORS_TSL2563
 This driver can also be built as a module.  If so, the module
 will be called tsl2563.
 
+config TSL2583
+   tristate "TAOS TSL2580, TSL2581 and TSL2583 light-to-digital converters"
+   depends on I2C
+   help
+Provides support for the TAOS tsl2580, tsl2581 and tsl2583 devices.
+Access ALS data via iio, sysfs.
+
 config TSL4531
tristate "TAOS TSL4531 ambient light sensors"
depends on I2C
diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile
index 15f24c5..4de5200 100644
--- a/drivers/iio/light/Makefile
+++ b/drivers/iio/light/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_SI1145)  += si1145.o
 obj-$(CONFIG_STK3310)  += stk3310.o
 obj-$(CONFIG_TCS3414)  += tcs3414.o
 obj-$(CONFIG_TCS3472)  += tcs3472.o
+obj-$(CONFIG_TSL2583)  += tsl2583.o
 obj-$(CONFIG_TSL4531)  += tsl4531.o
 obj-$(CONFIG_US5182D)  += us5182d.o
 obj-$(CONFIG_VCNL4000) += vcnl4000.o
diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
new file mode 100644
index 000..ca26444
--- /dev/null
+++ b/drivers/iio/light/tsl2583.c
@@ -0,0 +1,913 @@
+/*
+ * Device driver for monitoring ambient light intensity (lux)
+ * within the TAOS tsl258x family of devices (tsl2580, tsl2581, tsl2583).
+ *
+ * Copyright (c) 2011, TAOS Corporation.
+ * Copyright (c) 2016 Brian Masney 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Device Registers and Masks */
+#define TSL2583_CNTRL  0x00
+#define TSL2583_ALS_TIME   0X01
+#define TSL2583_INTERRUPT  0x02
+#define TSL2583_GAIN   0x07
+#define TSL2583_REVID  0x11
+#define TSL2583_CHIPID 0x12
+#define TSL2583_ALS_CHAN0LO0x14
+#define TSL2583_ALS_CHAN0HI0x15
+#define TSL2583_ALS_CHAN1LO0x16
+#define TSL2583_ALS_CHAN1HI0x17
+#define TSL2583_TMR_LO 0x18
+#define TSL2583_TMR_HI 0x19
+
+/* tsl2583 cmd reg masks */
+#define TSL2583_CMD_REG   

[PATCH] [STYLE 2/2]staging:speakup:varhandlers.c Align match parenthesis

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: Alignment should match open parenthesis

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/varhandlers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/varhandlers.c 
b/drivers/staging/speakup/varhandlers.c
index 5ab7245..ab7000d 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -237,8 +237,8 @@ int spk_set_num_var(int input, struct st_var_header *var, 
int how)
if (!var_data->u.n.out_str)
l = sprintf(cp, var_data->u.n.synth_fmt, (int)val);
else
-   l = sprintf(cp,
-   var_data->u.n.synth_fmt, var_data->u.n.out_str[val]);
+   l = sprintf(cp, var_data->u.n.synth_fmt,
+   var_data->u.n.out_str[val]);
synth_printf("%s", cp);
return 0;
 }
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:MAINTAINERS email revision speakup

2016-11-12 Thread Walt Feasel
Modified email address per the TODO file in
speakup's email listing, also verified email
address from speakup's website

Signed-off-by: Walt Feasel 
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index ec1ee3e..40d272c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11540,7 +11540,7 @@ F:  drivers/staging/slicoss/
 STAGING - SPEAKUP CONSOLE SPEECH DRIVER
 M: William Hubbs 
 M: Chris Brannon 
-M: Kirk Reiser 
+M: Kirk Reiser 
 M: Samuel Thibault 
 L: spea...@linux-speakup.org
 W: http://www.linux-speakup.org/
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [STYLE]staging:MAINTAINERS email revision speakup

2016-11-12 Thread Chris Brannon
Walt Feasel  writes:

> Modified email address per the TODO file in
> speakup's email listing, also verified email
> address from speakup's website

NAK.  The website needs updating, because it has Kirk's old addresses.
k...@reisers.ca is correct.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:speakup:TODO Modify current email

2016-11-12 Thread Walt Feasel
Modified email address to reflect current address

Signed-off-by: Walt Feasel 
---
 drivers/staging/speakup/TODO | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/TODO b/drivers/staging/speakup/TODO
index 3094799..993410c 100644
--- a/drivers/staging/speakup/TODO
+++ b/drivers/staging/speakup/TODO
@@ -42,6 +42,6 @@ We prefer that you contact us on the mailing list; however, 
if you do
 not want to subscribe to a mailing list, send your email to all of the
 following:
 
-w.d.hu...@gmail.com, ch...@the-brannons.com, k...@braille.uwo.ca and
+w.d.hu...@gmail.com, ch...@the-brannons.com, k...@reisers.ca and
 samuel.thiba...@ens-lyon.org.
 
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Revert "[STYLE]staging:MAINTAINERS email revision speakup"

2016-11-12 Thread Walt Feasel
This reverts commit 0970517be9d3d3e3a2fd5aa5a9938318b375f2d0.
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 40d272c..ec1ee3e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11540,7 +11540,7 @@ F:  drivers/staging/slicoss/
 STAGING - SPEAKUP CONSOLE SPEECH DRIVER
 M: William Hubbs 
 M: Chris Brannon 
-M: Kirk Reiser 
+M: Kirk Reiser 
 M: Samuel Thibault 
 L: spea...@linux-speakup.org
 W: http://www.linux-speakup.org/
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:skein:threefish_block.c remove blank lines

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: Please don't use multiple blank lines

Signed-off-by: Walt Feasel 
---
 drivers/staging/skein/threefish_block.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/staging/skein/threefish_block.c 
b/drivers/staging/skein/threefish_block.c
index a95563f..5064065 100644
--- a/drivers/staging/skein/threefish_block.c
+++ b/drivers/staging/skein/threefish_block.c
@@ -64,7 +64,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 
*input,
b2 += b1;
b1 = rol64(b1, 32) ^ b2;
 
-
b1 += k3 + t2;
b0 += b1 + k2;
b1 = rol64(b1, 14) ^ b0;
@@ -117,7 +116,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 += b1;
b1 = rol64(b1, 32) ^ b2;
 
-
b1 += k0 + t1;
b0 += b1 + k4;
b1 = rol64(b1, 14) ^ b0;
@@ -170,7 +168,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 += b1;
b1 = rol64(b1, 32) ^ b2;
 
-
b1 += k2 + t0;
b0 += b1 + k1;
b1 = rol64(b1, 14) ^ b0;
@@ -223,7 +220,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 += b1;
b1 = rol64(b1, 32) ^ b2;
 
-
b1 += k4 + t2;
b0 += b1 + k3;
b1 = rol64(b1, 14) ^ b0;
@@ -276,7 +272,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 += b1;
b1 = rol64(b1, 32) ^ b2;
 
-
b1 += k1 + t1;
b0 += b1 + k0;
b1 = rol64(b1, 14) ^ b0;
@@ -329,7 +324,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 += b1;
b1 = rol64(b1, 32) ^ b2;
 
-
b1 += k3 + t0;
b0 += b1 + k2;
b1 = rol64(b1, 14) ^ b0;
@@ -382,7 +376,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 += b1;
b1 = rol64(b1, 32) ^ b2;
 
-
b1 += k0 + t2;
b0 += b1 + k4;
b1 = rol64(b1, 14) ^ b0;
@@ -435,7 +428,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 += b1;
b1 = rol64(b1, 32) ^ b2;
 
-
b1 += k2 + t1;
b0 += b1 + k1;
b1 = rol64(b1, 14) ^ b0;
@@ -579,7 +571,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 -= b3 + k3 + t2;
b3 -= k4 + 16;
 
-
tmp = b3 ^ b0;
b3 = ror64(tmp, 32);
b0 -= b3;
@@ -648,7 +639,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 -= b3 + k1 + t0;
b3 -= k2 + 14;
 
-
tmp = b3 ^ b0;
b3 = ror64(tmp, 32);
b0 -= b3;
@@ -717,7 +707,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 -= b3 + k4 + t1;
b3 -= k0 + 12;
 
-
tmp = b3 ^ b0;
b3 = ror64(tmp, 32);
b0 -= b3;
@@ -786,7 +775,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 -= b3 + k2 + t2;
b3 -= k3 + 10;
 
-
tmp = b3 ^ b0;
b3 = ror64(tmp, 32);
b0 -= b3;
@@ -855,7 +843,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 -= b3 + k0 + t0;
b3 -= k1 + 8;
 
-
tmp = b3 ^ b0;
b3 = ror64(tmp, 32);
b0 -= b3;
@@ -924,7 +911,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 -= b3 + k3 + t1;
b3 -= k4 + 6;
 
-
tmp = b3 ^ b0;
b3 = ror64(tmp, 32);
b0 -= b3;
@@ -993,7 +979,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 -= b3 + k1 + t2;
b3 -= k2 + 4;
 
-
tmp = b3 ^ b0;
b3 = ror64(tmp, 32);
b0 -= b3;
@@ -1062,7 +1047,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
u64 *input,
b2 -= b3 + k4 + t0;
b3 -= k0 + 2;
 
-
tmp = b3 ^ b0;
b3 = ror64(tmp, 32);
b0 -= b3;
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:dgnc:dgnc_cls.h Spelling correction

2016-11-12 Thread Walt Feasel
Corrected a spelling mistake for control

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_cls.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h
index 2597e36..463ad30 100644
--- a/drivers/staging/dgnc/dgnc_cls.h
+++ b/drivers/staging/dgnc/dgnc_cls.h
@@ -69,7 +69,7 @@ struct cls_uart_struct {
 #define UART_EXAR654_EFR_IXON 0x2 /* Receiver compares Xon1/Xoff1 */
 #define UART_EXAR654_EFR_IXOFF0x8 /* Transmit Xon1/Xoff1 */
 #define UART_EXAR654_EFR_RTSDTR   0x40/* Auto RTS/DTR Flow Control Enable 
*/
-#define UART_EXAR654_EFR_CTSDSR   0x80/* Auto CTS/DSR Flow COntrol Enable 
*/
+#define UART_EXAR654_EFR_CTSDSR   0x80/* Auto CTS/DSR Flow Control Enable 
*/
 #define UART_EXAR654_IER_XOFF 0x20/* Xoff Interrupt Enable */
 #define UART_EXAR654_IER_RTSDTR   0x40/* Output Interrupt Enable */
 #define UART_EXAR654_IER_CTSDSR   0x80/* Input Interrupt Enable */
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:dgnc:dgnc_driver.c Blankline before }

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_driver.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index d3243a3..e28ab04 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -150,7 +150,6 @@ static void cleanup(bool sysfiles)
dgnc_cleanup_tty(dgnc_board[i]);
dgnc_cleanup_board(dgnc_board[i]);
}
-
 }
 
 /*
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:dgnc:dgnc_driver.h Spelling correction

2016-11-12 Thread Walt Feasel
Corrected spelling mistake for statements

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_driver.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 8792026..5770a85 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -34,7 +34,7 @@
  *
  */
 
-/* Driver identification and error statments */
+/* Driver identification and error statements */
 #definePROCSTR "dgnc"  /* /proc entries
 */
 #defineDEVSTR  "/dev/dg/dgnc"  /* /dev entries 
 */
 #defineDRVSTR  "dgnc"  /* Driver name string   
 */
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/2]staging:dgnc:dgnc_driver.h block comment modifications

2016-11-12 Thread Walt Feasel
Modified block comments for style consistency

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_neo.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 5becb37..03fc58e 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -107,7 +107,8 @@ static inline void neo_set_cts_flow_control(struct 
channel_t *ch)
/* Turn off auto Xon flow control */
efr &= ~UART_17158_EFR_IXON;
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -145,7 +146,8 @@ static inline void neo_set_rts_flow_control(struct 
channel_t *ch)
ier &= ~UART_17158_IER_XOFF;
efr &= ~UART_17158_EFR_IXOFF;
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -185,7 +187,8 @@ static inline void neo_set_ixon_flow_control(struct 
channel_t *ch)
/* Turn on auto Xon flow control */
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON);
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -225,7 +228,8 @@ static inline void neo_set_ixoff_flow_control(struct 
channel_t *ch)
ier |= UART_17158_IER_XOFF;
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -268,7 +272,8 @@ static inline void neo_set_no_input_flow_control(struct 
channel_t *ch)
else
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);
 
-   /* Why? Because Exar's spec says we have to zero
+   /*
+* Why? Because Exar's spec says we have to zero
 * it out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -308,7 +313,8 @@ static inline void neo_set_no_output_flow_control(struct 
channel_t *ch)
else
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON);
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -413,7 +419,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
/* Read data from uart -> queue */
neo_copy_data_from_uart_to_queue(ch);
 
-   /* Call our tty layer to enforce queue
+   /*
+* Call our tty layer to enforce queue
 * flow control if needed.
 */
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -438,7 +445,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
 * one it was, so we can suspend or resume data flow.
 */
if (cause == UART_17158_XON_DETECT) {
-   /* Is output stopped right now, if so,
+   /*
+* Is output stopped right now, if so,
 * resume it
 */
if (brd->channels[port]->ch_flags & CH_STOP) {
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/2]staging:dgnc:dgnc_driver.h block comment modifications

2016-11-12 Thread Walt Feasel
Modified block comments for style consistency

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_neo.c | 48 -
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 03fc58e..df180a7 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -617,9 +617,8 @@ static void neo_param(struct tty_struct *tty)
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return;
 
-   /*
-* If baud rate is zero, flush queues, and set mval to drop DTR.
-*/
+   /* If baud rate is zero, flush queues, and set mval to drop DTR. */
+
if ((ch->ch_c_cflag & (CBAUD)) == 0) {
ch->ch_r_head = 0;
ch->ch_r_tail = 0;
@@ -680,7 +679,8 @@ static void neo_param(struct tty_struct *tty)
4800,   9600,   19200,  38400 }
};
 
-   /* Only use the TXPrint baud rate if the terminal unit
+   /*
+* Only use the TXPrint baud rate if the terminal unit
 * is NOT open
 */
if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
@@ -805,7 +805,8 @@ static void neo_param(struct tty_struct *tty)
if (ch->ch_digi.digi_flags & CTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_cts_flow_control(ch);
} else if (ch->ch_c_iflag & IXON) {
-   /* If start/stop is set to disable, then we should
+   /*
+* If start/stop is set to disable, then we should
 * disable flow control
 */
if ((ch->ch_startc == _POSIX_VDISABLE) ||
@@ -820,7 +821,8 @@ static void neo_param(struct tty_struct *tty)
if (ch->ch_digi.digi_flags & RTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_rts_flow_control(ch);
} else if (ch->ch_c_iflag & IXOFF) {
-   /* If start/stop is set to disable, then we should
+   /*
+* If start/stop is set to disable, then we should
 * disable flow control
 */
if ((ch->ch_startc == _POSIX_VDISABLE) ||
@@ -1246,10 +1248,10 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
}
 
-   /*
-* Discard character if we are ignoring the error mask.
-*/
-   if (linestatus & error_mask)  {
+
+   /* Discard character if we are ignoring the error mask. */
+
+if (linestatus & error_mask)  {
unsigned char discard;
 
linestatus = 0;
@@ -1287,9 +1289,8 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
ch->ch_rxcount++;
}
 
-   /*
-* Write new final heads to channel structure.
-*/
+   /* Write new final heads to channel structure. */
+
ch->ch_r_head = head & RQUEUEMASK;
ch->ch_e_head = head & EQUEUEMASK;
 
@@ -1466,9 +1467,9 @@ static void neo_copy_data_from_queue_to_uart(struct 
channel_t *ch)
goto exit_unlock;
}
 
-   /*
-* We have to do it this way, because of the EXAR TXFIFO count bug.
-*/
+
+   /* We have to do it this way, because of the EXAR TXFIFO count bug. */
+
if ((ch->ch_bd->dvid & 0xf0) < UART_XR17E158_DVID) {
if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM)))
goto exit_unlock;
@@ -1653,9 +1654,8 @@ static void neo_send_stop_character(struct channel_t *ch)
}
 }
 
-/*
- * neo_uart_init
- */
+/* neo_uart_init */
+
 static void neo_uart_init(struct channel_t *ch)
 {
writeb(0, &ch->ch_neo_uart->ier);
@@ -1676,9 +1676,8 @@ static void neo_uart_init(struct channel_t *ch)
neo_pci_posting_flush(ch->ch_bd);
 }
 
-/*
- * Make the UART completely turn off.
- */
+/* Make the UART completely turn off. */
+
 static void neo_uart_off(struct channel_t *ch)
 {
/* Turn off UART enhanced bits */
@@ -1713,9 +1712,8 @@ static uint neo_get_uart_bytes_left(struct channel_t *ch)
 /* Channel lock MUST be held by the calling function! */
 static void neo_send_break(struct channel_t *ch, int msecs)
 {
-   /*
-* If we receive a time of 0, this means turn off the break.
-*/
+   /* If we receive a time of 0, this means turn off the break. */
+
if (msecs == 0) {
if (ch->ch_flags & CH_BREAK_SENDING) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/2]staging:dgnc:dgnc_neo.c block comment modifications

2016-11-12 Thread Walt Feasel
Modified block comments for style consistency

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_neo.c | 48 -
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 03fc58e..df180a7 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -617,9 +617,8 @@ static void neo_param(struct tty_struct *tty)
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return;
 
-   /*
-* If baud rate is zero, flush queues, and set mval to drop DTR.
-*/
+   /* If baud rate is zero, flush queues, and set mval to drop DTR. */
+
if ((ch->ch_c_cflag & (CBAUD)) == 0) {
ch->ch_r_head = 0;
ch->ch_r_tail = 0;
@@ -680,7 +679,8 @@ static void neo_param(struct tty_struct *tty)
4800,   9600,   19200,  38400 }
};
 
-   /* Only use the TXPrint baud rate if the terminal unit
+   /*
+* Only use the TXPrint baud rate if the terminal unit
 * is NOT open
 */
if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
@@ -805,7 +805,8 @@ static void neo_param(struct tty_struct *tty)
if (ch->ch_digi.digi_flags & CTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_cts_flow_control(ch);
} else if (ch->ch_c_iflag & IXON) {
-   /* If start/stop is set to disable, then we should
+   /*
+* If start/stop is set to disable, then we should
 * disable flow control
 */
if ((ch->ch_startc == _POSIX_VDISABLE) ||
@@ -820,7 +821,8 @@ static void neo_param(struct tty_struct *tty)
if (ch->ch_digi.digi_flags & RTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_rts_flow_control(ch);
} else if (ch->ch_c_iflag & IXOFF) {
-   /* If start/stop is set to disable, then we should
+   /*
+* If start/stop is set to disable, then we should
 * disable flow control
 */
if ((ch->ch_startc == _POSIX_VDISABLE) ||
@@ -1246,10 +1248,10 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
}
 
-   /*
-* Discard character if we are ignoring the error mask.
-*/
-   if (linestatus & error_mask)  {
+
+   /* Discard character if we are ignoring the error mask. */
+
+if (linestatus & error_mask)  {
unsigned char discard;
 
linestatus = 0;
@@ -1287,9 +1289,8 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
ch->ch_rxcount++;
}
 
-   /*
-* Write new final heads to channel structure.
-*/
+   /* Write new final heads to channel structure. */
+
ch->ch_r_head = head & RQUEUEMASK;
ch->ch_e_head = head & EQUEUEMASK;
 
@@ -1466,9 +1467,9 @@ static void neo_copy_data_from_queue_to_uart(struct 
channel_t *ch)
goto exit_unlock;
}
 
-   /*
-* We have to do it this way, because of the EXAR TXFIFO count bug.
-*/
+
+   /* We have to do it this way, because of the EXAR TXFIFO count bug. */
+
if ((ch->ch_bd->dvid & 0xf0) < UART_XR17E158_DVID) {
if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM)))
goto exit_unlock;
@@ -1653,9 +1654,8 @@ static void neo_send_stop_character(struct channel_t *ch)
}
 }
 
-/*
- * neo_uart_init
- */
+/* neo_uart_init */
+
 static void neo_uart_init(struct channel_t *ch)
 {
writeb(0, &ch->ch_neo_uart->ier);
@@ -1676,9 +1676,8 @@ static void neo_uart_init(struct channel_t *ch)
neo_pci_posting_flush(ch->ch_bd);
 }
 
-/*
- * Make the UART completely turn off.
- */
+/* Make the UART completely turn off. */
+
 static void neo_uart_off(struct channel_t *ch)
 {
/* Turn off UART enhanced bits */
@@ -1713,9 +1712,8 @@ static uint neo_get_uart_bytes_left(struct channel_t *ch)
 /* Channel lock MUST be held by the calling function! */
 static void neo_send_break(struct channel_t *ch, int msecs)
 {
-   /*
-* If we receive a time of 0, this means turn off the break.
-*/
+   /* If we receive a time of 0, this means turn off the break. */
+
if (msecs == 0) {
if (ch->ch_flags & CH_BREAK_SENDING) {
unsigned char temp = readb(&ch->ch_neo_uart->lcr);
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/2]staging:dgnc:dgnc_neo.c block comment modifications

2016-11-12 Thread Walt Feasel
Modified block comments for style consistency

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_neo.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 5becb37..03fc58e 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -107,7 +107,8 @@ static inline void neo_set_cts_flow_control(struct 
channel_t *ch)
/* Turn off auto Xon flow control */
efr &= ~UART_17158_EFR_IXON;
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -145,7 +146,8 @@ static inline void neo_set_rts_flow_control(struct 
channel_t *ch)
ier &= ~UART_17158_IER_XOFF;
efr &= ~UART_17158_EFR_IXOFF;
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -185,7 +187,8 @@ static inline void neo_set_ixon_flow_control(struct 
channel_t *ch)
/* Turn on auto Xon flow control */
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXON);
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -225,7 +228,8 @@ static inline void neo_set_ixoff_flow_control(struct 
channel_t *ch)
ier |= UART_17158_IER_XOFF;
efr |= (UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -268,7 +272,8 @@ static inline void neo_set_no_input_flow_control(struct 
channel_t *ch)
else
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXOFF);
 
-   /* Why? Because Exar's spec says we have to zero
+   /*
+* Why? Because Exar's spec says we have to zero
 * it out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -308,7 +313,8 @@ static inline void neo_set_no_output_flow_control(struct 
channel_t *ch)
else
efr &= ~(UART_17158_EFR_ECB | UART_17158_EFR_IXON);
 
-   /* Why? Because Exar's spec says we have to zero it
+   /*
+* Why? Because Exar's spec says we have to zero it
 * out before setting it
 */
writeb(0, &ch->ch_neo_uart->efr);
@@ -413,7 +419,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
/* Read data from uart -> queue */
neo_copy_data_from_uart_to_queue(ch);
 
-   /* Call our tty layer to enforce queue
+   /*
+* Call our tty layer to enforce queue
 * flow control if needed.
 */
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -438,7 +445,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
 * one it was, so we can suspend or resume data flow.
 */
if (cause == UART_17158_XON_DETECT) {
-   /* Is output stopped right now, if so,
+   /*
+* Is output stopped right now, if so,
 * resume it
 */
if (brd->channels[port]->ch_flags & CH_STOP) {
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/2]staging:dgnc:dgnc_sysfs.c Modify block text

2016-11-12 Thread Walt Feasel
Modified multiline comment for style consistency

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_sysfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 290bf6e..6e8c53b 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -334,7 +334,8 @@ static ssize_t ports_txcount_show(struct device *p,
 }
 static DEVICE_ATTR_RO(ports_txcount);
 
-/* this function creates the sys files that will export each signal status
+/*
+ * this function creates the sys files that will export each signal status
  * to sysfs each value will be put in a separate filename
  */
 void dgnc_create_ports_sysfiles(struct dgnc_board *bd)
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/2]staging:dgnc:dgnc_sysfs.c Delete blank line

2016-11-12 Thread Walt Feasel
Removed unnecessary blankline at end of file

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_sysfs.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 6e8c53b..d41517c 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -701,4 +701,3 @@ void dgnc_remove_tty_sysfs(struct device *c)
 {
sysfs_remove_group(&c->kobj, &dgnc_tty_attribute_group);
 }
-
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [STYLE]staging:skein:threefish_block.c remove blank lines

2016-11-12 Thread Jason Cooper
Hi Walt,

Thanks for the patch, unfortunately, it's a NAK.  If you search the ml
archives, you'll see this has been addressed before.

On Sat, Nov 12, 2016 at 03:02:53PM -0500, Walt Feasel wrote:
> Made suggested modifications from checkpatch in reference
> to CHECK: Please don't use multiple blank lines
> 
> Signed-off-by: Walt Feasel 
> ---
>  drivers/staging/skein/threefish_block.c | 16 
>  1 file changed, 16 deletions(-)
> 
> diff --git a/drivers/staging/skein/threefish_block.c 
> b/drivers/staging/skein/threefish_block.c
> index a95563f..5064065 100644
> --- a/drivers/staging/skein/threefish_block.c
> +++ b/drivers/staging/skein/threefish_block.c
> @@ -64,7 +64,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 += b1;
>   b1 = rol64(b1, 32) ^ b2;
>  
> -

The double lines are deliberate to show a logical separation between the
blocks of code.  Ideally, the second blank line would be a comment
describing the following block.  However, I'm not smart enough yet to
add correct comments.  So, the blank lines remain. :-/

thx,

Jason.

>   b1 += k3 + t2;
>   b0 += b1 + k2;
>   b1 = rol64(b1, 14) ^ b0;
> @@ -117,7 +116,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 += b1;
>   b1 = rol64(b1, 32) ^ b2;
>  
> -
>   b1 += k0 + t1;
>   b0 += b1 + k4;
>   b1 = rol64(b1, 14) ^ b0;
> @@ -170,7 +168,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 += b1;
>   b1 = rol64(b1, 32) ^ b2;
>  
> -
>   b1 += k2 + t0;
>   b0 += b1 + k1;
>   b1 = rol64(b1, 14) ^ b0;
> @@ -223,7 +220,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 += b1;
>   b1 = rol64(b1, 32) ^ b2;
>  
> -
>   b1 += k4 + t2;
>   b0 += b1 + k3;
>   b1 = rol64(b1, 14) ^ b0;
> @@ -276,7 +272,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 += b1;
>   b1 = rol64(b1, 32) ^ b2;
>  
> -
>   b1 += k1 + t1;
>   b0 += b1 + k0;
>   b1 = rol64(b1, 14) ^ b0;
> @@ -329,7 +324,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 += b1;
>   b1 = rol64(b1, 32) ^ b2;
>  
> -
>   b1 += k3 + t0;
>   b0 += b1 + k2;
>   b1 = rol64(b1, 14) ^ b0;
> @@ -382,7 +376,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 += b1;
>   b1 = rol64(b1, 32) ^ b2;
>  
> -
>   b1 += k0 + t2;
>   b0 += b1 + k4;
>   b1 = rol64(b1, 14) ^ b0;
> @@ -435,7 +428,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 += b1;
>   b1 = rol64(b1, 32) ^ b2;
>  
> -
>   b1 += k2 + t1;
>   b0 += b1 + k1;
>   b1 = rol64(b1, 14) ^ b0;
> @@ -579,7 +571,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 -= b3 + k3 + t2;
>   b3 -= k4 + 16;
>  
> -
>   tmp = b3 ^ b0;
>   b3 = ror64(tmp, 32);
>   b0 -= b3;
> @@ -648,7 +639,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 -= b3 + k1 + t0;
>   b3 -= k2 + 14;
>  
> -
>   tmp = b3 ^ b0;
>   b3 = ror64(tmp, 32);
>   b0 -= b3;
> @@ -717,7 +707,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 -= b3 + k4 + t1;
>   b3 -= k0 + 12;
>  
> -
>   tmp = b3 ^ b0;
>   b3 = ror64(tmp, 32);
>   b0 -= b3;
> @@ -786,7 +775,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 -= b3 + k2 + t2;
>   b3 -= k3 + 10;
>  
> -
>   tmp = b3 ^ b0;
>   b3 = ror64(tmp, 32);
>   b0 -= b3;
> @@ -855,7 +843,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 -= b3 + k0 + t0;
>   b3 -= k1 + 8;
>  
> -
>   tmp = b3 ^ b0;
>   b3 = ror64(tmp, 32);
>   b0 -= b3;
> @@ -924,7 +911,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 -= b3 + k3 + t1;
>   b3 -= k4 + 6;
>  
> -
>   tmp = b3 ^ b0;
>   b3 = ror64(tmp, 32);
>   b0 -= b3;
> @@ -993,7 +979,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, 
> u64 *input,
>   b2 -= b3 + k1 + t2;
>   b3 -= k2 + 4;
>  
> -
>   tmp = b3 ^ b0;
>   b3 = ror64(tmp, 32);
>   b0 -= b3;
> @@ -1062,7 +1047,6 @@ void threefish_decrypt_256(struct threefish_key 
> *key_ctx, u64 *input,
>   b2 -= b3 + k4 + t0;
>   b3 -= k0 + 2;
>  
> -
>   tmp = b3 ^ b0;
>   b3 = ror64(tmp, 32);
>   b0 -= b3;
> -- 
> 2.1.4
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 1/4]staging:dgnc:dgnc_tty.c Space preferred around

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to: CHECK: spaces preferred around that '|'

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 8dc7c62..52be33f 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -2580,7 +2580,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,

wake_up_interruptible(&ch->ch_tun.un_flags_wait);
}
 
-   if (ch->ch_pun.un_flags & (UN_LOW|UN_EMPTY)) {
+   if (ch->ch_pun.un_flags & (UN_LOW | UN_EMPTY)) {
ch->ch_pun.un_flags &=
~(UN_LOW | UN_EMPTY);

wake_up_interruptible(&ch->ch_pun.un_flags_wait);
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 2/4]staging:dgnc:dgnc_tty.c Spelling corrections

2016-11-12 Thread Walt Feasel
Made various spelling corrections in the comments

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_tty.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 52be33f..4240609 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -2105,7 +2105,7 @@ static int dgnc_tty_digiseta(struct tty_struct *tty,
spin_lock_irqsave(&ch->ch_lock, flags);
 
/*
-* Handle transistions to and from RTS Toggle.
+* Handle transitions to and from RTS Toggle.
 */
if (!(ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) &&
(new_digi.digi_flags & DIGI_RTS_TOGGLE))
@@ -2115,7 +2115,7 @@ static int dgnc_tty_digiseta(struct tty_struct *tty,
ch->ch_mostat |= (UART_MCR_RTS);
 
/*
-* Handle transistions to and from DTR Toggle.
+* Handle transitions to and from DTR Toggle.
 */
if (!(ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) &&
(new_digi.digi_flags & DIGI_DTR_TOGGLE))
@@ -2439,7 +2439,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
case TCSBRK:
/*
 * TCSBRK is SVID version: non-zero arg --> no break
-* this behaviour is exploited by tcdrain().
+* this behavior is exploited by tcdrain().
 *
 * According to POSIX.1 spec (7.2.2.1.2) breaks should be
 * between 0.25 and 0.5 seconds so we'll ask for something
@@ -2708,7 +2708,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
 * This ioctl allows insertion of a character into the front
 * of any pending data to be transmitted.
 *
-* This ioctl is to satify the "Send Character Immediate"
+* This ioctl is to satisfy the "Send Character Immediate"
 * call that the RealPort protocol spec requires.
 */
case DIGI_REALPORT_SENDIMMEDIATE:
@@ -2728,7 +2728,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
/*
 * This ioctl returns all the current counts for the port.
 *
-* This ioctl is to satify the "Line Error Counters"
+* This ioctl is to satisfy the "Line Error Counters"
 * call that the RealPort protocol spec requires.
 */
case DIGI_REALPORT_GETCOUNTERS:
@@ -2754,7 +2754,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
/*
 * This ioctl returns all current events.
 *
-* This ioctl is to satify the "Event Reporting"
+* This ioctl is to satisfy the "Event Reporting"
 * call that the RealPort protocol spec requires.
 */
case DIGI_REALPORT_GETEVENTS:
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [STYLE 2/4]staging:dgnc:dgnc_tty.c Spelling corrections

2016-11-12 Thread Randy Dunlap
On 11/12/16 15:53, Walt Feasel wrote:
> Made various spelling corrections in the comments

  Make

> 
> Signed-off-by: Walt Feasel 
> ---
>  drivers/staging/dgnc/dgnc_tty.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
> index 52be33f..4240609 100644
> --- a/drivers/staging/dgnc/dgnc_tty.c
> +++ b/drivers/staging/dgnc/dgnc_tty.c
> @@ -2439,7 +2439,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
> unsigned int cmd,
>   case TCSBRK:
>   /*
>* TCSBRK is SVID version: non-zero arg --> no break
> -  * this behaviour is exploited by tcdrain().
> +  * this behavior is exploited by tcdrain().

Nope.  We allow British or American English spelling.

>*
>* According to POSIX.1 spec (7.2.2.1.2) breaks should be
>* between 0.25 and 0.5 seconds so we'll ask for something


-- 
~Randy
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] [STYLE 2/4]staging:dgnc:dgnc_tty.c Spelling corrections

2016-11-12 Thread Walt Feasel
Make spelling corrections for satisfy and
transitions

Signed-off-by: Walt Feasel 
---
v2 resubmitted without behaviour
 drivers/staging/dgnc/dgnc_tty.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 52be33f..d313bc7 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -2105,7 +2105,7 @@ static int dgnc_tty_digiseta(struct tty_struct *tty,
spin_lock_irqsave(&ch->ch_lock, flags);
 
/*
-* Handle transistions to and from RTS Toggle.
+* Handle transitions to and from RTS Toggle.
 */
if (!(ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) &&
(new_digi.digi_flags & DIGI_RTS_TOGGLE))
@@ -2115,7 +2115,7 @@ static int dgnc_tty_digiseta(struct tty_struct *tty,
ch->ch_mostat |= (UART_MCR_RTS);
 
/*
-* Handle transistions to and from DTR Toggle.
+* Handle transitions to and from DTR Toggle.
 */
if (!(ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) &&
(new_digi.digi_flags & DIGI_DTR_TOGGLE))
@@ -2708,7 +2708,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
 * This ioctl allows insertion of a character into the front
 * of any pending data to be transmitted.
 *
-* This ioctl is to satify the "Send Character Immediate"
+* This ioctl is to satisfy the "Send Character Immediate"
 * call that the RealPort protocol spec requires.
 */
case DIGI_REALPORT_SENDIMMEDIATE:
@@ -2728,7 +2728,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
/*
 * This ioctl returns all the current counts for the port.
 *
-* This ioctl is to satify the "Line Error Counters"
+* This ioctl is to satisfy the "Line Error Counters"
 * call that the RealPort protocol spec requires.
 */
case DIGI_REALPORT_GETCOUNTERS:
@@ -2754,7 +2754,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
/*
 * This ioctl returns all current events.
 *
-* This ioctl is to satify the "Event Reporting"
+* This ioctl is to satisfy the "Event Reporting"
 * call that the RealPort protocol spec requires.
 */
case DIGI_REALPORT_GETEVENTS:
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE 3/4]staging:dgnc:dgnc_tty.c Modify block comments

2016-11-12 Thread Walt Feasel
Make block comment format changes to comply with
style guides

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_tty.c | 166 
 1 file changed, 66 insertions(+), 100 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index d313bc7..72f4782 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -42,9 +42,8 @@
 #include "dgnc_sysfs.h"
 #include "dgnc_utils.h"
 
-/*
- * Default transparent print information.
- */
+/* Default transparent print information. */
+
 static const struct digi_t dgnc_digi_init = {
.digi_flags =   DIGI_COOK,  /* Flags*/
.digi_maxcps =  100,/* Max CPS  */
@@ -396,9 +395,8 @@ static void dgnc_wmove(struct channel_t *ch, char *buf, 
uint n)
}
 
if (n > 0) {
-   /*
-* Move rest of data.
-*/
+   /* Move rest of data. */
+
remain = n;
memcpy(ch->ch_wqueue + head, buf, remain);
head += remain;
@@ -468,9 +466,8 @@ void dgnc_input(struct channel_t *ch)
goto exit_unlock;
}
 
-   /*
-* If we are throttled, simply don't read any data.
-*/
+   /* If we are throttled, simply don't read any data. */
+
if (ch->ch_flags & CH_FORCED_STOPI)
goto exit_unlock;
 
@@ -604,9 +601,8 @@ void dgnc_carrier(struct channel_t *ch)
if (ch->ch_c_cflag & CLOCAL)
virt_carrier = 1;
 
-   /*
-* Test for a VIRTUAL carrier transition to HIGH.
-*/
+   /* Test for a VIRTUAL carrier transition to HIGH. */
+
if (((ch->ch_flags & CH_FCAR) == 0) && (virt_carrier == 1)) {
/*
 * When carrier rises, wake any threads waiting
@@ -617,9 +613,8 @@ void dgnc_carrier(struct channel_t *ch)
wake_up_interruptible(&ch->ch_flags_wait);
}
 
-   /*
-* Test for a PHYSICAL carrier transition to HIGH.
-*/
+   /* Test for a PHYSICAL carrier transition to HIGH. */
+
if (((ch->ch_flags & CH_CD) == 0) && (phys_carrier == 1)) {
/*
 * When carrier rises, wake any threads waiting
@@ -663,9 +658,8 @@ void dgnc_carrier(struct channel_t *ch)
tty_hangup(ch->ch_pun.un_tty);
}
 
-   /*
-*  Make sure that our cached values reflect the current reality.
-*/
+   /*  Make sure that our cached values reflect the current reality. */
+
if (virt_carrier == 1)
ch->ch_flags |= CH_FCAR;
else
@@ -677,9 +671,8 @@ void dgnc_carrier(struct channel_t *ch)
ch->ch_flags &= ~CH_CD;
 }
 
-/*
- *  Assign the custom baud rate to the channel structure
- */
+/*  Assign the custom baud rate to the channel structure */
+
 static void dgnc_set_custom_speed(struct channel_t *ch, uint newrate)
 {
int testdiv;
@@ -823,9 +816,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
 
spin_lock_irqsave(&ch->ch_lock, flags);
 
-   /*
-* If channel now has space, wake up anyone waiting on the condition.
-*/
+   /* If channel now has space, wake up anyone waiting on the condition. */
+
qlen = ch->ch_w_head - ch->ch_w_tail;
if (qlen < 0)
qlen += WQUEUESIZE;
@@ -913,10 +905,8 @@ static struct dgnc_board *find_board_by_major(unsigned int 
major)
  *
  /
 
-/*
- * dgnc_tty_open()
- *
- */
+/* dgnc_tty_open() */
+
 static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 {
struct dgnc_board   *brd;
@@ -1016,9 +1006,8 @@ static int dgnc_tty_open(struct tty_struct *tty, struct 
file *file)
/* Store our unit into driver_data, so we always have it available. */
tty->driver_data = un;
 
-   /*
-* Initialize tty's
-*/
+   /* Initialize tty's */
+
if (!(un->un_flags & UN_ISOPEN)) {
/* Store important variables. */
un->un_tty = tty;
@@ -1055,13 +1044,11 @@ static int dgnc_tty_open(struct tty_struct *tty, struct 
file *file)
ch->ch_flags &= ~(CH_OPENING);
wake_up_interruptible(&ch->ch_flags_wait);
 
-   /*
-* Initialize if neither terminal or printer is open.
-*/
+   /* Initialize if neither terminal or printer is open. */
+
if (!((ch->ch_tun.un_flags | ch->ch_pun.un_flags) & UN_ISOPEN)) {
-   /*
-* Flush input queues.
-*/
+   /* Flush input queues. */
+
ch->ch_r_head = 0;
ch->ch_r_tail = 0;
ch->ch_e_head = 0;
@@ -1097,16 +1084,13 @@ static int dgnc_tty_open(struct tty_struct *tty, struct 
file *file)
brd->bd_ops->uart_init(ch);
}

[PATCH] [STYLE 4/4]staging:dgnc:dgnc_tty.c waitqueue_active comment

2016-11-12 Thread Walt Feasel
Made suggested modifications from checkpatch in reference
to WARNING: waitqueue_active without comment

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/dgnc_tty.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 72f4782..9c977cc 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -608,7 +608,6 @@ void dgnc_carrier(struct channel_t *ch)
 * When carrier rises, wake any threads waiting
 * for carrier in the open routine.
 */
-
if (waitqueue_active(&ch->ch_flags_wait))
wake_up_interruptible(&ch->ch_flags_wait);
}
@@ -620,7 +619,6 @@ void dgnc_carrier(struct channel_t *ch)
 * When carrier rises, wake any threads waiting
 * for carrier in the open routine.
 */
-
if (waitqueue_active(&ch->ch_flags_wait))
wake_up_interruptible(&ch->ch_flags_wait);
}
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [STYLE]staging:dgcn:digi.h Spelling correction

2016-11-12 Thread Walt Feasel
Make spelling correction for "regular"

Signed-off-by: Walt Feasel 
---
 drivers/staging/dgnc/digi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index 4e36573..bfd80ca 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -139,7 +139,7 @@ struct digi_getcounter {
 #define DIGI_REALPORT_GETEVENTS (('e' << 8) | 111)
 
 #define EV_OPU 0x0001 /* !http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Gigabit ethernet driver for Alacritechs SLIC devices

2016-11-12 Thread Lino Sanfilippo
Hi,

this is a rework of the slicoss gigabit ethernet driver from Alacritech 
that is currently part of the staging area. The driver is supposed to 
support Mojave, Oasis and Kalahari cards, for both copper and fiber.

If this code is accepted the staging version can be removed (as Greg 
told me by email, he would do this himself so this is not part of these
patches).

The driver is tested on a SEN2104ET card (4 Port PCIe copper).

Regards,
Lino
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[net-next 2/2] MAINTAINERS: add entry for slicoss ethernet driver

2016-11-12 Thread Lino Sanfilippo
Add myself as maintainer for the slicoss ethernet driver.

Signed-off-by: Lino Sanfilippo 
---
 MAINTAINERS | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6781a3f..bb9af28 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -562,6 +562,11 @@ T: git git://linuxtv.org/anttip/media_tree.git
 S: Maintained
 F: drivers/media/usb/airspy/
 
+ALACRITECH GIGABIT ETHERNET DRIVER
+M: Lino Sanfilippo 
+S: Maintained
+F: drivers/net/ethernet/alacritech/*
+
 ALCATEL SPEEDTOUCH USB DRIVER
 M: Duncan Sands 
 L: linux-...@vger.kernel.org
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver

2016-11-12 Thread Lino Sanfilippo
Add driver for Alacritech gigabit ethernet cards with SLIC (session-layer
interface control) technology. The driver provides basic support without
SLIC for the following devices:

- Mojave cards (single port PCI Gigabit) both copper and fiber
- Oasis cards (single and dual port PCI-x Gigabit) copper and fiber
- Kalahari cards (dual and quad port PCI-e Gigabit) copper and fiber

Signed-off-by: Lino Sanfilippo 
---
 drivers/net/ethernet/Kconfig  |1 +
 drivers/net/ethernet/Makefile |1 +
 drivers/net/ethernet/alacritech/Kconfig   |   28 +
 drivers/net/ethernet/alacritech/Makefile  |4 +
 drivers/net/ethernet/alacritech/slic.h|  606 ++
 drivers/net/ethernet/alacritech/slicoss.c | 1855 +
 include/linux/pci_ids.h   |   18 +
 7 files changed, 2513 insertions(+)
 create mode 100644 drivers/net/ethernet/alacritech/Kconfig
 create mode 100644 drivers/net/ethernet/alacritech/Makefile
 create mode 100644 drivers/net/ethernet/alacritech/slic.h
 create mode 100644 drivers/net/ethernet/alacritech/slicoss.c

diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index 2ffd634..a4cc87fe 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -21,6 +21,7 @@ source "drivers/net/ethernet/3com/Kconfig"
 source "drivers/net/ethernet/adaptec/Kconfig"
 source "drivers/net/ethernet/aeroflex/Kconfig"
 source "drivers/net/ethernet/agere/Kconfig"
+source "drivers/net/ethernet/alacritech/Kconfig"
 source "drivers/net/ethernet/allwinner/Kconfig"
 source "drivers/net/ethernet/alteon/Kconfig"
 source "drivers/net/ethernet/altera/Kconfig"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index 1d349e9..b448027 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_NET_VENDOR_8390) += 8390/
 obj-$(CONFIG_NET_VENDOR_ADAPTEC) += adaptec/
 obj-$(CONFIG_GRETH) += aeroflex/
 obj-$(CONFIG_NET_VENDOR_AGERE) += agere/
+obj-$(CONFIG_NET_VENDOR_ALACRITECH) += alacritech/
 obj-$(CONFIG_NET_VENDOR_ALLWINNER) += allwinner/
 obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/
 obj-$(CONFIG_ALTERA_TSE) += altera/
diff --git a/drivers/net/ethernet/alacritech/Kconfig 
b/drivers/net/ethernet/alacritech/Kconfig
new file mode 100644
index 000..41000a3
--- /dev/null
+++ b/drivers/net/ethernet/alacritech/Kconfig
@@ -0,0 +1,28 @@
+config NET_VENDOR_ALACRITECH
+bool "Alacritech devices"
+default y
+---help---
+  If you have a network (Ethernet) card belonging to this class, say Y.
+
+  Note that the answer to this question doesn't directly affect the
+  kernel: saying N will just cause the configurator to skip all
+  the questions about Renesas devices. If you say Y, you will be asked
+  for your specific device in the following questions.
+
+if NET_VENDOR_ALACRITECH
+
+config SLICOSS
+   tristate "Alacritech Slicoss support"
+   depends on PCI
+   select CRC32
+   ---help---
+ This driver supports Gigabit Ethernet adapters based on the
+ Session Layer Interface (SLIC) technology by Alacritech.
+
+ Supported are Mojave (1 port) and Oasis (1, 2 and 4 port) cards,
+ both copper and fiber.
+
+ To compile this driver as a module, choose M here: the module
+ will be called slicoss. This is recommended.
+
+endif # NET_VENDOR_ALACRITECH
diff --git a/drivers/net/ethernet/alacritech/Makefile 
b/drivers/net/ethernet/alacritech/Makefile
new file mode 100644
index 000..8790e9e
--- /dev/null
+++ b/drivers/net/ethernet/alacritech/Makefile
@@ -0,0 +1,4 @@
+#
+# Makefile for the Alacritech Slicoss driver
+#
+obj-$(CONFIG_SLICOSS) += slicoss.o
diff --git a/drivers/net/ethernet/alacritech/slic.h 
b/drivers/net/ethernet/alacritech/slic.h
new file mode 100644
index 000..963a20d
--- /dev/null
+++ b/drivers/net/ethernet/alacritech/slic.h
@@ -0,0 +1,606 @@
+
+#ifndef _SLIC_H
+#define _SLIC_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SLIC_VGBSTAT_XPERR 0x4000
+#define SLIC_VGBSTAT_XERRSHFT  25
+#define SLIC_VGBSTAT_XCSERR0x23
+#define SLIC_VGBSTAT_XUFLOW0x22
+#define SLIC_VGBSTAT_XHLEN 0x20
+#define SLIC_VGBSTAT_NETERR0x0100
+#define SLIC_VGBSTAT_NERRSHFT  16
+#define SLIC_VGBSTAT_NERRMSK   0x1ff
+#define SLIC_VGBSTAT_NCSERR0x103
+#define SLIC_VGBSTAT_NUFLOW0x102
+#define SLIC_VGBSTAT_NHLEN 0x100
+#define SLIC_VGBSTAT_LNKERR0x0080
+#define SLIC_VGBSTAT_LERRMSK   0xff
+#define SLIC_VGBSTAT_LDEARLY   0x86
+#define SLIC_VGBSTAT_LBOFLO0x85
+#define SLIC_VGBSTAT_LCODERR   0x84
+#define SLIC_VGBSTAT_LDBLNBL   0x83
+#define SLIC_VGBSTAT_LCRCERR   0x82
+#define SLIC_VGBSTAT_LOFLO 0x81
+#define SLIC

Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver

2016-11-12 Thread kbuild test robot
Hi Lino,

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Lino-Sanfilippo/net-ethernet-slicoss-add-slicoss-gigabit-ethernet-driver/20161113-125131
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha 

All warnings (new ones prefixed by >>):

   drivers/staging/slicoss/slicoss.c: In function 'slic_cmdq_addcmdpage':
>> drivers/staging/slicoss/slicoss.c:1258:2: warning: 'virt_to_bus' is 
>> deprecated [-Wdeprecated-declarations]
 phys_addr = virt_to_bus((void *)page);
 ^
   In file included from include/linux/io.h:25:0,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/alpha/include/asm/hardirq.h:7,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from drivers/staging/slicoss/slicoss.c:71:
   arch/alpha/include/asm/io.h:114:42: note: declared here
static inline unsigned long __deprecated virt_to_bus(void *address)
 ^~~

vim +/virt_to_bus +1258 drivers/staging/slicoss/slicoss.c

4d6ea9c3 Denis Kirjanov 2010-07-10  1242struct slic_hostcmd *cmd;
4d6ea9c3 Denis Kirjanov 2010-07-10  1243struct slic_hostcmd *prev;
4d6ea9c3 Denis Kirjanov 2010-07-10  1244struct slic_hostcmd *tail;
4d6ea9c3 Denis Kirjanov 2010-07-10  1245struct slic_cmdqueue *cmdq;
4d6ea9c3 Denis Kirjanov 2010-07-10  1246int cmdcnt;
4d6ea9c3 Denis Kirjanov 2010-07-10  1247void *cmdaddr;
4d6ea9c3 Denis Kirjanov 2010-07-10  1248ulong phys_addr;
4d6ea9c3 Denis Kirjanov 2010-07-10  1249u32 phys_addrl;
4d6ea9c3 Denis Kirjanov 2010-07-10  1250u32 phys_addrh;
4d6ea9c3 Denis Kirjanov 2010-07-10  1251struct slic_handle 
*pslic_handle;
eafe6002 David Matlack  2015-05-11  1252unsigned long flags;
4d6f6af8 Greg Kroah-Hartman 2008-03-19  1253  
4d6ea9c3 Denis Kirjanov 2010-07-10  1254cmdaddr = page;
dd146d21 Shraddha Barke 2015-10-15  1255cmd = cmdaddr;
4d6ea9c3 Denis Kirjanov 2010-07-10  1256cmdcnt = 0;
4d6f6af8 Greg Kroah-Hartman 2008-03-19  1257  
4d6ea9c3 Denis Kirjanov 2010-07-10 @1258phys_addr = virt_to_bus((void 
*)page);
4d6ea9c3 Denis Kirjanov 2010-07-10  1259phys_addrl = 
SLIC_GET_ADDR_LOW(phys_addr);
4d6ea9c3 Denis Kirjanov 2010-07-10  1260phys_addrh = 
SLIC_GET_ADDR_HIGH(phys_addr);
4d6f6af8 Greg Kroah-Hartman 2008-03-19  1261  
4d6ea9c3 Denis Kirjanov 2010-07-10  1262prev = NULL;
4d6ea9c3 Denis Kirjanov 2010-07-10  1263tail = cmd;
4d6ea9c3 Denis Kirjanov 2010-07-10  1264while ((cmdcnt < 
SLIC_CMDQ_CMDSINPAGE) &&
4d6ea9c3 Denis Kirjanov 2010-07-10  1265   (adapter->slic_handle_ix 
< 256)) {
4d6ea9c3 Denis Kirjanov 2010-07-10  1266/* Allocate and 
initialize a SLIC_HANDLE for this command */

:: The code at line 1258 was first introduced by commit
:: 4d6ea9c3223da8d8dc91b369087fa40cc53edd36 Staging: slicoss: kill 
functions prototypes and reorder functions

:: TO: Denis Kirjanov 
:: CC: Greg Kroah-Hartman 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel