Message ID | 20210319221305.2138412-7-atish.patra@wdc.com |
---|---|
State | Superseded |
Headers | show |
Series | SBI PMU extension support | expand |
> -----Original Message----- > From: Atish Patra <atish.patra@wdc.com> > Sent: 20 March 2021 03:43 > To: opensbi@lists.infradead.org > Cc: Atish Patra <Atish.Patra@wdc.com>; Anup Patel <Anup.Patel@wdc.com> > Subject: [RFC 06/14] include: Add a list empty check function > > Implement a list helper function that checks for empty lists. > > Signed-off-by: Atish Patra <atish.patra@wdc.com> Looks good to me. Reviewed-by: Anup Patel <anup.patel@wdc.com> Regards, Anup > --- > include/sbi/sbi_list.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/include/sbi/sbi_list.h b/include/sbi/sbi_list.h index > 1174ad274c54..b1178dfc9b8e 100644 > --- a/include/sbi/sbi_list.h > +++ b/include/sbi/sbi_list.h > @@ -43,6 +43,17 @@ static inline void __sbi_list_add(struct sbi_dlist *new, > next->prev = new; > } > > +/** > + * Checks if the list is empty or not. > + * @param head List head > + * > + * Retruns TRUE if list is empty, FALSE otherwise. > + */ > +static inline bool sbi_list_empty(struct sbi_dlist *head) { > + return head->next == head; > +} > + > /** > * Adds the new node after the given head. > * @param new New node that needs to be added to list. > -- > 2.25.1
在 2021-03-19五的 15:12 -0700,Atish Patra写道: > Implement a list helper function that checks for empty lists. > > Signed-off-by: Atish Patra <atish.patra@wdc.com> Looks good to me. Reviewed-by: Xiang W <wxjstz@126.com> Regards, Xiang W > --- > include/sbi/sbi_list.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/include/sbi/sbi_list.h b/include/sbi/sbi_list.h > index 1174ad274c54..b1178dfc9b8e 100644 > --- a/include/sbi/sbi_list.h > +++ b/include/sbi/sbi_list.h > @@ -43,6 +43,17 @@ static inline void __sbi_list_add(struct sbi_dlist > *new, > next->prev = new; > } > > +/** > + * Checks if the list is empty or not. > + * @param head List head > + * > + * Retruns TRUE if list is empty, FALSE otherwise. > + */ > +static inline bool sbi_list_empty(struct sbi_dlist *head) > +{ > + return head->next == head; > +} > + > /** > * Adds the new node after the given head. > * @param new New node that needs to be added to list. > -- > 2.25.1 > >
diff --git a/include/sbi/sbi_list.h b/include/sbi/sbi_list.h index 1174ad274c54..b1178dfc9b8e 100644 --- a/include/sbi/sbi_list.h +++ b/include/sbi/sbi_list.h @@ -43,6 +43,17 @@ static inline void __sbi_list_add(struct sbi_dlist *new, next->prev = new; } +/** + * Checks if the list is empty or not. + * @param head List head + * + * Retruns TRUE if list is empty, FALSE otherwise. + */ +static inline bool sbi_list_empty(struct sbi_dlist *head) +{ + return head->next == head; +} + /** * Adds the new node after the given head. * @param new New node that needs to be added to list.
Implement a list helper function that checks for empty lists. Signed-off-by: Atish Patra <atish.patra@wdc.com> --- include/sbi/sbi_list.h | 11 +++++++++++ 1 file changed, 11 insertions(+)