From patchwork Sat Oct 6 20:09:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 1559381 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A8F9FDFFEE for ; Sat, 6 Oct 2012 20:15:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756828Ab2JFUPq (ORCPT ); Sat, 6 Oct 2012 16:15:46 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:42316 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284Ab2JFUPm (ORCPT ); Sat, 6 Oct 2012 16:15:42 -0400 Received: by mail-qc0-f174.google.com with SMTP id d3so1917229qch.19 for ; Sat, 06 Oct 2012 13:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:reply-to:organization; bh=DgFTB7rtz41jejPoYwQ9rWt8pvwRH092zU5BdJ39r3o=; b=MLj+/0ikeh+HgF/vJLbkm4gXQe35Q63pKj5o6Yffqgltrm+y6ho2AamIXgY+Vc4WNZ yj1yRnTuxQbjBy9zA4dGl2xw1spkCB+89mIDTd4dcLTPcObOv0EJ5tswEQbPpTmdZHlb eCG4LFlKfa6lWnfJaIcjOjCRMKpHWH6DBkWheNXxKwT4J9LNMOtTNWjCmhjpu5JJoDDM rfZtSGMoRZxV19jPEWkuvBEAw/GnJbCsfyUct02ugTszKqyTsDN9O2ZXcVTIePRVlXOY LTe2l0mTwLsdpMTTciG0VhpcshblWttaodl2tUTf4CAmI+PtdeeyNzn67Llu7s1IWRlW szxw== Received: by 10.229.136.81 with SMTP id q17mr5060743qct.115.1349554542303; Sat, 06 Oct 2012 13:15:42 -0700 (PDT) Received: from x980.localdomain6 (pool-74-104-146-186.bstnma.fios.verizon.net. [74.104.146.186]) by mx.google.com with ESMTPS id x19sm13470740qeq.12.2012.10.06.13.15.28 (version=SSLv3 cipher=OTHER); Sat, 06 Oct 2012 13:15:35 -0700 (PDT) From: Len Brown To: linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mika Westerberg , Len Brown Subject: [PATCH 19/49] ACPI: introduce module_acpi_driver() helper macro Date: Sat, 6 Oct 2012 16:09:40 -0400 Message-Id: <0d2cf8f5aab358c897902ebad40fa4edd1b4556e.1349554106.git.len.brown@intel.com> X-Mailer: git-send-email 1.8.0.rc0.18.gf84667d In-Reply-To: <1349554210-29978-1-git-send-email-lenb@kernel.org> References: <1349554210-29978-1-git-send-email-lenb@kernel.org> In-Reply-To: References: Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Mika Westerberg 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 Signed-off-by: Len Brown --- 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 */