From patchwork Fri Dec 11 03:04:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 66409 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nBB34aB6013532 for ; Fri, 11 Dec 2009 03:04:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752840AbZLKDE1 (ORCPT ); Thu, 10 Dec 2009 22:04:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752099AbZLKDE1 (ORCPT ); Thu, 10 Dec 2009 22:04:27 -0500 Received: from mga02.intel.com ([134.134.136.20]:5797 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585AbZLKDE1 (ORCPT ); Thu, 10 Dec 2009 22:04:27 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 10 Dec 2009 19:03:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,378,1257148800"; d="scan'208";a="577684814" Received: from sli10-conroe.sh.intel.com (HELO sli10-desk.sh.intel.com) ([10.239.13.36]) by orsmga001.jf.intel.com with ESMTP; 10 Dec 2009 19:04:15 -0800 Received: from david by sli10-desk.sh.intel.com with local (Exim 4.69) (envelope-from ) id 1NIvnz-00021b-OR; Fri, 11 Dec 2009 11:04:31 +0800 Date: Fri, 11 Dec 2009 11:04:31 +0800 From: Shaohua Li To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: mingo@elte.hu, akpm@linux-foundation.org, lenb@kernel.org Subject: [PATCH 1/2]workqueue:introduce INIT_WORK_KEY() Message-ID: <20091211030431.GA7772@sli10-desk.sh.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Index: linux/include/linux/workqueue.h =================================================================== --- linux.orig/include/linux/workqueue.h 2009-12-10 10:14:56.000000000 +0800 +++ linux/include/linux/workqueue.h 2009-12-10 10:39:30.000000000 +0800 @@ -99,15 +99,20 @@ struct execute_work { * to generate better code. */ #ifdef CONFIG_LOCKDEP -#define INIT_WORK(_work, _func) \ +#define INIT_WORK_KEY(_work, _func, _key, _key_name) \ do { \ - static struct lock_class_key __key; \ - \ (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ - lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\ + lockdep_init_map(&(_work)->lockdep_map, _key_name, \ + &_key, 0); \ INIT_LIST_HEAD(&(_work)->entry); \ PREPARE_WORK((_work), (_func)); \ } while (0) + +#define INIT_WORK(_work, _func) \ + do { \ + static struct lock_class_key __key; \ + INIT_WORK_KEY(_work, _func, __key, #_work); \ + } while (0) #else #define INIT_WORK(_work, _func) \ do { \ @@ -115,6 +120,9 @@ struct execute_work { INIT_LIST_HEAD(&(_work)->entry); \ PREPARE_WORK((_work), (_func)); \ } while (0) + +#define INIT_WORK_KEY(_work, _func, _key, _key_name) \ + INIT_WORK(_work, _func) #endif #define INIT_DELAYED_WORK(_work, _func) \