[PATCH 6/9] include: sbi: Remove cyclic include in sbi_domain_context.h

Anup Patel anup at brainfault.org
Wed Oct 9 22:22:40 PDT 2024


On Thu, Oct 10, 2024 at 4:45 AM Samuel Holland
<samuel.holland at sifive.com> wrote:
>
> Hi Anup,
>
> On 2024-09-23 6:56 AM, Anup Patel wrote:
> > The sbi_domain_context.h includes sbi_domain.h and the sbi_domain.h
> > also includes sbi_domain_context.h. Remove this cyclic include in
> > sbi_domain_context.h.
> >
> > Signed-off-by: Anup Patel <apatel at ventanamicro.com>
> > ---
> >  include/sbi/sbi_domain_context.h | 3 ++-
> >  lib/sbi/sbi_domain_context.c     | 2 +-
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/sbi/sbi_domain_context.h b/include/sbi/sbi_domain_context.h
> > index 0d25884a..3f43b622 100755
> > --- a/include/sbi/sbi_domain_context.h
> > +++ b/include/sbi/sbi_domain_context.h
> > @@ -9,7 +9,8 @@
> >
> >  #include <sbi/sbi_types.h>
> >  #include <sbi/sbi_trap.h>
> > -#include <sbi/sbi_domain.h>
> > +
> > +struct sbi_domain;
> >
> >  /** Context representation for a hart within a domain */
> >  struct sbi_context {
> > diff --git a/lib/sbi/sbi_domain_context.c b/lib/sbi/sbi_domain_context.c
> > index 1432e3a8..29e2d280 100755
> > --- a/lib/sbi/sbi_domain_context.c
> > +++ b/lib/sbi/sbi_domain_context.c
> > @@ -13,7 +13,7 @@
> >  #include <sbi/sbi_heap.h>
> >  #include <sbi/sbi_scratch.h>
> >  #include <sbi/sbi_string.h>
> > -#include <sbi/sbi_domain_context.h>
>
> We should keep this include, so the functions defined in this file are checked
> against their prototypes.

I dropped this include because it was already included through sbi_domain.h
but I don't mind keeping it. I will update.

>
> Regards,
> Samuel
>
> > +#include <sbi/sbi_domain.h>
> >
> >  /**
> >   * Switches the HART context from the current domain to the target domain.
>

Thanks,
Anup



More information about the opensbi mailing list