Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Mar 2017 18:37:17 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314971 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201703091837.v29IbHw7092620@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Mar  9 18:37:17 2017
New Revision: 314971
URL: https://svnweb.freebsd.org/changeset/base/314971

Log:
  Fix implementation of the DECLARE_WORK() macro in the LinuxKPI to fully
  initialize the declared work structure and not only the function callback
  pointer.
  
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/workqueue.h

Modified: head/sys/compat/linuxkpi/common/include/linux/workqueue.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/workqueue.h	Thu Mar  9 18:33:40 2017	(r314970)
+++ head/sys/compat/linuxkpi/common/include/linux/workqueue.h	Thu Mar  9 18:37:17 2017	(r314971)
@@ -72,8 +72,13 @@ struct work_struct {
 	atomic_t state;
 };
 
-#define	DECLARE_WORK(name, fn) \
-	struct work_struct name = { .func = (fn) }
+#define	DECLARE_WORK(name, fn)						\
+	struct work_struct name;					\
+	static void name##_init(void *arg)				\
+	{								\
+		INIT_WORK(&name, fn);					\
+	}								\
+	SYSINIT(name, SI_SUB_LOCK, SI_ORDER_SECOND, name##_init, NULL)
 
 struct delayed_work {
 	struct work_struct work;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703091837.v29IbHw7092620>