浏览代码

net: socket: use pr_info_once to tip the obsolete usage of PF_PACKET

There is no need to use the static variable here, pr_info_once is more
concise.

Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
liping.zhang 9 年之前
父节点
当前提交
f3c986908c
共有 1 个文件被更改,包括 2 次插入6 次删除
  1. 2 6
      net/socket.c

+ 2 - 6
net/socket.c

@@ -1107,12 +1107,8 @@ int __sock_create(struct net *net, int family, int type, int protocol,
 	   deadlock in module load.
 	 */
 	if (family == PF_INET && type == SOCK_PACKET) {
-		static int warned;
-		if (!warned) {
-			warned = 1;
-			pr_info("%s uses obsolete (PF_INET,SOCK_PACKET)\n",
-				current->comm);
-		}
+		pr_info_once("%s uses obsolete (PF_INET,SOCK_PACKET)\n",
+			     current->comm);
 		family = PF_PACKET;
 	}