[PATCH 1/4] rts5208: Fix usleep_range is preferred over udelay

2019-06-19 Thread Lukas Schneider
This patch fixes the issue reported by checkpatch:

CHECK: usleep_range is preferred over udelay;
see Documentation/timers/timers-howto.txt

It's save to sleep here instead of using busy waiting,
because we are not in an atomic context.

Signed-off-by: Lukas Schneider 
Signed-off-by: Jannik Moritz 
Cc: 
---
 drivers/staging/rts5208/ms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 1128eec3bd08..264887d8b3e6 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -3237,7 +3237,7 @@ static int ms_write_multiple_pages(struct rtsx_chip 
*chip, u16 old_blk,
return STATUS_FAIL;
}
 
-   udelay(30);
+   usleep_range(30, 40);
 
rtsx_init_cmd(chip);
 
@@ -4159,7 +4159,7 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip 
*chip)
 
 #ifdef MG_SET_ICV_SLOW
for (i = 0; i < 2; i++) {
-   udelay(50);
+   usleep_range(50, 60);
 
rtsx_init_cmd(chip);
 
-- 
2.19.1

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


[PATCH 3/4] rts5208: Fix usleep_range is preferred over udelay

2019-06-19 Thread Lukas Schneider
This patch fixes the issue reported by checkpatch:

CHECK: usleep_range is preferred over udelay;
see Documentation/timers/timers-howto.txt

It's save to sleep here instead of using busy waiting,
because we are not in an atomic context.

Signed-off-by: Lukas Schneider 
Signed-off-by: Jannik Moritz 
Cc: 
---
 drivers/staging/rts5208/rtsx_chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c 
b/drivers/staging/rts5208/rtsx_chip.c
index 76c35f3c0208..8cddfe542d56 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -1803,7 +1803,7 @@ void rtsx_exit_ss(struct rtsx_chip *chip)
 
if (chip->power_down_in_ss) {
rtsx_force_power_on(chip, SSC_PDCTL | OC_PDCTL);
-   udelay(1000);
+   usleep_range(1000, 1010);
}
 
if (RTSX_TST_DELINK(chip)) {
-- 
2.19.1

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


[PATCH 4/4] rts5208: Fix usleep range is preferred over udelay

2019-06-19 Thread Lukas Schneider
This patch fixes the issue reported by checkpatch:

CHECK: usleep_range is preferred over udelay;
see Doucmentation/timers/timers-howto.txt

It's save to sleep here instead of using busy waiting,
because we are not in an atomic context.

Signed-off-by: Lukas Schneider 
Signed-off-by: Jannik Moritz 
Cc: 
---
 drivers/staging/rts5208/sd.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index c256a2398651..23a3499096ce 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -865,7 +865,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 
sample_point, u8 tune_dir)
 PHASE_CHANGE);
if (retval)
return retval;
-   udelay(50);
+   usleep_range(50, 60);
retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF,
 PHASE_CHANGE |
 PHASE_NOT_RESET |
@@ -877,14 +877,14 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 
sample_point, u8 tune_dir)
 CHANGE_CLK, CHANGE_CLK);
if (retval)
return retval;
-   udelay(50);
+   usleep_range(50, 60);
retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF,
 PHASE_NOT_RESET |
 sample_point);
if (retval)
return retval;
}
-   udelay(100);
+   usleep_range(100, 110);
 
rtsx_init_cmd(chip);
rtsx_add_cmd(chip, WRITE_REG_CMD, SD_DCMPS_CTL, DCMPS_CHANGE,
@@ -918,7 +918,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 
sample_point, u8 tune_dir)
return retval;
}
 
-   udelay(50);
+   usleep_range(50, 60);
}
 
retval = rtsx_write_register(chip, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0);
@@ -1416,7 +1416,7 @@ static int sd_wait_data_idle(struct rtsx_chip *chip)
retval = STATUS_SUCCESS;
break;
}
-   udelay(100);
+   usleep_range(100, 110);
}
dev_dbg(rtsx_dev(chip), "SD_DATA_STATE: 0x%02x\n", val);
 
-- 
2.19.1

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


[PATCH 2/4] rts5208: Fix usleep_range is preferred over udelay

2019-06-19 Thread Lukas Schneider
This patch fixes the issue reported by checkpatch:

CHECK: usleep_range is preferred over udelay;
see Documentation/timers/timers-howto.txt

It's save to sleep here instead of using busy waiting,
because we are not in an atomic context.

Signed-off-by: Lukas Schneider 
Signed-off-by: Jannik Moritz 
Cc 
---
 drivers/staging/rts5208/rtsx_card.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_card.c 
b/drivers/staging/rts5208/rtsx_card.c
index 294f381518fa..960e845133c3 100644
--- a/drivers/staging/rts5208/rtsx_card.c
+++ b/drivers/staging/rts5208/rtsx_card.c
@@ -679,7 +679,7 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
if (retval < 0)
return STATUS_ERROR;
 
-   udelay(10);
+   usleep_range(10, 20);
retval = rtsx_write_register(chip, CLK_CTL, CLK_LOW_FREQ, 0);
if (retval)
return retval;
@@ -797,7 +797,7 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
return retval;
 
if (sd_vpclk_phase_reset) {
-   udelay(200);
+   usleep_range(200, 210);
retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
 PHASE_NOT_RESET, PHASE_NOT_RESET);
if (retval)
@@ -806,7 +806,7 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
 PHASE_NOT_RESET, PHASE_NOT_RESET);
if (retval)
return retval;
-   udelay(200);
+   usleep_range(200, 210);
}
retval = rtsx_write_register(chip, CLK_CTL, 0xFF, 0);
if (retval)
-- 
2.19.1

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


Re: [PATCH 4/4] rts5208: Fix usleep range is preferred over udelay

2019-06-21 Thread Lukas Schneider



Am 21.06.2019 um 13:04 schrieb Pavel Machek:

On Wed 2019-06-19 17:46:48, Lukas Schneider wrote:

This patch fixes the issue reported by checkpatch:

CHECK: usleep_range is preferred over udelay;
see Doucmentation/timers/timers-howto.txt

It's save to sleep here instead of using busy waiting,
because we are not in an atomic context.

Is it good idea? How can the system really sleep for 50 usec?

 Pavel


According to Doucmentation/timers/timers-howto.txt, usleep_range should 
be used for sleep times between 10us and 20ms, so it is the correct 
function for 50us.


Lukas


@@ -865,7 +865,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 
sample_point, u8 tune_dir)
 PHASE_CHANGE);
if (retval)
return retval;
-   udelay(50);
+   usleep_range(50, 60);
retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF,
 PHASE_CHANGE |
 PHASE_NOT_RESET |
@@ -877,14 +877,14 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 
sample_point, u8 tune_dir)
 CHANGE_CLK, CHANGE_CLK);
if (retval)
return retval;
-   udelay(50);
+   usleep_range(50, 60);
retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF,
 PHASE_NOT_RESET |
 sample_point);
if (retval)
return retval;
}
-   udelay(100);
+   usleep_range(100, 110);
  
  		rtsx_init_cmd(chip);

rtsx_add_cmd(chip, WRITE_REG_CMD, SD_DCMPS_CTL, DCMPS_CHANGE,
@@ -918,7 +918,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 
sample_point, u8 tune_dir)
return retval;
}
  
-		udelay(50);

+   usleep_range(50, 60);
}
  
  	retval = rtsx_write_register(chip, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0);

@@ -1416,7 +1416,7 @@ static int sd_wait_data_idle(struct rtsx_chip *chip)
retval = STATUS_SUCCESS;
break;
}
-   udelay(100);
+   usleep_range(100, 110);
}
dev_dbg(rtsx_dev(chip), "SD_DATA_STATE: 0x%02x\n", val);
  

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


[PATCH] fbtft: Cleanup line over 80 character warnings

2019-06-27 Thread Lukas Schneider
Cleanup the line over 80 character warnings, reported by checkpatch

Signed-off-by: Lukas Schneider 
Signed-off-by: Jannik Moritz 
Cc: 
---
 drivers/staging/fbtft/fbtft-sysfs.c |  3 ++-
 drivers/staging/fbtft/fbtft.h   | 26 ++
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-sysfs.c 
b/drivers/staging/fbtft/fbtft-sysfs.c
index 2a5c630dab87..78d2b81ea2e7 100644
--- a/drivers/staging/fbtft/fbtft-sysfs.c
+++ b/drivers/staging/fbtft/fbtft-sysfs.c
@@ -68,7 +68,8 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves,
ret = get_next_ulong(&curve_p, &val, " ", 16);
if (ret)
goto out;
-   curves[curve_counter * par->gamma.num_values + 
value_counter] = val;
+   curves[curve_counter * par->gamma.num_values
+   + value_counter] = val;
value_counter++;
}
if (value_counter != par->gamma.num_values) {
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 9b6bdb62093d..cddbfd4ffa10 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -348,9 +348,25 @@ module_exit(fbtft_driver_module_exit);
 
 /* shorthand debug levels */
 #define DEBUG_LEVEL_1  DEBUG_REQUEST_GPIOS
-#define DEBUG_LEVEL_2  (DEBUG_LEVEL_1 | DEBUG_DRIVER_INIT_FUNCTIONS | 
DEBUG_TIME_FIRST_UPDATE)
-#define DEBUG_LEVEL_3  (DEBUG_LEVEL_2 | DEBUG_RESET | DEBUG_INIT_DISPLAY | 
DEBUG_BLANK | DEBUG_REQUEST_GPIOS | DEBUG_FREE_GPIOS | DEBUG_VERIFY_GPIOS | 
DEBUG_BACKLIGHT | DEBUG_SYSFS)
-#define DEBUG_LEVEL_4  (DEBUG_LEVEL_2 | DEBUG_FB_READ | DEBUG_FB_WRITE | 
DEBUG_FB_FILLRECT | DEBUG_FB_COPYAREA | DEBUG_FB_IMAGEBLIT | DEBUG_FB_BLANK)
+#define DEBUG_LEVEL_2  (DEBUG_LEVEL_1 |\
+DEBUG_DRIVER_INIT_FUNCTIONS |  \
+DEBUG_TIME_FIRST_UPDATE)
+#define DEBUG_LEVEL_3  (DEBUG_LEVEL_2 |\
+DEBUG_RESET |  \
+DEBUG_INIT_DISPLAY |   \
+DEBUG_BLANK |  \
+DEBUG_REQUEST_GPIOS |  \
+DEBUG_FREE_GPIOS | \
+DEBUG_VERIFY_GPIOS |   \
+DEBUG_BACKLIGHT |  \
+DEBUG_SYSFS)
+#define DEBUG_LEVEL_4  (DEBUG_LEVEL_2 |\
+DEBUG_FB_READ |\
+DEBUG_FB_WRITE |   \
+DEBUG_FB_FILLRECT |\
+DEBUG_FB_COPYAREA |\
+DEBUG_FB_IMAGEBLIT |   \
+DEBUG_FB_BLANK)
 #define DEBUG_LEVEL_5  (DEBUG_LEVEL_3 | DEBUG_UPDATE_DISPLAY)
 #define DEBUG_LEVEL_6  (DEBUG_LEVEL_4 | DEBUG_LEVEL_5)
 #define DEBUG_LEVEL_7  0x
@@ -392,7 +408,9 @@ module_exit(fbtft_driver_module_exit);
 #define fbtft_init_dbg(dev, format, arg...)  \
 do { \
if (unlikely((dev)->platform_data && \
-   (((struct fbtft_platform_data 
*)(dev)->platform_data)->display.debug & DEBUG_DRIVER_INIT_FUNCTIONS))) \
+   (((struct fbtft_platform_data *) \
+   (dev)->platform_data)->display.debug \
+   & DEBUG_DRIVER_INIT_FUNCTIONS))) \
dev_info(dev, format, ##arg);\
 } while (0)
 
-- 
2.19.1

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


[PATCH] media: bcm2048: Macros with complex values should be enclosed in parentheses

2019-06-27 Thread Lukas Schneider
Fix ERROR: Macros with complex values should be enclosed in parentheses,
reported by checkpatch.

Add a do {...} while (0) loop around the macro.

Signed-off-by: Lukas Schneider 
Signed-off-by: Jannik Moritz 
Cc: 
---
 drivers/staging/media/bcm2048/radio-bcm2048.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c 
b/drivers/staging/media/bcm2048/radio-bcm2048.c
index 2c60a1fb6350..206f2a662f92 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -2001,8 +2001,10 @@ static ssize_t bcm2048_##prop##_read(struct device *dev, 
\
 }
 
 #define DEFINE_SYSFS_PROPERTY(prop, prop_type, mask, check)\
-property_write(prop, prop_type, mask, check)   \
-property_read(prop, mask)  \
+do {   \
+   property_write(prop, prop_type, mask, check)\
+   property_read(prop, mask)   \
+} while (0)\
 
 #define property_str_read(prop, size)  \
 static ssize_t bcm2048_##prop##_read(struct device *dev,   \
-- 
2.22.0

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