All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [freescale-fslc:5.4-2.3.x-imx 12739/16811] drivers/i2c/busses/i2c-imx-lpi2c.c:243 lpi2c_imx_config() warn: the 'I2C_CLK_RATIO' macro might need parens
Date: Fri, 29 Jan 2021 14:39:23 +0800	[thread overview]
Message-ID: <202101291421.NBZJu1eP-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 5468 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Otavio Salvador <otavio@ossystems.com.br>

tree:   https://github.com/Freescale/linux-fslc 5.4-2.3.x-imx
head:   549889f65d65baa0e9efa8790dc81ce8c580d842
commit: 124d288c85caab0f868cec5387a1a32f39871392 [12739/16811] MLK-24495 i2c: lpi2c: fix i2c timing issue
:::::: branch date: 6 hours ago
:::::: commit date: 5 months ago
config: x86_64-randconfig-m001-20210129 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/i2c/busses/i2c-imx-lpi2c.c:243 lpi2c_imx_config() warn: the 'I2C_CLK_RATIO' macro might need parens

Old smatch warnings:
drivers/i2c/busses/i2c-imx-lpi2c.c:583 lpi2c_imx_init_recovery_info() warn: passing zero to 'PTR_ERR'

vim +/I2C_CLK_RATIO +243 drivers/i2c/busses/i2c-imx-lpi2c.c

a55fa9d0e42e31 Gao Pan    2016-11-30  217  
124d288c85caab Clark Wang 2020-08-19  218  /* CLKLO = (1 - I2C_CLK_RATIO) * clk_cycle, SETHOLD = CLKHI, DATAVD = CLKHI/2
124d288c85caab Clark Wang 2020-08-19  219     CLKHI = I2C_CLK_RATIO * clk_cycle */
a55fa9d0e42e31 Gao Pan    2016-11-30  220  static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
a55fa9d0e42e31 Gao Pan    2016-11-30  221  {
a55fa9d0e42e31 Gao Pan    2016-11-30  222  	u8 prescale, filt, sethold, clkhi, clklo, datavd;
a55fa9d0e42e31 Gao Pan    2016-11-30  223  	unsigned int clk_rate, clk_cycle;
a55fa9d0e42e31 Gao Pan    2016-11-30  224  	enum lpi2c_imx_pincfg pincfg;
a55fa9d0e42e31 Gao Pan    2016-11-30  225  	unsigned int temp;
a55fa9d0e42e31 Gao Pan    2016-11-30  226  
a55fa9d0e42e31 Gao Pan    2016-11-30  227  	lpi2c_imx_set_mode(lpi2c_imx);
a55fa9d0e42e31 Gao Pan    2016-11-30  228  
c846995d43e1d2 Gao Pan    2018-01-19  229  	clk_rate = clk_get_rate(lpi2c_imx->clk_per);
c846995d43e1d2 Gao Pan    2018-01-19  230  	if (!clk_rate) {
c846995d43e1d2 Gao Pan    2018-01-19  231  		dev_dbg(&lpi2c_imx->adapter.dev, "clk_per rate is 0\n");
c846995d43e1d2 Gao Pan    2018-01-19  232  		return -EINVAL;
c846995d43e1d2 Gao Pan    2018-01-19  233  	}
c846995d43e1d2 Gao Pan    2018-01-19  234  
a55fa9d0e42e31 Gao Pan    2016-11-30  235  	if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST)
a55fa9d0e42e31 Gao Pan    2016-11-30  236  		filt = 0;
a55fa9d0e42e31 Gao Pan    2016-11-30  237  	else
a55fa9d0e42e31 Gao Pan    2016-11-30  238  		filt = 2;
a55fa9d0e42e31 Gao Pan    2016-11-30  239  
a55fa9d0e42e31 Gao Pan    2016-11-30  240  	for (prescale = 0; prescale <= 7; prescale++) {
a55fa9d0e42e31 Gao Pan    2016-11-30  241  		clk_cycle = clk_rate / ((1 << prescale) * lpi2c_imx->bitrate)
124d288c85caab Clark Wang 2020-08-19  242  			    - (2 + filt) / (1 << prescale);
124d288c85caab Clark Wang 2020-08-19 @243  		clkhi = clk_cycle * I2C_CLK_RATIO;
a55fa9d0e42e31 Gao Pan    2016-11-30  244  		clklo = clk_cycle - clkhi;
a55fa9d0e42e31 Gao Pan    2016-11-30  245  		if (clklo < 64)
a55fa9d0e42e31 Gao Pan    2016-11-30  246  			break;
a55fa9d0e42e31 Gao Pan    2016-11-30  247  	}
a55fa9d0e42e31 Gao Pan    2016-11-30  248  
a55fa9d0e42e31 Gao Pan    2016-11-30  249  	if (prescale > 7)
a55fa9d0e42e31 Gao Pan    2016-11-30  250  		return -EINVAL;
a55fa9d0e42e31 Gao Pan    2016-11-30  251  
a55fa9d0e42e31 Gao Pan    2016-11-30  252  	/* set MCFGR1: PINCFG, PRESCALE, IGNACK */
a55fa9d0e42e31 Gao Pan    2016-11-30  253  	if (lpi2c_imx->mode == ULTRA_FAST)
a55fa9d0e42e31 Gao Pan    2016-11-30  254  		pincfg = TWO_PIN_OO;
a55fa9d0e42e31 Gao Pan    2016-11-30  255  	else
a55fa9d0e42e31 Gao Pan    2016-11-30  256  		pincfg = TWO_PIN_OD;
a55fa9d0e42e31 Gao Pan    2016-11-30  257  	temp = prescale | pincfg << 24;
a55fa9d0e42e31 Gao Pan    2016-11-30  258  
a55fa9d0e42e31 Gao Pan    2016-11-30  259  	if (lpi2c_imx->mode == ULTRA_FAST)
a55fa9d0e42e31 Gao Pan    2016-11-30  260  		temp |= MCFGR1_IGNACK;
a55fa9d0e42e31 Gao Pan    2016-11-30  261  
a55fa9d0e42e31 Gao Pan    2016-11-30  262  	writel(temp, lpi2c_imx->base + LPI2C_MCFGR1);
a55fa9d0e42e31 Gao Pan    2016-11-30  263  
a55fa9d0e42e31 Gao Pan    2016-11-30  264  	/* set MCFGR2: FILTSDA, FILTSCL */
a55fa9d0e42e31 Gao Pan    2016-11-30  265  	temp = (filt << 16) | (filt << 24);
a55fa9d0e42e31 Gao Pan    2016-11-30  266  	writel(temp, lpi2c_imx->base + LPI2C_MCFGR2);
a55fa9d0e42e31 Gao Pan    2016-11-30  267  
a55fa9d0e42e31 Gao Pan    2016-11-30  268  	/* set MCCR: DATAVD, SETHOLD, CLKHI, CLKLO */
a55fa9d0e42e31 Gao Pan    2016-11-30  269  	sethold = clkhi;
a55fa9d0e42e31 Gao Pan    2016-11-30  270  	datavd = clkhi >> 1;
a55fa9d0e42e31 Gao Pan    2016-11-30  271  	temp = datavd << 24 | sethold << 16 | clkhi << 8 | clklo;
a55fa9d0e42e31 Gao Pan    2016-11-30  272  
a55fa9d0e42e31 Gao Pan    2016-11-30  273  	if (lpi2c_imx->mode == HS)
a55fa9d0e42e31 Gao Pan    2016-11-30  274  		writel(temp, lpi2c_imx->base + LPI2C_MCCR1);
a55fa9d0e42e31 Gao Pan    2016-11-30  275  	else
a55fa9d0e42e31 Gao Pan    2016-11-30  276  		writel(temp, lpi2c_imx->base + LPI2C_MCCR0);
a55fa9d0e42e31 Gao Pan    2016-11-30  277  
a55fa9d0e42e31 Gao Pan    2016-11-30  278  	return 0;
a55fa9d0e42e31 Gao Pan    2016-11-30  279  }
a55fa9d0e42e31 Gao Pan    2016-11-30  280  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 40633 bytes --]

             reply	other threads:[~2021-01-29  6:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29  6:39 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-29  8:02 [freescale-fslc:5.4-2.3.x-imx 12739/16811] drivers/i2c/busses/i2c-imx-lpi2c.c:243 lpi2c_imx_config() warn: the 'I2C_CLK_RATIO' macro might need parens Dan Carpenter
2021-01-29  8:02 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202101291421.NBZJu1eP-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.