From patchwork Fri Sep 7 07:31:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 1420281 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0863A40AB4 for ; Fri, 7 Sep 2012 07:30:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756966Ab2IGH3a (ORCPT ); Fri, 7 Sep 2012 03:29:30 -0400 Received: from mga09.intel.com ([134.134.136.24]:20167 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756632Ab2IGH33 (ORCPT ); Fri, 7 Sep 2012 03:29:29 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 07 Sep 2012 00:29:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,384,1344236400"; d="scan'208";a="189978677" Received: from lahna.fi.intel.com ([10.237.72.166]) by orsmga001.jf.intel.com with ESMTP; 07 Sep 2012 00:29:24 -0700 Received: from westeri by lahna.fi.intel.com with local (Exim 4.77) (envelope-from ) id 1T9t2c-00070P-Cm; Fri, 07 Sep 2012 10:31:50 +0300 From: Mika Westerberg To: lenb@kernel.org Cc: rui.zhang@intel.com, khali@linux-fr.org, ben-linux@fluff.org, w.sang@pengutronix.de, dmitry.torokhov@gmail.com, eric.piel@tremplin-utc.net, mjg@redhat.com, ike.pan@canonical.com, herton@canonical.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Mika Westerberg Subject: [PATCH RESEND 01/12] ACPI: introduce module_acpi_driver() helper macro Date: Fri, 7 Sep 2012 10:31:38 +0300 Message-Id: <1347003109-26887-2-git-send-email-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1347003109-26887-1-git-send-email-mika.westerberg@linux.intel.com> References: <1347003109-26887-1-git-send-email-mika.westerberg@linux.intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add a helper macro module_acpi_driver() which reduces the boilerplate code for ACPI drivers. This is similar what is done for other busses (PCI, SPI, I2C etc). Signed-off-by: Mika Westerberg --- include/acpi/acpi_bus.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index bde976e..bddd909 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -381,6 +381,19 @@ int acpi_match_device_ids(struct acpi_device *device, int acpi_create_dir(struct acpi_device *); void acpi_remove_dir(struct acpi_device *); + +/** + * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver + * @__acpi_driver: acpi_driver struct + * + * Helper macro for ACPI drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit() + */ +#define module_acpi_driver(__acpi_driver) \ + module_driver(__acpi_driver, acpi_bus_register_driver, \ + acpi_bus_unregister_driver) + /* * Bind physical devices with ACPI devices */