According to Documentation/timers/timers-howto.rst, usleep_range is preffered over udelay for >=10us delay.
Signed-off-by: Mayank Suman mayanksuman@live.com --- drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +- drivers/staging/fbtft/fb_ra8875.c | 4 ++-- drivers/staging/fbtft/fb_tinylcd.c | 4 ++-- drivers/staging/fbtft/fb_upd161704.c | 18 +++++++++--------- drivers/staging/fbtft/fb_watterott.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c index eeeeec97a..9ac523511 100644 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c @@ -85,7 +85,7 @@ static void reset(struct fbtft_par *par) dev_dbg(par->info->device, "%s()\n", __func__);
gpiod_set_value(par->gpio.reset, 0); - udelay(20); + usleep_range(20); gpiod_set_value(par->gpio.reset, 1); mdelay(120); } diff --git a/drivers/staging/fbtft/fb_ra8875.c b/drivers/staging/fbtft/fb_ra8875.c index 398bdbf53..61d58efab 100644 --- a/drivers/staging/fbtft/fb_ra8875.c +++ b/drivers/staging/fbtft/fb_ra8875.c @@ -217,7 +217,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) } len--;
- udelay(100); + usleep_range(100);
if (len) { buf = (u8 *)par->buf; @@ -238,7 +238,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
/* restore user spi-speed */ par->fbtftops.write = fbtft_write_spi; - udelay(100); + usleep_range(100); }
static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) diff --git a/drivers/staging/fbtft/fb_tinylcd.c b/drivers/staging/fbtft/fb_tinylcd.c index 9469248f2..fffd39d96 100644 --- a/drivers/staging/fbtft/fb_tinylcd.c +++ b/drivers/staging/fbtft/fb_tinylcd.c @@ -38,10 +38,10 @@ static int init_display(struct fbtft_par *par) write_reg(par, 0xE5, 0x00); write_reg(par, 0xF0, 0x36, 0xA5, 0x53); write_reg(par, 0xE0, 0x00, 0x35, 0x33, 0x00, 0x00, 0x00, - 0x00, 0x35, 0x33, 0x00, 0x00, 0x00); + 0x00, 0x35, 0x33, 0x00, 0x00, 0x00); write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, 0x55); write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE); - udelay(250); + usleep_range(250); write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
return 0; diff --git a/drivers/staging/fbtft/fb_upd161704.c b/drivers/staging/fbtft/fb_upd161704.c index c77832ae5..bdcfda868 100644 --- a/drivers/staging/fbtft/fb_upd161704.c +++ b/drivers/staging/fbtft/fb_upd161704.c @@ -36,27 +36,27 @@ static int init_display(struct fbtft_par *par)
/* oscillator start */ write_reg(par, 0x003A, 0x0001); /*Oscillator 0: stop, 1: operation */ - udelay(100); + usleep_range(100);
/* y-setting */ write_reg(par, 0x0024, 0x007B); /* amplitude setting */ - udelay(10); + usleep_range(10); write_reg(par, 0x0025, 0x003B); /* amplitude setting */ write_reg(par, 0x0026, 0x0034); /* amplitude setting */ - udelay(10); + usleep_range(10); write_reg(par, 0x0027, 0x0004); /* amplitude setting */ write_reg(par, 0x0052, 0x0025); /* circuit setting 1 */ - udelay(10); + usleep_range(10); write_reg(par, 0x0053, 0x0033); /* circuit setting 2 */ write_reg(par, 0x0061, 0x001C); /* adjustment V10 positive polarity */ - udelay(10); + usleep_range(10); write_reg(par, 0x0062, 0x002C); /* adjustment V9 negative polarity */ write_reg(par, 0x0063, 0x0022); /* adjustment V34 positive polarity */ - udelay(10); + usleep_range(10); write_reg(par, 0x0064, 0x0027); /* adjustment V31 negative polarity */ - udelay(10); + usleep_range(10); write_reg(par, 0x0065, 0x0014); /* adjustment V61 negative polarity */ - udelay(10); + usleep_range(10); write_reg(par, 0x0066, 0x0010); /* adjustment V61 negative polarity */
/* Basical clock for 1 line (BASECOUNT[7:0]) number specified */ @@ -64,7 +64,7 @@ static int init_display(struct fbtft_par *par)
/* Power supply setting */ write_reg(par, 0x0019, 0x0000); /* DC/DC output setting */ - udelay(200); + usleep_range(200); write_reg(par, 0x001A, 0x1000); /* DC/DC frequency setting */ write_reg(par, 0x001B, 0x0023); /* DC/DC rising setting */ write_reg(par, 0x001C, 0x0C01); /* Regulator voltage setting */ diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c index 76b25df37..580d5329e 100644 --- a/drivers/staging/fbtft/fb_watterott.c +++ b/drivers/staging/fbtft/fb_watterott.c @@ -84,7 +84,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) par->txbuf.buf, 10 + par->info->fix.line_length); if (ret < 0) return ret; - udelay(300); + usleep_range(300); }
return 0; @@ -124,7 +124,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len) par->txbuf.buf, 10 + par->info->var.xres); if (ret < 0) return ret; - udelay(700); + usleep_range(700); }
return 0;
Hi Mayank,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/0day-ci/linux/commits/Mayank-Suman/staging-fbtft-replaced... base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 06b0c0dce88e2aa2f01343db0f26d214d7f264a0 config: alpha-allmodconfig (attached as .config) compiler: alpha-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/4a777af1cc91dc603b6b92fe06fd94081dc2... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Mayank-Suman/staging-fbtft-replaced-udelay-with-usleep_range/20210205-171807 git checkout 4a777af1cc91dc603b6b92fe06fd94081dc2891e # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All errors (new ones prefixed by >>):
drivers/staging/fbtft/fb_agm1264k-fl.c: In function 'reset':
drivers/staging/fbtft/fb_agm1264k-fl.c:88:2: error: too few arguments to function 'usleep_range'
88 | usleep_range(20); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_agm1264k-fl.c:12: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ -- drivers/staging/fbtft/fb_ra8875.c: In function 'write_reg8_bus8':
drivers/staging/fbtft/fb_ra8875.c:220:2: error: too few arguments to function 'usleep_range'
220 | usleep_range(100); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_ra8875.c:10: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_ra8875.c:241:2: error: too few arguments to function 'usleep_range' 241 | usleep_range(100); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_ra8875.c:10: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ -- drivers/staging/fbtft/fb_tinylcd.c: In function 'init_display':
drivers/staging/fbtft/fb_tinylcd.c:44:2: error: too few arguments to function 'usleep_range'
44 | usleep_range(250); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_tinylcd.c:11: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ -- drivers/staging/fbtft/fb_upd161704.c: In function 'init_display':
drivers/staging/fbtft/fb_upd161704.c:39:2: error: too few arguments to function 'usleep_range'
39 | usleep_range(100); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_upd161704.c:43:2: error: too few arguments to function 'usleep_range' 43 | usleep_range(10); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_upd161704.c:46:2: error: too few arguments to function 'usleep_range' 46 | usleep_range(10); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_upd161704.c:49:2: error: too few arguments to function 'usleep_range' 49 | usleep_range(10); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_upd161704.c:52:2: error: too few arguments to function 'usleep_range' 52 | usleep_range(10); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_upd161704.c:55:2: error: too few arguments to function 'usleep_range' 55 | usleep_range(10); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_upd161704.c:57:2: error: too few arguments to function 'usleep_range' 57 | usleep_range(10); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_upd161704.c:59:2: error: too few arguments to function 'usleep_range' 59 | usleep_range(10); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_upd161704.c:67:2: error: too few arguments to function 'usleep_range' 67 | usleep_range(200); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_upd161704.c:16: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ -- drivers/staging/fbtft/fb_watterott.c: In function 'write_vmem':
drivers/staging/fbtft/fb_watterott.c:87:3: error: too few arguments to function 'usleep_range'
87 | usleep_range(300); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_watterott.c:12: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~ drivers/staging/fbtft/fb_watterott.c: In function 'write_vmem_8bit': drivers/staging/fbtft/fb_watterott.c:127:3: error: too few arguments to function 'usleep_range' 127 | usleep_range(700); | ^~~~~~~~~~~~ In file included from drivers/staging/fbtft/fb_watterott.c:12: include/linux/delay.h:61:6: note: declared here 61 | void usleep_range(unsigned long min, unsigned long max); | ^~~~~~~~~~~~
vim +/usleep_range +88 drivers/staging/fbtft/fb_agm1264k-fl.c
79 80 static void reset(struct fbtft_par *par) 81 { 82 if (!par->gpio.reset) 83 return; 84 85 dev_dbg(par->info->device, "%s()\n", __func__); 86 87 gpiod_set_value(par->gpio.reset, 0);
88 usleep_range(20);
89 gpiod_set_value(par->gpio.reset, 1); 90 mdelay(120); 91 } 92
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Mayank,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/0day-ci/linux/commits/Mayank-Suman/staging-fbtft-replaced... base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 06b0c0dce88e2aa2f01343db0f26d214d7f264a0 config: arm64-randconfig-r025-20210205 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/4a777af1cc91dc603b6b92fe06fd94081dc2... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Mayank-Suman/staging-fbtft-replaced-udelay-with-usleep_range/20210205-171807 git checkout 4a777af1cc91dc603b6b92fe06fd94081dc2891e # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All errors (new ones prefixed by >>):
drivers/staging/fbtft/fb_ra8875.c:220:18: error: too few arguments to function call, expected 2, have 1
usleep_range(100); ~~~~~~~~~~~~ ^ include/linux/delay.h:61:6: note: 'usleep_range' declared here void usleep_range(unsigned long min, unsigned long max); ^ drivers/staging/fbtft/fb_ra8875.c:241:18: error: too few arguments to function call, expected 2, have 1 usleep_range(100); ~~~~~~~~~~~~ ^ include/linux/delay.h:61:6: note: 'usleep_range' declared here void usleep_range(unsigned long min, unsigned long max); ^ 2 errors generated. --
drivers/staging/fbtft/fb_tinylcd.c:44:18: error: too few arguments to function call, expected 2, have 1
usleep_range(250); ~~~~~~~~~~~~ ^ include/linux/delay.h:61:6: note: 'usleep_range' declared here void usleep_range(unsigned long min, unsigned long max); ^ 1 error generated. --
drivers/staging/fbtft/fb_watterott.c:87:19: error: too few arguments to function call, expected 2, have 1
usleep_range(300); ~~~~~~~~~~~~ ^ include/linux/delay.h:61:6: note: 'usleep_range' declared here void usleep_range(unsigned long min, unsigned long max); ^ drivers/staging/fbtft/fb_watterott.c:127:19: error: too few arguments to function call, expected 2, have 1 usleep_range(700); ~~~~~~~~~~~~ ^ include/linux/delay.h:61:6: note: 'usleep_range' declared here void usleep_range(unsigned long min, unsigned long max); ^ 2 errors generated.
vim +220 drivers/staging/fbtft/fb_ra8875.c
189 190 static void write_reg8_bus8(struct fbtft_par *par, int len, ...) 191 { 192 va_list args; 193 int i, ret; 194 u8 *buf = par->buf; 195 196 /* slow down spi-speed for writing registers */ 197 par->fbtftops.write = write_spi; 198 199 if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { 200 va_start(args, len); 201 for (i = 0; i < len; i++) 202 buf[i] = (u8)va_arg(args, unsigned int); 203 va_end(args); 204 fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, 205 u8, buf, len, "%s: ", __func__); 206 } 207 208 va_start(args, len); 209 *buf++ = 0x80; 210 *buf = (u8)va_arg(args, unsigned int); 211 ret = par->fbtftops.write(par, par->buf, 2); 212 if (ret < 0) { 213 va_end(args); 214 dev_err(par->info->device, "write() failed and returned %dn", 215 ret); 216 return; 217 } 218 len--; 219
220 usleep_range(100);
221 222 if (len) { 223 buf = (u8 *)par->buf; 224 *buf++ = 0x00; 225 i = len; 226 while (i--) 227 *buf++ = (u8)va_arg(args, unsigned int); 228 229 ret = par->fbtftops.write(par, par->buf, len + 1); 230 if (ret < 0) { 231 va_end(args); 232 dev_err(par->info->device, 233 "write() failed and returned %dn", ret); 234 return; 235 } 236 } 237 va_end(args); 238 239 /* restore user spi-speed */ 240 par->fbtftops.write = fbtft_write_spi; 241 usleep_range(100); 242 } 243
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
dri-devel@lists.freedesktop.org