All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Fredrik M Olsson <fredrik.m.olsson@axis.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@axis.com,
	Fredrik M Olsson <fredrik.m.olsson@axis.com>
Subject: Re: [PATCH v3] rtc: ds1307: Add driver for Epson RX8901CE
Date: Tue, 30 Jun 2026 04:15:37 +0800	[thread overview]
Message-ID: <202606300447.wDrgfpSn-lkp@intel.com> (raw)
In-Reply-To: <20260629-ds1307-rx8901-add-v3-1-302dc3cbb71e@axis.com>

Hi Fredrik,

kernel test robot noticed the following build warnings:

[auto build test WARNING on dc59e4fea9d83f03bad6bddf3fa2e52491777482]

url:    https://github.com/intel-lab-lkp/linux/commits/Fredrik-M-Olsson/rtc-ds1307-Add-driver-for-Epson-RX8901CE/20260629-232253
base:   dc59e4fea9d83f03bad6bddf3fa2e52491777482
patch link:    https://lore.kernel.org/r/20260629-ds1307-rx8901-add-v3-1-302dc3cbb71e%40axis.com
patch subject: [PATCH v3] rtc: ds1307: Add driver for Epson RX8901CE
config: um-randconfig-002-20260630 (https://download.01.org/0day-ci/archive/20260630/202606300447.wDrgfpSn-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260630/202606300447.wDrgfpSn-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606300447.wDrgfpSn-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/rtc/rtc-ds1307.c:2332:2: warning: label at end of compound statement is a C2x extension [-Wc2x-extensions]
    2332 |         }
         |         ^
   1 warning generated.


vim +2332 drivers/rtc/rtc-ds1307.c

  2066	
  2067	static int ds1307_probe(struct i2c_client *client)
  2068	{
  2069		const struct i2c_device_id *id = i2c_client_get_device_id(client);
  2070		struct ds1307		*ds1307;
  2071		const void		*match;
  2072		int			err = -ENODEV;
  2073		int			tmp;
  2074		const struct chip_desc	*chip;
  2075		bool			want_irq;
  2076		bool			ds1307_can_wakeup_device = false;
  2077		unsigned char		regs[8];
  2078		struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev);
  2079		int			trickle_charger_setup = 0;
  2080	
  2081		ds1307 = devm_kzalloc(&client->dev, sizeof(struct ds1307), GFP_KERNEL);
  2082		if (!ds1307)
  2083			return -ENOMEM;
  2084	
  2085		dev_set_drvdata(&client->dev, ds1307);
  2086		ds1307->dev = &client->dev;
  2087		ds1307->name = client->name;
  2088	
  2089		ds1307->regmap = devm_regmap_init_i2c(client, &regmap_config);
  2090		if (IS_ERR(ds1307->regmap)) {
  2091			dev_err(ds1307->dev, "regmap allocation failed\n");
  2092			return PTR_ERR(ds1307->regmap);
  2093		}
  2094	
  2095		i2c_set_clientdata(client, ds1307);
  2096	
  2097		match = device_get_match_data(&client->dev);
  2098		if (match) {
  2099			ds1307->type = (uintptr_t)match;
  2100			chip = &chips[ds1307->type];
  2101		} else if (id) {
  2102			chip = &chips[id->driver_data];
  2103			ds1307->type = id->driver_data;
  2104		} else {
  2105			return -ENODEV;
  2106		}
  2107	
  2108		want_irq = client->irq > 0 && chip->alarm;
  2109	
  2110		if (!pdata)
  2111			trickle_charger_setup = ds1307_trickle_init(ds1307, chip);
  2112		else if (pdata->trickle_charger_setup)
  2113			trickle_charger_setup = pdata->trickle_charger_setup;
  2114	
  2115		if (trickle_charger_setup < 0)
  2116			return trickle_charger_setup;
  2117	
  2118		if (trickle_charger_setup && chip->trickle_charger_reg) {
  2119			dev_dbg(ds1307->dev,
  2120				"writing trickle charger info 0x%x to 0x%x\n",
  2121				trickle_charger_setup, chip->trickle_charger_reg);
  2122			regmap_write(ds1307->regmap, chip->trickle_charger_reg,
  2123				     (u8)trickle_charger_setup);
  2124		}
  2125	
  2126	/*
  2127	 * For devices with no IRQ directly connected to the SoC, the RTC chip
  2128	 * can be forced as a wakeup source by stating that explicitly in
  2129	 * the device's .dts file using the "wakeup-source" boolean property.
  2130	 * If the "wakeup-source" property is set, don't request an IRQ.
  2131	 * This will guarantee the 'wakealarm' sysfs entry is available on the device,
  2132	 * if supported by the RTC.
  2133	 */
  2134		if (chip->alarm && device_property_read_bool(&client->dev, "wakeup-source"))
  2135			ds1307_can_wakeup_device = true;
  2136	
  2137		switch (ds1307->type) {
  2138		case ds_1337:
  2139		case ds_1339:
  2140		case ds_1341:
  2141		case ds_3231:
  2142			/* get registers that the "rtc" read below won't read... */
  2143			err = regmap_bulk_read(ds1307->regmap, DS1337_REG_CONTROL,
  2144					       regs, 2);
  2145			if (err) {
  2146				dev_dbg(ds1307->dev, "read error %d\n", err);
  2147				goto exit;
  2148			}
  2149	
  2150			/* oscillator off?  turn it on, so clock can tick. */
  2151			if (regs[0] & DS1337_BIT_nEOSC)
  2152				regs[0] &= ~DS1337_BIT_nEOSC;
  2153	
  2154			/*
  2155			 * Using IRQ or defined as wakeup-source?
  2156			 * Disable the square wave and both alarms.
  2157			 * For some variants, be sure alarms can trigger when we're
  2158			 * running on Vbackup (BBSQI/BBSQW)
  2159			 */
  2160			if (want_irq || ds1307_can_wakeup_device)
  2161				regs[0] |= DS1337_BIT_INTCN | chip->bbsqi_bit;
  2162	
  2163			regmap_write(ds1307->regmap, DS1337_REG_CONTROL,
  2164				     regs[0]);
  2165	
  2166			/* oscillator fault? warn */
  2167			if (regs[1] & DS1337_BIT_OSF) {
  2168				dev_warn(ds1307->dev, "SET TIME!\n");
  2169			}
  2170			break;
  2171	
  2172		case rx_8025:
  2173			err = regmap_bulk_read(ds1307->regmap,
  2174					       RX8025_REG_CTRL1 << 4 | 0x08, regs, 2);
  2175			if (err) {
  2176				dev_dbg(ds1307->dev, "read error %d\n", err);
  2177				goto exit;
  2178			}
  2179	
  2180			/* oscillator off?  turn it on, so clock can tick. */
  2181			if (!(regs[1] & RX8025_BIT_XST)) {
  2182				regs[1] |= RX8025_BIT_XST;
  2183				regmap_write(ds1307->regmap,
  2184					     RX8025_REG_CTRL2 << 4 | 0x08,
  2185					     regs[1]);
  2186				dev_warn(ds1307->dev,
  2187					 "oscillator stop detected - SET TIME!\n");
  2188			}
  2189	
  2190			if (regs[1] & RX8025_BIT_PON) {
  2191				regs[1] &= ~RX8025_BIT_PON;
  2192				regmap_write(ds1307->regmap,
  2193					     RX8025_REG_CTRL2 << 4 | 0x08,
  2194					     regs[1]);
  2195				dev_warn(ds1307->dev, "power-on detected\n");
  2196			}
  2197	
  2198			if (regs[1] & RX8025_BIT_VDET) {
  2199				regs[1] &= ~RX8025_BIT_VDET;
  2200				regmap_write(ds1307->regmap,
  2201					     RX8025_REG_CTRL2 << 4 | 0x08,
  2202					     regs[1]);
  2203				dev_warn(ds1307->dev, "voltage drop detected\n");
  2204			}
  2205	
  2206			/* make sure we are running in 24hour mode */
  2207			if (!(regs[0] & RX8025_BIT_2412)) {
  2208				u8 hour;
  2209	
  2210				/* switch to 24 hour mode */
  2211				regmap_write(ds1307->regmap,
  2212					     RX8025_REG_CTRL1 << 4 | 0x08,
  2213					     regs[0] | RX8025_BIT_2412);
  2214	
  2215				err = regmap_bulk_read(ds1307->regmap,
  2216						       RX8025_REG_CTRL1 << 4 | 0x08,
  2217						       regs, 2);
  2218				if (err) {
  2219					dev_dbg(ds1307->dev, "read error %d\n", err);
  2220					goto exit;
  2221				}
  2222	
  2223				/* correct hour */
  2224				hour = bcd2bin(regs[DS1307_REG_HOUR]);
  2225				if (hour == 12)
  2226					hour = 0;
  2227				if (regs[DS1307_REG_HOUR] & DS1307_BIT_PM)
  2228					hour += 12;
  2229	
  2230				regmap_write(ds1307->regmap,
  2231					     DS1307_REG_HOUR << 4 | 0x08, hour);
  2232			}
  2233			break;
  2234		case ds_1388:
  2235			err = regmap_read(ds1307->regmap, DS1388_REG_CONTROL, &tmp);
  2236			if (err) {
  2237				dev_dbg(ds1307->dev, "read error %d\n", err);
  2238				goto exit;
  2239			}
  2240	
  2241			/* oscillator off?  turn it on, so clock can tick. */
  2242			if (tmp & DS1388_BIT_nEOSC) {
  2243				tmp &= ~DS1388_BIT_nEOSC;
  2244				regmap_write(ds1307->regmap, DS1388_REG_CONTROL, tmp);
  2245			}
  2246			break;
  2247		default:
  2248			break;
  2249		}
  2250	
  2251		/* read RTC registers */
  2252		err = regmap_bulk_read(ds1307->regmap, chip->offset, regs,
  2253				       sizeof(regs));
  2254		if (err) {
  2255			dev_dbg(ds1307->dev, "read error %d\n", err);
  2256			goto exit;
  2257		}
  2258	
  2259		if (ds1307->type == mcp794xx &&
  2260		    !(regs[DS1307_REG_WDAY] & MCP794XX_BIT_VBATEN)) {
  2261			regmap_write(ds1307->regmap, DS1307_REG_WDAY,
  2262				     regs[DS1307_REG_WDAY] |
  2263				     MCP794XX_BIT_VBATEN);
  2264		}
  2265	
  2266		tmp = regs[DS1307_REG_HOUR];
  2267		switch (ds1307->type) {
  2268		case ds_1340:
  2269		case m41t0:
  2270		case m41t00:
  2271		case m41t11:
  2272			/*
  2273			 * NOTE: ignores century bits; fix before deploying
  2274			 * systems that will run through year 2100.
  2275			 */
  2276			break;
  2277		case rx_8025:
  2278			break;
  2279		default:
  2280			if (!(tmp & DS1307_BIT_12HR))
  2281				break;
  2282	
  2283			/*
  2284			 * Be sure we're in 24 hour mode.  Multi-master systems
  2285			 * take note...
  2286			 */
  2287			tmp = bcd2bin(tmp & 0x1f);
  2288			if (tmp == 12)
  2289				tmp = 0;
  2290			if (regs[DS1307_REG_HOUR] & DS1307_BIT_PM)
  2291				tmp += 12;
  2292			regmap_write(ds1307->regmap, chip->offset + DS1307_REG_HOUR,
  2293				     bin2bcd(tmp));
  2294		}
  2295	
  2296		ds1307->rtc = devm_rtc_allocate_device(ds1307->dev);
  2297		if (IS_ERR(ds1307->rtc))
  2298			return PTR_ERR(ds1307->rtc);
  2299	
  2300		if (want_irq || ds1307_can_wakeup_device)
  2301			device_set_wakeup_capable(ds1307->dev, true);
  2302		else
  2303			clear_bit(RTC_FEATURE_ALARM, ds1307->rtc->features);
  2304	
  2305		if (ds1307_can_wakeup_device && !want_irq) {
  2306			dev_info(ds1307->dev,
  2307				 "'wakeup-source' is set, request for an IRQ is disabled!\n");
  2308			/* We cannot support UIE mode if we do not have an IRQ line */
  2309			clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, ds1307->rtc->features);
  2310		}
  2311	
  2312		if (want_irq) {
  2313			err = devm_request_threaded_irq(ds1307->dev, client->irq, NULL,
  2314							chip->irq_handler ?: ds1307_irq,
  2315							IRQF_SHARED | IRQF_ONESHOT,
  2316							ds1307->name, ds1307);
  2317			if (err) {
  2318				client->irq = 0;
  2319				device_set_wakeup_capable(ds1307->dev, false);
  2320				clear_bit(RTC_FEATURE_ALARM, ds1307->rtc->features);
  2321				dev_err(ds1307->dev, "unable to request IRQ!\n");
  2322			} else {
  2323				dev_dbg(ds1307->dev, "got IRQ %d\n", client->irq);
  2324			}
  2325		}
  2326	
  2327		switch (ds1307->type) {
  2328		case rx_8901:
  2329			set_bit(RTC_FEATURE_BACKUP_SWITCH_MODE, ds1307->rtc->features);
  2330			break;
  2331		default:
> 2332		}
  2333	
  2334		ds1307->rtc->ops = chip->rtc_ops ?: &ds13xx_rtc_ops;
  2335		err = ds1307_add_frequency_test(ds1307);
  2336		if (err)
  2337			return err;
  2338	
  2339		err = devm_rtc_register_device(ds1307->rtc);
  2340		if (err)
  2341			return err;
  2342	
  2343		if (chip->nvram_size) {
  2344			struct nvmem_config nvmem_cfg = {
  2345				.name = "ds1307_nvram",
  2346				.word_size = 1,
  2347				.stride = 1,
  2348				.size = chip->nvram_size,
  2349				.reg_read = ds1307_nvram_read,
  2350				.reg_write = ds1307_nvram_write,
  2351				.priv = ds1307,
  2352			};
  2353	
  2354			devm_rtc_nvmem_register(ds1307->rtc, &nvmem_cfg);
  2355		}
  2356	
  2357		ds1307_hwmon_register(ds1307);
  2358		ds1307_clks_register(ds1307);
  2359		ds1307_wdt_register(ds1307);
  2360	
  2361		return 0;
  2362	
  2363	exit:
  2364		return err;
  2365	}
  2366	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2026-06-29 20:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 15:13 [PATCH v3] rtc: ds1307: Add driver for Epson RX8901CE Fredrik M Olsson
2026-06-29 20:15 ` kernel test robot [this message]
2026-06-29 21:10 ` kernel test robot
2026-06-29 21:10 ` kernel test robot
2026-06-30  2:07 ` kernel test robot

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=202606300447.wDrgfpSn-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fredrik.m.olsson@axis.com \
    --cc=kernel@axis.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nobuhiro.iwamatsu.x90@mail.toshiba \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=robh@kernel.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.