[PATCH] staging:r8188eu: Remove space before comma

2016-10-22 Thread Alex Briskin
Trivial style fix to remove unnecessary errors in checkpatch.pl

Signed-off-by: Alex Briskin 
---
 drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
index edc6b52..0ce7db7 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
@@ -488,8 +488,8 @@ void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 
*PROMContent, bool Auto
}
if (bIn24G) {
DBG_88E("=== Path %d, Channel %d ===\n", 0, ch);
-   DBG_88E("Index24G_CCK_Base[%d][%d] = 0x%x\n", 0, ch , 
pHalData->Index24G_CCK_Base[0][ch]);
-   DBG_88E("Index24G_BW40_Base[%d][%d] = 0x%x\n", 0, ch , 
pHalData->Index24G_BW40_Base[0][ch]);
+   DBG_88E("Index24G_CCK_Base[%d][%d] = 0x%x\n", 0, ch, 
pHalData->Index24G_CCK_Base[0][ch]);
+   DBG_88E("Index24G_BW40_Base[%d][%d] = 0x%x\n", 0, ch, 
pHalData->Index24G_BW40_Base[0][ch]);
}
}
for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
-- 
2.7.4

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


Re: [PATCH 6/7] iio: light: tsl2583: add locking to sysfs *_store() functions

2016-10-22 Thread Jonathan Cameron
On 19/10/16 12:37, Dan Carpenter wrote:
> I appologize for laughing, but I am still secretly amused in my heart.
> 
> regards,
> dan carpenter
> 
Fewer beers or less caffeine for Dan!

Key take away here is keep things simple.  The gotos in my mind
would actually have made sense, but I wouldn't do the refactoring until
you need it. i.e. when you introduce the locking in this patch.
> --
> 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


[PATCH 1/1] staging: sm750fb: restructure multi-line comments to follow CodingStyle

2016-10-22 Thread Eric S. Stone
Eliminates all checkpatch.pl BLOCK_COMMENT_STYLE warnings in
sm750fb, and coincidentally eliminates some line-length (80)
warnings.

Signed-off-by: Eric S. Stone 
---
 drivers/staging/sm750fb/ddk750.h | 22 ++--
 drivers/staging/sm750fb/ddk750_chip.c| 39 
 drivers/staging/sm750fb/ddk750_chip.h| 61 +++-
 drivers/staging/sm750fb/ddk750_display.h | 30 ++--
 drivers/staging/sm750fb/ddk750_hwi2c.c   |  9 +++--
 drivers/staging/sm750fb/ddk750_mode.c| 25 +++--
 drivers/staging/sm750fb/ddk750_sii164.c  |  3 +-
 drivers/staging/sm750fb/ddk750_swi2c.c   | 27 +++---
 drivers/staging/sm750fb/ddk750_swi2c.h   | 24 ++---
 drivers/staging/sm750fb/sm750.h  |  6 ++--
 drivers/staging/sm750fb/sm750_accel.c| 40 +
 drivers/staging/sm750fb/sm750_hw.c   | 25 -
 12 files changed, 184 insertions(+), 127 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750.h b/drivers/staging/sm750fb/ddk750.h
index 0566911..7340103 100644
--- a/drivers/staging/sm750fb/ddk750.h
+++ b/drivers/staging/sm750fb/ddk750.h
@@ -1,16 +1,16 @@
+/*
+ * Copyright (c) 2007 by Silicon Motion, Inc. (SMI)
+ *
+ *  All rights are reserved. Reproduction or in part is prohibited
+ *  without the written consent of the copyright owner.
+ *
+ *  RegSC.h --- SM718 SDK
+ *  This file contains the definitions for the System Configuration registers.
+ */
+
 #ifndef DDK750_H__
 #define DDK750_H__
-/***
-*
-* Copyright (c) 2007 by Silicon Motion, Inc. (SMI)
-*
-*  All rights are reserved. Reproduction or in part is prohibited
-*  without the written consent of the copyright owner.
-*
-*  RegSC.h --- SM718 SDK
-*  This file contains the definitions for the System Configuration registers.
-*
-***/
+
 #include "ddk750_reg.h"
 #include "ddk750_mode.h"
 #include "ddk750_chip.h"
diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index a127eb2..c8c14ee 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -62,17 +62,18 @@ static void set_chip_clock(unsigned int frequency)
 
if (frequency) {
/*
-   * Set up PLL, a structure to hold the value to be set in clocks.
-   */
+* Set up PLL structure to hold the value to be set in clocks.
+*/
pll.inputFreq = DEFAULT_INPUT_CLOCK; /* Defined in CLOCK.H */
pll.clockType = MXCLK_PLL;
 
/*
-   * Call calc_pll_value() to fill the other fields of PLL 
structure.
-   * Sometime, the chip cannot set up the exact clock
-   * required by the User.
-   * Return value of calc_pll_value gives the actual possible 
clock.
-   */
+* Call calc_pll_value() to fill the other fields of the PLL
+* structure. Sometimes, the chip cannot set up the exact
+* clock required by the User.
+* Return value of calc_pll_value gives the actual possible
+* clock.
+*/
ulActualMxClk = calc_pll_value(frequency, &pll);
 
/* Master Clock Control: MXCLK_PLL */
@@ -84,7 +85,8 @@ static void set_memory_clock(unsigned int frequency)
 {
unsigned int reg, divisor;
 
-   /* Cheok_0509: For SM750LE, the memory clock is fixed.
+   /*
+* Cheok_0509: For SM750LE, the memory clock is fixed.
 * Nothing to set.
 */
if (sm750_get_chip_type() == SM750LE)
@@ -135,14 +137,16 @@ static void set_master_clock(unsigned int frequency)
 {
unsigned int reg, divisor;
 
-   /* Cheok_0509: For SM750LE, the memory clock is fixed.
+   /*
+* Cheok_0509: For SM750LE, the memory clock is fixed.
 * Nothing to set.
 */
if (sm750_get_chip_type() == SM750LE)
return;
 
if (frequency) {
-   /* Set the frequency to the maximum frequency
+   /*
+* Set the frequency to the maximum frequency
 * that the SM750 engine can run, which is about 190 MHz.
 */
if (frequency > MHz(190))
@@ -241,7 +245,8 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
set_master_clock(MHz(pInitParam->masterClock));
 
 
-   /* Reset the memory controller.
+   /*
+* Reset the memory controller.
 * If the memory controller is not reset in SM750,
 * the system might hang when sw accesses the memory.
 * The memory should be resetted after changing the MXCLK.
@@ -306,7 +311,8 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
  */
 unsigned int calc_pll_value(unsigned int request_orig, struct 

Re: [PATCH 7/7] iio: light: tsl2583: fix concurrency issue in taos_get_lux()

2016-10-22 Thread Jonathan Cameron
On 19/10/16 11:32, Brian Masney wrote:
> taos_get_lux() calls mutex_trylock(). If the lock could not be acquired,
> then chip->als_cur_info.lux is returned. The issue is that this value
> is updated while the mutex is held and could cause a half written value
> to be returned to the caller. This patch changes the call to
> mutex_trylock() with mutex_lock().
> 
> Signed-off-by: Brian Masney 
I'd go with the simple approach you have here.

If someone cares enough they can figure out the complex solution.  Probably
should be pushed off to userspace.  It's not unusual for devices to take
'a little while' to respond to sysfs reads.

Jonathan
> ---
> This is the most controversial change in my patch set. There are two
> other possible solutions that I could envision to work around this
> issue:
> 
> 1) Return -EBUSY and make the caller responsible for backing off
> 2) Change this driver to use RCU instead of a mutex
> 
>  drivers/staging/iio/light/tsl2583.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index 47656ae..c4d2e3a 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -206,10 +206,7 @@ static int taos_get_lux(struct iio_dev *indio_dev)
>   u32 ch0lux = 0;
>   u32 ch1lux = 0;
>  
> - if (mutex_trylock(&chip->als_mutex) == 0) {
> - dev_info(&chip->client->dev, "taos_get_lux device is busy\n");
> - return chip->als_cur_info.lux; /* busy, so return LAST VALUE */
> - }
> + mutex_lock(&chip->als_mutex);
>  
>   if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
>   /* device is not enabled */
> 

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


Re: [PATCH 3/7] iio: light: tsl2583: use DEVICE_ATTR_{RO, RW, WO} macros

2016-10-22 Thread Jonathan Cameron
On 19/10/16 14:11, Dan Carpenter wrote:
> On Wed, Oct 19, 2016 at 09:08:30AM -0400, Brian Masney wrote:
>> On Wed, Oct 19, 2016 at 02:26:27PM +0300, Dan Carpenter wrote:
>>> What does illuminance0_ mean?  Can we remove that?
>>
>> I left the names of the existing sysfs attributes intact to not break
>> any existing users of the driver. I'm not sure why the original author
>> named it that way.
> 
> Ah...  Then I defer to your judgement.
Will normally be constructed as this via the info_mask stuff.
Needed to ensure it's obvious which channel we are referring to in
multichannel devices.  Convention usually means we use this when
something is very channel specific even if it's the only channel.
(feels odd otherwise ;)

Looks ugly here because of the rather contrived nature of the
macros.  I'm not keen on that side of them, but then we should
hardly ever need to use them anyway so I'm not that bothered!

Jonathan
> 
> regards,
> dan carpenter
> 
> --
> 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 1/7] iio: light: tsl2583: return proper error code

2016-10-22 Thread Jonathan Cameron
On 19/10/16 11:32, Brian Masney wrote:
> taos_gain_store() and taos_als_calibrate() both have a code path where
> -1 was returned. This patch changes the code so that a proper error code
> is returned to make the code consistent with the error paths that are
> present within those same functions.
> 
> 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 08f1583..1e42a19 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -359,7 +359,7 @@ static int taos_als_calibrate(struct iio_dev *indio_dev)
>   != (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");
> - return -1;
> + return -ENODATA;
Hmm. Not sure about this as the error value.  Perhaps a simple -EINVAL?

Also, this is still eating the possible error returned directly by
i2c_smbus_read_byte - would you mind fixing that whilst we are here?
>   }
>  
>   ret = i2c_smbus_write_byte(chip->client,
> @@ -569,7 +569,7 @@ static ssize_t taos_gain_store(struct device *dev,
>   break;
>   default:
>   dev_err(dev, "Invalid Gain Index (must be 1,8,16,111)\n");
> - return -1;
> + return -EINVAL;
>   }
>  
>   return len;
> 

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