Skip to contentSkip to conversation

Documentation/connector/cn_test.c remove unused cn_test_want_notify()

PATCH In review Jaswinder Singh Rajput 2 participants 5 messages May 20, 2009 – May 27, 2009 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation/connector/cn_test.c remove unused cn_test_want_notify()

Currently cn_test_want_notify() is not having any user.

---
 Documentation/connector/cn_test.c |   77 -------------------------------------
 1 files changed, 0 insertions(+), 77 deletions(-)
Documentation/connector/cn_test.c +0 -77
index 6977c17..e12d9d7 100644
@@ -41,83 +41,6 @@ void cn_test_callback(void *data)
 	       msg->seq, msg->ack, msg->len, (char *)msg->data);
 }
 
-static int cn_test_want_notify(void)
-{
-	struct cn_ctl_msg *ctl;
-	struct cn_notify_req *req;
-	struct cn_msg *msg = NULL;
-	int size, size0;
-	struct sk_buff *skb;
-	struct nlmsghdr *nlh;
-	u32 group = 1;
-
-	size0 = sizeof(*msg) + sizeof(*ctl) + 3 * sizeof(*req);
-
-	size = NLMSG_SPACE(size0);
-
-	skb = alloc_skb(size, GFP_ATOMIC);
-	if (!skb) {
-		printk(KERN_ERR "Failed to allocate new skb with size=%u.\n",
-		       size);
-
-		return -ENOMEM;
-	}
-
-	nlh = NLMSG_PUT(skb, 0, 0x123, NLMSG_DONE, size - sizeof(*nlh));
-
-	msg = (struct cn_msg *)NLMSG_DATA(nlh);
-
-	memset(msg, 0, size0);
-
-	msg->id.idx = -1;
-	msg->id.val = -1;
-	msg->seq = 0x123;
-	msg->ack = 0x345;
-	msg->len = size0 - sizeof(*msg);
-
-	ctl = (struct cn_ctl_msg *)(msg + 1);
-
-	ctl->idx_notify_num = 1;
-	ctl->val_notify_num = 2;
-	ctl->group = group;
-	ctl->len = msg->len - sizeof(*ctl);
-
-	req = (struct cn_notify_req *)(ctl + 1);
-
-	/*
-	 * Idx.
-	 */
-	req->first = cn_test_id.idx;
-	req->range = 10;
-
-	/*
-	 * Val 0.
-	 */
-	req++;
-	req->first = cn_test_id.val;
-	req->range = 10;
-
-	/*
-	 * Val 1.
-	 */
-	req++;
-	req->first = cn_test_id.val + 20;
-	req->range = 10;
-
-	NETLINK_CB(skb).dst_group = ctl->group;
-	//netlink_broadcast(nls, skb, 0, ctl->group, GFP_ATOMIC);
-	netlink_unicast(nls, skb, 0, 0);
-
-	printk(KERN_INFO "Request was sent. Group=0x%x.\n", ctl->group);
-
-	return 0;
-
-nlmsg_failure:
-	printk(KERN_ERR "Failed to send %u.%u\n", msg->seq, msg->ack);
-	kfree_skb(skb);
-	return -EINVAL;
-}
-
 static u32 cn_test_timer_counter;
 static void cn_test_timer_func(unsigned long __data)
 {
Signature · 1 line
1.6.1.1
#1 lore raw
Quoted 2 lines · Jaswinder Singh Rajput

Currently cn_test_want_notify() is not having any user.

Do not remove it, disable with ifdef if you want, it is an example of how to get notifications about new connector user registration.

Signature · 1 line
	Evgeniy Polyakov
#2 lore raw
Quoted 7 lines · Evgeniy Polyakov
Quoted 2 lines · Jaswinder Singh Rajput

Currently cn_test_want_notify() is not having any user.

Do not remove it, disable with ifdef if you want, it is an example of how to get notifications about new connector user registration.

[PATCH -tip] Documentation/connector/cn_test.c comment unused cn_test_want_notify()

Currently cn_test_want_notify() is not having any user.

So adding ifdef and comment which tells to not remove it.

---
 Documentation/connector/cn_test.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Documentation/connector/cn_test.c +7 -0
index 6977c17..f688eba 100644
@@ -41,6 +41,12 @@ void cn_test_callback(void *data)
 	       msg->seq, msg->ack, msg->len, (char *)msg->data);
 }
 
+/*
+ * Do not remove this function even if no one is using it as
+ * this is an example of how to get notifications about new
+ * connector user registration
+ */
+#if 0
 static int cn_test_want_notify(void)
 {
 	struct cn_ctl_msg *ctl;
@@ -117,6 +123,7 @@ nlmsg_failure:
 	kfree_skb(skb);
 	return -EINVAL;
 }
+#endif
 
 static u32 cn_test_timer_counter;
 static void cn_test_timer_func(unsigned long __data)
Signature · 1 line
1.6.0.6
#3 lore raw
Quoted 7 lines · Jaswinder Singh Rajput

[PATCH -tip] Documentation/connector/cn_test.c comment unused cn_test_want_notify()

Currently cn_test_want_notify() is not having any user.

So adding ifdef and comment which tells to not remove it.

Looks good, thank you Jaswinder.
Ack.

Signature · 1 line
	Evgeniy Polyakov
#4 lore raw
In reply to Jaswinder Singh Rajput

Hello Andrew,

If you want, you can also apply this patch along with another Documentation patch.

And also add ACK from Evgeniy Polyakov <[email protected]>

Thanks,
--
JSR

Quoted 45 lines · Jaswinder Singh Rajput
Quoted 7 lines · Evgeniy Polyakov
Quoted 2 lines · Jaswinder Singh Rajput

Currently cn_test_want_notify() is not having any user.

Do not remove it, disable with ifdef if you want, it is an example of how to get notifications about new connector user registration.

[PATCH -tip] Documentation/connector/cn_test.c comment unused cn_test_want_notify()

Currently cn_test_want_notify() is not having any user.

So adding ifdef and comment which tells to not remove it.

---
 Documentation/connector/cn_test.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Documentation/connector/cn_test.c +7 -0
index 6977c17..f688eba 100644
@@ -41,6 +41,12 @@ void cn_test_callback(void *data)
 	       msg->seq, msg->ack, msg->len, (char *)msg->data);
 }
 
+/*
+ * Do not remove this function even if no one is using it as
+ * this is an example of how to get notifications about new
+ * connector user registration
+ */
+#if 0
 static int cn_test_want_notify(void)
 {
 	struct cn_ctl_msg *ctl;
@@ -117,6 +123,7 @@ nlmsg_failure:
 	kfree_skb(skb);
 	return -EINVAL;
 }
+#endif
 
 static u32 cn_test_timer_counter;
 static void cn_test_timer_func(unsigned long __data)