[PATCH 2/2] event: Guard more of the prototypes with an EVENT check

Tom Rini trini at konsulko.com
Tue May 19 21:59:39 CEST 2026


On Tue, May 19, 2026 at 01:10:54PM -0600, Tom Rini wrote:
> On Tue, May 19, 2026 at 12:28:56PM -0600, Tom Rini wrote:
> 
> > To make sure we cannot encounter the case where code is written to use
> > the event framework, but EVENT is not enabled, guard most of the header
> > with a build-time check. This will promote the case in question to a
> > build time failure and not a runtime debug issue.
> > 
> > Signed-off-by: Tom Rini <trini at konsulko.com>
> > ---
> >  include/event.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/include/event.h b/include/event.h
> > index 3ce5f992b04e..71fb14391f25 100644
> > --- a/include/event.h
> > +++ b/include/event.h
> > @@ -308,6 +308,7 @@ static inline const char *event_spy_id(struct evspy_info *spy)
> >  #endif
> >  }
> >  
> > +#ifdef CONFIG_EVENT
> >  /*
> >   * It seems that LTO will drop list entries if it decides they are not used,
> >   * although the conditions that cause this are unclear.
> > @@ -348,6 +349,7 @@ static inline const char *event_spy_id(struct evspy_info *spy)
> >  	__used ll_entry_declare(struct evspy_info_simple, \
> >  		_type ## _3_ ## _func, \
> >  		evspy_info) = _ESPY_REC_SIMPLE(_type, _func)
> > +#endif
> >  
> >  /**
> >   * event_register - register a new spy
> 
> This was really my v0 of the changes, I have made this more general and
> will post a v2, of what I had intended, shortly.

On further testing, I'm going to stick with this version, trying to
guard more of the file would require a larger restructure to avoid
other compilation problems (the header being perhaps too broadly
included, CONFIG_IS_ENABLED(...) checks, and so forth).

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260519/f47431b3/attachment.sig>


More information about the U-Boot mailing list