From patchwork Fri Oct 23 15:47:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7473541 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7C7EE9F1C3 for ; Fri, 23 Oct 2015 15:48:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B31A2089D for ; Fri, 23 Oct 2015 15:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B06232086D for ; Fri, 23 Oct 2015 15:48:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752921AbbJWPrk (ORCPT ); Fri, 23 Oct 2015 11:47:40 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:36407 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751256AbbJWPri (ORCPT ); Fri, 23 Oct 2015 11:47:38 -0400 Received: by wicfx6 with SMTP id fx6so37061471wic.1 for ; Fri, 23 Oct 2015 08:47:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qiwPoyaY3+XMaeiwLaufphNYN4h1br7cm1LcjkdhGsQ=; b=VU1XlYTk+S3e3PDu9gXICMT4wGoAYE5XDaStulf5eIOQ5d6mtNZ+rtJWO+sZTGZoVE 1NOZv7u12y0GFknkzUQoA0c3vIVGABe02pCMdgYfc+g68TOhfT+l9pHyLPtcwqa5qtjF SgwrN8l6CWNa//WSxpbO1+CyDzBLKCDuZiNYzBmIzugGitiB3TureBS52Cf7w21w1tzK pmQKYhd/HdvX4K4nTjg5Sh1798X+wccCz2UHsUVS4sUAo0oDGO6hMx2s4D3GoE7+CIpU +YY6vSjz5gcA3Ya/S1QfCBf2wjMJaQlRcQJHXxxCGg9q0gFhH5010ZoAhZ7Z6Iae/Miu 0pfg== X-Gm-Message-State: ALoCoQmrs3iRTWsXshQV5CYIK+nwSc4w7ubnS96m9KzCeJc/8JP8vWCI6einuMvzRfyyC5jBLyZp X-Received: by 10.180.93.197 with SMTP id cw5mr5675941wib.53.1445615257165; Fri, 23 Oct 2015 08:47:37 -0700 (PDT) Received: from gnx2579.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id i3sm3388471wij.9.2015.10.23.08.47.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 08:47:36 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v4 3/7] vfio: platform: introduce module_vfio_reset_handler macro Date: Fri, 23 Oct 2015 17:47:21 +0200 Message-Id: <1445615245-31124-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445615245-31124-1-git-send-email-eric.auger@linaro.org> References: <1445615245-31124-1-git-send-email-eric.auger@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The module_vfio_reset_handler macro - define a module alias - implement module init/exit function which respectively registers and unregisters the reset function. Signed-off-by: Eric Auger Reviewed-by: Arnd Bergmann --- v3 -> v4: - pass reset to vfio_platform_unregister_reset v2 -> v3: - use vfio_platform_register_reset macro v1 -> v2: - remove vfio_platform_reset_private.h and move back the macro to vfio_platform_private.h header: removed reset_module_register & unregister (symbol_get) - defines the module_vfio_reset_handler macro as suggested by Arnd (formerly in vfio_platform_reset_private.h) --- drivers/vfio/platform/vfio_platform_private.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index c563940..fd262be 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h @@ -110,4 +110,18 @@ static struct vfio_platform_reset_node __reset ## _node = { \ }; \ __vfio_platform_register_reset(&__reset ## _node) +#define module_vfio_reset_handler(compat, reset) \ +MODULE_ALIAS("vfio-reset:" compat); \ +static int __init reset ## _module_init(void) \ +{ \ + vfio_platform_register_reset(compat, reset); \ + return 0; \ +}; \ +static void __exit reset ## _module_exit(void) \ +{ \ + vfio_platform_unregister_reset(compat, reset); \ +}; \ +module_init(reset ## _module_init); \ +module_exit(reset ## _module_exit) + #endif /* VFIO_PLATFORM_PRIVATE_H */