pkarashchenko commented on code in PR #10338:
URL: https://github.com/apache/nuttx/pull/10338#discussion_r1303460122
##########
include/nuttx/list.h:
##########
@@ -101,6 +101,17 @@
#define list_last_entry(list, type, member) \
list_entry((list)->prev, type, member)
+#define list_next_entry(list, type, member) \
Review Comment:
@xiaoxiang781216 despite I've just merged
https://github.com/apache/nuttx/pull/10357 I have a doubts about it. Really it
makes me feel that some of this macro definitions are copied from Linux.
In one of the comments I'm reading
> I have rewrite the code, and it is not same as any code, Both Linux and
freebsd.
I found the Linux variant, but failed to find FreeBSD variant. It would be
helpful if the link to FreeBSP file can be a part of a description.
I will post my thoughts here:
1. When I look into NuttX `list.h` back in history I see some small
differences like NuttX variant use `for_every` while Linux variant use
`for_each`. Those differences are small, but still seems to be significant.
Also Linux variant use `list_entry` in many macro like
`list_for_each_entry_continue` (like here) while NuttX variant use
`container_of((list)->next, type, member)` directly (in `list_for_every_entry`).
2. In `bam43xxx` folder I see things like
```
iframe = list_remove_head_type(&gbus->tx_queue,
bcmf_interface_frame_t,
list_entry);
...
struct list_node list_entry;
...
list_add_tail(&ibus->rx_queue, &iframe->list_entry);
```
I also see that it includes `#include <nuttx/list.h>`, so I have two
questions/observations:
- Seems like `bcm43xxx` is not tested by CI
- How is this going to co-exist with `#define list_entry(ptr, type, member)
container_of(ptr, type, member)`? I would expect pre-processor errors on code
above.
Currently I do not see a real use-case for `list_entry` and
`list_last_entry` based on above. I see that `list_first_entry` is used in
`void task_uninit_info(FAR struct task_group_s *group)` so wee can keep it, but
implement via `#define list_first_entry(list, type, member)
container_of((list)->next, type, member)`.
What are your thoughts here @yamt @patacongo @jerpelea @acassis ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]