Re: drivers/watchdog/rave-sp-wdt.c:278: undefined reference to `nvmem_cell_get'

2018-02-13 Thread Guenter Roeck

On 02/13/2018 06:20 AM, Andrey Smirnov wrote:

On Tue, Feb 13, 2018 at 1:30 AM, Lee Jones  wrote:

On Tue, 13 Feb 2018, kbuild test robot wrote:


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   178e834c47b0d01352c48730235aae69898fbc02
commit: c3bb333457218ca4ed9553be47c0f567b4ef8a38 watchdog: Add RAVE SP watchdog 
driver
date:   5 weeks ago
config: x86_64-randconfig-u0-02131401 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
 git checkout c3bb333457218ca4ed9553be47c0f567b4ef8a38
 # save the attached .config to linux build tree
 make ARCH=x86_64

All errors (new ones prefixed by >>):

drivers/watchdog/rave-sp-wdt.o: In function `rave_sp_wdt_probe':

drivers/watchdog/rave-sp-wdt.c:278: undefined reference to `nvmem_cell_get'
drivers/watchdog/rave-sp-wdt.c:281: undefined reference to `nvmem_cell_read'
drivers/watchdog/rave-sp-wdt.c:287: undefined reference to `nvmem_cell_put'

make[2]: *** [vmlinux] Error 1


Looks like the RAVE Watchdog driver should select NVMEM?



AFAICT, this is happening when RAVE SP core and watchdog drivers are
built as built-in and NVMEM is selected as module. Looking at other
users on NVMEM in the kernel is seems that the pattern to prevent this
problem is to add "depends on NVMEM || !NVMEM" line to consumer's
Kconfig entry.

I'll submit a patch to that effect shortly.



Actually, no need to send it. Arnd Bergmann sent the patch already back in 
January,
only for some reason it got lost in the commit window. I'll discuss with Wim how
to send it upstream.

Guenter


Re: drivers/watchdog/rave-sp-wdt.c:278: undefined reference to `nvmem_cell_get'

2018-02-13 Thread Guenter Roeck

On 02/13/2018 06:20 AM, Andrey Smirnov wrote:

On Tue, Feb 13, 2018 at 1:30 AM, Lee Jones  wrote:

On Tue, 13 Feb 2018, kbuild test robot wrote:


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   178e834c47b0d01352c48730235aae69898fbc02
commit: c3bb333457218ca4ed9553be47c0f567b4ef8a38 watchdog: Add RAVE SP watchdog 
driver
date:   5 weeks ago
config: x86_64-randconfig-u0-02131401 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
 git checkout c3bb333457218ca4ed9553be47c0f567b4ef8a38
 # save the attached .config to linux build tree
 make ARCH=x86_64

All errors (new ones prefixed by >>):

drivers/watchdog/rave-sp-wdt.o: In function `rave_sp_wdt_probe':

drivers/watchdog/rave-sp-wdt.c:278: undefined reference to `nvmem_cell_get'
drivers/watchdog/rave-sp-wdt.c:281: undefined reference to `nvmem_cell_read'
drivers/watchdog/rave-sp-wdt.c:287: undefined reference to `nvmem_cell_put'

make[2]: *** [vmlinux] Error 1


Looks like the RAVE Watchdog driver should select NVMEM?



AFAICT, this is happening when RAVE SP core and watchdog drivers are
built as built-in and NVMEM is selected as module. Looking at other
users on NVMEM in the kernel is seems that the pattern to prevent this
problem is to add "depends on NVMEM || !NVMEM" line to consumer's
Kconfig entry.


Makes sense, since the driver still works if NVMEM is not enabled at all.


I'll submit a patch to that effect shortly.


Thanks,
Guenter


Re: drivers/watchdog/rave-sp-wdt.c:278: undefined reference to `nvmem_cell_get'

2018-02-13 Thread Andrey Smirnov
On Tue, Feb 13, 2018 at 1:30 AM, Lee Jones  wrote:
> On Tue, 13 Feb 2018, kbuild test robot wrote:
>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
>> master
>> head:   178e834c47b0d01352c48730235aae69898fbc02
>> commit: c3bb333457218ca4ed9553be47c0f567b4ef8a38 watchdog: Add RAVE SP 
>> watchdog driver
>> date:   5 weeks ago
>> config: x86_64-randconfig-u0-02131401 (attached as .config)
>> compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
>> reproduce:
>> git checkout c3bb333457218ca4ed9553be47c0f567b4ef8a38
>> # save the attached .config to linux build tree
>> make ARCH=x86_64
>>
>> All errors (new ones prefixed by >>):
>>
>>drivers/watchdog/rave-sp-wdt.o: In function `rave_sp_wdt_probe':
>> >> drivers/watchdog/rave-sp-wdt.c:278: undefined reference to 
>> >> `nvmem_cell_get'
>> >> drivers/watchdog/rave-sp-wdt.c:281: undefined reference to 
>> >> `nvmem_cell_read'
>> >> drivers/watchdog/rave-sp-wdt.c:287: undefined reference to 
>> >> `nvmem_cell_put'
>>make[2]: *** [vmlinux] Error 1
>
> Looks like the RAVE Watchdog driver should select NVMEM?
>

AFAICT, this is happening when RAVE SP core and watchdog drivers are
built as built-in and NVMEM is selected as module. Looking at other
users on NVMEM in the kernel is seems that the pattern to prevent this
problem is to add "depends on NVMEM || !NVMEM" line to consumer's
Kconfig entry.

I'll submit a patch to that effect shortly.

Thanks,
Andrey Smirnov


Re: drivers/watchdog/rave-sp-wdt.c:278: undefined reference to `nvmem_cell_get'

2018-02-13 Thread Lee Jones
On Tue, 13 Feb 2018, kbuild test robot wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   178e834c47b0d01352c48730235aae69898fbc02
> commit: c3bb333457218ca4ed9553be47c0f567b4ef8a38 watchdog: Add RAVE SP 
> watchdog driver
> date:   5 weeks ago
> config: x86_64-randconfig-u0-02131401 (attached as .config)
> compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
> reproduce:
> git checkout c3bb333457218ca4ed9553be47c0f567b4ef8a38
> # save the attached .config to linux build tree
> make ARCH=x86_64 
> 
> All errors (new ones prefixed by >>):
> 
>drivers/watchdog/rave-sp-wdt.o: In function `rave_sp_wdt_probe':
> >> drivers/watchdog/rave-sp-wdt.c:278: undefined reference to `nvmem_cell_get'
> >> drivers/watchdog/rave-sp-wdt.c:281: undefined reference to 
> >> `nvmem_cell_read'
> >> drivers/watchdog/rave-sp-wdt.c:287: undefined reference to `nvmem_cell_put'
>make[2]: *** [vmlinux] Error 1

Looks like the RAVE Watchdog driver should select NVMEM?

> vim +278 drivers/watchdog/rave-sp-wdt.c
> 
>252
>253static int rave_sp_wdt_probe(struct platform_device *pdev)
>254{
>255struct device *dev = &pdev->dev;
>256struct watchdog_device *wdd;
>257struct rave_sp_wdt *sp_wd;
>258struct nvmem_cell *cell;
>259__le16 timeout = 0;
>260int ret;
>261
>262sp_wd = devm_kzalloc(dev, sizeof(*sp_wd), GFP_KERNEL);
>263if (!sp_wd)
>264return -ENOMEM;
>265
>266sp_wd->variant = of_device_get_match_data(dev);
>267sp_wd->sp  = dev_get_drvdata(dev->parent);
>268
>269wdd  = &sp_wd->wdd;
>270wdd->parent  = dev;
>271wdd->info= &rave_sp_wdt_info;
>272wdd->ops = &rave_sp_wdt_ops;
>273wdd->min_timeout = sp_wd->variant->min_timeout;
>274wdd->max_timeout = sp_wd->variant->max_timeout;
>275wdd->status  = WATCHDOG_NOWAYOUT_INIT_STATUS;
>276wdd->timeout = 60;
>277
>  > 278cell = nvmem_cell_get(dev, "wdt-timeout");
>279if (!IS_ERR(cell)) {
>280size_t len;
>  > 281void *value = nvmem_cell_read(cell, &len);
>282
>283if (!IS_ERR(value)) {
>284memcpy(&timeout, value, min(len, 
> sizeof(timeout)));
>285kfree(value);
>286}
>  > 287nvmem_cell_put(cell);
>288}
>289watchdog_init_timeout(wdd, le16_to_cpu(timeout), dev);
>290watchdog_set_restart_priority(wdd, 255);
>291watchdog_stop_on_unregister(wdd);
>292
>293sp_wd->reboot_notifier.notifier_call = 
> rave_sp_wdt_reboot_notifier;
>294ret = devm_register_reboot_notifier(dev, 
> &sp_wd->reboot_notifier);
>295if (ret) {
>296dev_err(dev, "Failed to register reboot 
> notifier\n");
>297return ret;
>298}
>299
>300/*
>301 * We don't know if watchdog is running now. To be 
> sure, let's
>302 * start it and depend on watchdog core to ping it
>303 */
>304wdd->max_hw_heartbeat_ms = wdd->max_timeout * 1000;
>305ret = rave_sp_wdt_start(wdd);
>306if (ret) {
>307dev_err(dev, "Watchdog didn't start\n");
>308return ret;
>309}
>310
>311ret = devm_watchdog_register_device(dev, wdd);
>312if (ret) {
>313dev_err(dev, "Failed to register watchdog 
> device\n");
>314rave_sp_wdt_stop(wdd);
>315return ret;
>316}
>317
>318return 0;
>319}
>320
> 
> ---
> 0-DAY kernel test infrastructureOpen Source Technology Center
> https://lists.01.org/pipermail/kbuild-all   Intel Corporation



-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog