summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorDuoming Zhou <duoming@zju.edu.cn>2024-05-09 11:36:33 +0200
committerJakub Kicinski <kuba@kernel.org>2024-05-14 01:09:38 +0200
commita7d6e36b9ad052926ba2ecba3a59d8bb67dabcb4 (patch)
tree87e77f1b8faedbce60e03a092e63dff26c2bb340 /include/net
parentnet: usb: ax88179_178a: fix link status when link is set to down/up (diff)
downloadlinux-a7d6e36b9ad052926ba2ecba3a59d8bb67dabcb4.tar.xz
linux-a7d6e36b9ad052926ba2ecba3a59d8bb67dabcb4.zip
ax25: Use kernel universal linked list to implement ax25_dev_list
The origin ax25_dev_list implements its own single linked list, which is complicated and error-prone. For example, when deleting the node of ax25_dev_list in ax25_dev_device_down(), we have to operate on the head node and other nodes separately. This patch uses kernel universal linked list to replace original ax25_dev_list, which make the operation of ax25_dev_list easier. We should do "dev->ax25_ptr = ax25_dev;" and "dev->ax25_ptr = NULL;" while holding the spinlock, otherwise the ax25_dev_device_up() and ax25_dev_device_down() could race. Suggested-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Duoming Zhou <duoming@zju.edu.cn> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/85bba3af651ca0e1a519da8d0d715b949891171c.1715247018.git.duoming@zju.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ax25.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 0d939e5aee4e..c2a85fd3f5ea 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -216,7 +216,7 @@ typedef struct {
struct ctl_table;
typedef struct ax25_dev {
- struct ax25_dev *next;
+ struct list_head list;
struct net_device *dev;
netdevice_tracker dev_tracker;
@@ -330,7 +330,6 @@ int ax25_addr_size(const ax25_digi *);
void ax25_digi_invert(const ax25_digi *, ax25_digi *);
/* ax25_dev.c */
-extern ax25_dev *ax25_dev_list;
extern spinlock_t ax25_dev_lock;
#if IS_ENABLED(CONFIG_AX25)