Linux-RTC Archive on lore.kernel.org
 help / color / Atom feed
From: "Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com>
To: "arnd@arndb.de" <arnd@arndb.de>
Cc: "linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>,
	"a.zummo@towertech.it" <a.zummo@towertech.it>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	"lee.jones@linaro.org" <lee.jones@linaro.org>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>
Subject: Re: [PATCH] rtc: bd70528: fix link error
Date: Tue, 9 Jul 2019 05:25:50 +0000
Message-ID: <e1687224a155787d9f3c042dca1c03a81b89ed25.camel@fi.rohmeurope.com> (raw)
In-Reply-To: <CAK8P3a1HNnstePcreH-ZLyiJi3tNcCNJ=VozZUMnp-VLvYLSaA@mail.gmail.com>

Hello Arnd,

(Added Randy who also sent a patch to fix this)

On Mon, 2019-07-08 at 18:10 +0200, Arnd Bergmann wrote:
> On Mon, Jul 8, 2019 at 3:24 PM Vaittinen, Matti
> <Matti.Vaittinen@fi.rohmeurope.com> wrote:
> 
> > On Mon, 2019-07-08 at 14:41 +0200, Arnd Bergmann wrote:
> > > With CONFIG_BD70528_WATCHDOG=m, a built-in rtc driver cannot call
> > > into the low-level functions that are part of the watchdog
> > > module:
> > > 
> > > drivers/rtc/rtc-bd70528.o: In function `bd70528_set_time':
> > > rtc-bd70528.c:(.text+0x22c): undefined reference to
> > > `bd70528_wdt_lock'
> > > rtc-bd70528.c:(.text+0x2a8): undefined reference to
> > > `bd70528_wdt_unlock'
> > > drivers/rtc/rtc-bd70528.o: In function
> > > `bd70528_set_rtc_based_timers':
> > > rtc-bd70528.c:(.text+0x50c): undefined reference to
> > > `bd70528_wdt_set'
> > > 
> > > Add a Kconfig dependency on this driver, but still allow compile-
> > > testing
> > > without it.
> > > 
> > > Fixes: 32a4a4ebf768 ("rtc: bd70528: Initial support for ROHM
> > > bd70528
> > > RTC")
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > > ---
> > >  drivers/rtc/Kconfig | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> > > index 3bfc04a86529..7b071cc74422 100644
> > > --- a/drivers/rtc/Kconfig
> > > +++ b/drivers/rtc/Kconfig
> > > @@ -498,8 +498,10 @@ config RTC_DRV_M41T80_WDT
> > >       help
> > >         If you say Y here you will get support for the
> > >         watchdog timer in the ST M41T60 and M41T80 RTC chips
> > > series.
> > > +
> > >  config RTC_DRV_BD70528
> > >       tristate "ROHM BD70528 PMIC RTC"
> > > +     depends on BD70528_WATCHDOG || (COMPILE_TEST &&
> > > !BD70528_WATCHDOG)
> > 
> > I am not fan of this. There may well be use-cases where it is
> > desirable
> > to leave the watchdog out but still compile in the RTC. This is why
> > we
> > have static inline stubs in the header for cases where WDG is not
> > compiled in. (RTC does not need to stop WDG if WDG driver is not
> > included)
> > 
> > Adding dependency from RTC to MFD for BD70528 should be done - this
> > will avoid most of the issues (And there has been few patches sent
> > for
> > this already). But that's still not complete solution because
> > configuring RTC and MFD to be built in-kernel and WDG as a module
> > will
> > cause errors again.
> > 
> > Is there a way to force WDG in-kernel if RTC is in-kernel? (Or
> > disallow configuring RTC in-kernel if WDG is a module - while still
> > allow RTC to be built without WDG?
> 
> We could make this
> 
>         depends on BD70528_WATCHDOG || !BD70528_WATCHDOG
> 
> which would allow building with or without watchdog, even when not
> compile-testing, but still disallow the combination of
> .

Thanks for teaching me Arnd! That is clever :) We need something like

depends on MFD_ROHM_BD70528 && (BD70528_WATCHDOG || !BD70528_WATCHDOG)

(I'm not sure if parenthesis are Ok and respected in Kconfig). I would
never have thought of BD70528_WATCHDOG || !BD70528_WATCHDOG - it looks
awkward at first sight but indeed - depends on BD70528_WATCHDOG
disallows BD70528_WATCHDOG=m with RTC_DRV_BD70528=y while
!BD70528_WATCHDOG allows BD70528_WATCHDOG=n. Brilliant and exactly what
we need :) Thanks a bunch!

> 
>        Arnd

      reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 12:41 Arnd Bergmann
2019-07-08 13:24 ` Vaittinen, Matti
2019-07-08 16:10   ` Arnd Bergmann
2019-07-09  5:25     ` Vaittinen, Matti [this message]

Reply instructions:

You may reply publically 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=e1687224a155787d9f3c042dca1c03a81b89ed25.camel@fi.rohmeurope.com \
    --to=matti.vaittinen@fi.rohmeurope.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=rdunlap@infradead.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

Linux-RTC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rtc/0 linux-rtc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rtc linux-rtc/ https://lore.kernel.org/linux-rtc \
		linux-rtc@vger.kernel.org linux-rtc@archiver.kernel.org
	public-inbox-index linux-rtc


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rtc


AGPL code for this site: git clone https://public-inbox.org/ public-inbox