[linux-next:master 2102/2463] drivers/ptp/ptp_ocp.c:2000:16: warning: operator '?:' has lower precedence than '&'; '&' will be evaluated first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   368847b165bbfbdcf0bd4c96b167893dcdb13aba
commit: a62a56d04e63cf0ececb5dd339811f0a14b7e77c [2102/2463] ptp: ocp: Enable 4th timestamper / PPS generator
config: x86_64-randconfig-a005-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 8cbbd7e0b2aa21ce7e416cfb63d9965518948c35)
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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=a62a56d04e63cf0ececb5dd339811f0a14b7e77c
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout a62a56d04e63cf0ececb5dd339811f0a14b7e77c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/ptp/ptp_ocp.c:2000:16: warning: operator '?:' has lower precedence than '&'; '&' will be evaluated first [-Wbitwise-conditional-parentheses]
                              on & map ? " ON" : "OFF", src);
                              ~~~~~~~~ ^
   drivers/ptp/ptp_ocp.c:2000:16: note: place parentheses around the '&' expression to silence this warning
                              on & map ? " ON" : "OFF", src);
                                       ^
                              (       )
   drivers/ptp/ptp_ocp.c:2000:16: note: place parentheses around the '?:' expression to evaluate it first
                              on & map ? " ON" : "OFF", src);
                                       ^
                                   (                  )
   drivers/ptp/ptp_ocp.c:2004:16: warning: operator '?:' has lower precedence than '&'; '&' will be evaluated first [-Wbitwise-conditional-parentheses]
                              on & map ? " ON" : "OFF", src);
                              ~~~~~~~~ ^
   drivers/ptp/ptp_ocp.c:2004:16: note: place parentheses around the '&' expression to silence this warning
                              on & map ? " ON" : "OFF", src);
                                       ^
                              (       )
   drivers/ptp/ptp_ocp.c:2004:16: note: place parentheses around the '?:' expression to evaluate it first
                              on & map ? " ON" : "OFF", src);
                                       ^
                                   (                  )
   2 warnings generated.


vim +2000 drivers/ptp/ptp_ocp.c

  1934	
  1935	static int
  1936	ptp_ocp_summary_show(struct seq_file *s, void *data)
  1937	{
  1938		struct device *dev = s->private;
  1939		struct ptp_system_timestamp sts;
  1940		u32 sma_in, sma_out, ctrl, val;
  1941		struct ts_reg __iomem *ts_reg;
  1942		struct timespec64 ts;
  1943		struct ptp_ocp *bp;
  1944		const char *src;
  1945		bool on, map;
  1946		char *buf;
  1947	
  1948		buf = (char *)__get_free_page(GFP_KERNEL);
  1949		if (!buf)
  1950			return -ENOMEM;
  1951	
  1952		bp = dev_get_drvdata(dev);
  1953		sma_in = ioread32(&bp->sma->gpio1);
  1954		sma_out = ioread32(&bp->sma->gpio2);
  1955	
  1956		seq_printf(s, "%7s: /dev/ptp%d\n", "PTP", ptp_clock_index(bp->ptp));
  1957	
  1958		sma1_show(dev, NULL, buf);
  1959		seq_printf(s, "   sma1: %s", buf);
  1960	
  1961		sma2_show(dev, NULL, buf);
  1962		seq_printf(s, "   sma2: %s", buf);
  1963	
  1964		sma3_show(dev, NULL, buf);
  1965		seq_printf(s, "   sma3: %s", buf);
  1966	
  1967		sma4_show(dev, NULL, buf);
  1968		seq_printf(s, "   sma4: %s", buf);
  1969	
  1970		if (bp->ts0) {
  1971			ts_reg = bp->ts0->mem;
  1972			on = ioread32(&ts_reg->enable);
  1973			src = "GNSS";
  1974			seq_printf(s, "%7s: %s, src: %s\n", "TS0",
  1975				   on ? " ON" : "OFF", src);
  1976		}
  1977	
  1978		if (bp->ts1) {
  1979			ts_reg = bp->ts1->mem;
  1980			on = ioread32(&ts_reg->enable);
  1981			src = gpio_map(sma_in, 2, "sma1", "sma2", "----");
  1982			seq_printf(s, "%7s: %s, src: %s\n", "TS1",
  1983				   on ? " ON" : "OFF", src);
  1984		}
  1985	
  1986		if (bp->ts2) {
  1987			ts_reg = bp->ts2->mem;
  1988			on = ioread32(&ts_reg->enable);
  1989			src = gpio_map(sma_in, 3, "sma1", "sma2", "----");
  1990			seq_printf(s, "%7s: %s, src: %s\n", "TS2",
  1991				   on ? " ON" : "OFF", src);
  1992		}
  1993	
  1994		if (bp->pps) {
  1995			ts_reg = bp->pps->mem;
  1996			src = "PHC";
  1997			on = ioread32(&ts_reg->enable);
  1998			map = !!(bp->pps_req_map & OCP_REQ_TIMESTAMP);
  1999			seq_printf(s, "%7s: %s, src: %s\n", "TS3",
> 2000				   on & map ? " ON" : "OFF", src);
  2001	
  2002			map = !!(bp->pps_req_map & OCP_REQ_PPS);
  2003			seq_printf(s, "%7s: %s, src: %s\n", "PPS",
  2004				   on & map ? " ON" : "OFF", src);
  2005		}
  2006	
  2007		if (bp->irig_out) {
  2008			ctrl = ioread32(&bp->irig_out->ctrl);
  2009			on = ctrl & IRIG_M_CTRL_ENABLE;
  2010			val = ioread32(&bp->irig_out->status);
  2011			gpio_multi_map(buf, sma_out, 4, "sma3", "sma4", "----");
  2012			seq_printf(s, "%7s: %s, error: %d, mode %d, out: %s\n", "IRIG",
  2013				   on ? " ON" : "OFF", val, (ctrl >> 16), buf);
  2014		}
  2015	
  2016		if (bp->irig_in) {
  2017			on = ioread32(&bp->irig_in->ctrl) & IRIG_S_CTRL_ENABLE;
  2018			val = ioread32(&bp->irig_in->status);
  2019			src = gpio_map(sma_in, 4, "sma1", "sma2", "----");
  2020			seq_printf(s, "%7s: %s, error: %d, src: %s\n", "IRIG in",
  2021				   on ? " ON" : "OFF", val, src);
  2022		}
  2023	
  2024		if (bp->dcf_out) {
  2025			on = ioread32(&bp->dcf_out->ctrl) & DCF_M_CTRL_ENABLE;
  2026			val = ioread32(&bp->dcf_out->status);
  2027			gpio_multi_map(buf, sma_out, 5, "sma3", "sma4", "----");
  2028			seq_printf(s, "%7s: %s, error: %d, out: %s\n", "DCF",
  2029				   on ? " ON" : "OFF", val, buf);
  2030		}
  2031	
  2032		if (bp->dcf_in) {
  2033			on = ioread32(&bp->dcf_in->ctrl) & DCF_S_CTRL_ENABLE;
  2034			val = ioread32(&bp->dcf_in->status);
  2035			src = gpio_map(sma_in, 5, "sma1", "sma2", "----");
  2036			seq_printf(s, "%7s: %s, error: %d, src: %s\n", "DCF in",
  2037				   on ? " ON" : "OFF", val, src);
  2038		}
  2039	
  2040		if (bp->nmea_out) {
  2041			on = ioread32(&bp->nmea_out->ctrl) & 1;
  2042			val = ioread32(&bp->nmea_out->status);
  2043			seq_printf(s, "%7s: %s, error: %d\n", "NMEA",
  2044				   on ? " ON" : "OFF", val);
  2045		}
  2046	
  2047		/* compute src for PPS1, used below. */
  2048		if (bp->pps_select) {
  2049			val = ioread32(&bp->pps_select->gpio1);
  2050			if (val & 0x01)
  2051				src = gpio_map(sma_in, 0, "sma1", "sma2", "----");
  2052			else if (val & 0x02)
  2053				src = "MAC";
  2054			else if (val & 0x04)
  2055				src = "GNSS";
  2056			else
  2057				src = "----";
  2058		} else {
  2059			src = "?";
  2060		}
  2061	
  2062		/* assumes automatic switchover/selection */
  2063		val = ioread32(&bp->reg->select);
  2064		switch (val >> 16) {
  2065		case 0:
  2066			sprintf(buf, "----");
  2067			break;
  2068		case 2:
  2069			sprintf(buf, "IRIG");
  2070			break;
  2071		case 3:
  2072			sprintf(buf, "%s via PPS1", src);
  2073			break;
  2074		case 6:
  2075			sprintf(buf, "DCF");
  2076			break;
  2077		default:
  2078			strcpy(buf, "unknown");
  2079			break;
  2080		}
  2081		val = ioread32(&bp->reg->status);
  2082		seq_printf(s, "%7s: %s, state: %s\n", "PHC src", buf,
  2083			   val & OCP_STATUS_IN_SYNC ? "sync" : "unsynced");
  2084	
  2085		/* reuses PPS1 src from earlier */
  2086		seq_printf(s, "MAC PPS1 src: %s\n", src);
  2087	
  2088		src = gpio_map(sma_in, 1, "sma1", "sma2", "GNSS2");
  2089		seq_printf(s, "MAC PPS2 src: %s\n", src);
  2090	
  2091		if (!ptp_ocp_gettimex(&bp->ptp_info, &ts, &sts)) {
  2092			struct timespec64 sys_ts;
  2093			s64 pre_ns, post_ns, ns;
  2094	
  2095			pre_ns = timespec64_to_ns(&sts.pre_ts);
  2096			post_ns = timespec64_to_ns(&sts.post_ts);
  2097			ns = (pre_ns + post_ns) / 2;
  2098			ns += (s64)bp->utc_tai_offset * NSEC_PER_SEC;
  2099			sys_ts = ns_to_timespec64(ns);
  2100	
  2101			seq_printf(s, "%7s: %lld.%ld == %ptT TAI\n", "PHC",
  2102				   ts.tv_sec, ts.tv_nsec, &ts);
  2103			seq_printf(s, "%7s: %lld.%ld == %ptT UTC offset %d\n", "SYS",
  2104				   sys_ts.tv_sec, sys_ts.tv_nsec, &sys_ts,
  2105				   bp->utc_tai_offset);
  2106			seq_printf(s, "%7s: PHC:SYS offset: %lld  window: %lld\n", "",
  2107				   timespec64_to_ns(&ts) - ns,
  2108				   post_ns - pre_ns);
  2109		}
  2110	
  2111		free_page((unsigned long)buf);
  2112		return 0;
  2113	}
  2114	DEFINE_SHOW_ATTRIBUTE(ptp_ocp_summary);
  2115	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux