Thread (30 messages) 30 messages, 6 authors, 2017-07-23

RE: [PATCH V3 net-next 2/8] net: hns3: Add support of the HNAE3 framework

From: Salil Mehta <hidden>
Date: 2017-07-22 23:30:26
Also in: lkml

Hi Andrew,
-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Saturday, June 17, 2017 8:46 PM
To: Salil Mehta
Cc: davem@davemloft.net; Zhuangyuzeng (Yisen); huangdaode; lipeng (Y);
mehta.salil.lnk@gmail.com; netdev@vger.kernel.org; linux-
kernel@vger.kernel.org; Linuxarm
Subject: Re: [PATCH V3 net-next 2/8] net: hns3: Add support of the
HNAE3 framework
quoted
+static void hnae3_list_add(spinlock_t *lock, struct list_head *node,
+			   struct list_head *head)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(lock, flags);
+	list_add_tail(node, head);
+	spin_unlock_irqrestore(lock, flags);
+}
+
+static void hnae3_list_del(spinlock_t *lock, struct list_head *node)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(lock, flags);
+	list_del(node);
+	spin_unlock_irqrestore(lock, flags);
+}
+
quoted
+int hnae3_register_client(struct hnae3_client *client)
+{
+	struct hnae3_client *client_tmp;
+	struct hnae3_ae_dev *ae_dev;
+	int ret;
+
+	/* One system should only have one client for every type */
+	list_for_each_entry(client_tmp, &hnae3_client_list, node) {
+		if (client_tmp->type == client->type)
+			return 0;
+	}
+
+	hnae3_list_add(&hnae3_list_client_lock, &client->node,
+		       &hnae3_client_list);
Please could you explain your locking scheme. I don't get it.

       Thanks
	Andrew
Locking scheme has been fixed in the V4 patch. Please review it.

Thanks
Salil
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help