From patchwork Fri Oct 23 12:37:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7472891 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 A754E9F36A for ; Fri, 23 Oct 2015 12:39:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C78E3209A9 for ; Fri, 23 Oct 2015 12:39:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E701820999 for ; Fri, 23 Oct 2015 12:39:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753000AbbJWMh3 (ORCPT ); Fri, 23 Oct 2015 08:37:29 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:38253 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752764AbbJWMh1 (ORCPT ); Fri, 23 Oct 2015 08:37:27 -0400 Received: by wicll6 with SMTP id ll6so29616713wic.1 for ; Fri, 23 Oct 2015 05:37:26 -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=VvtYj/n4OJIRdnSaxImvm5sPU7SYcKeZO6144N1lhM0=; b=mD77A510VbD2dckgq5FAXLp0xGTLAyITs4ZkucegatKi9wx1uHWOlAjkUpBEffBG9M cAgXnUdA4bcPAicvJyMR2f0mvRoyZ9JCkt24JuWZuR16OzlMXg3RrNV2nN5AHg187GYp mdFt/auHtY4NbdTqofVPXS0w6qCXjBVsC5+Gnw7FzS4dwUEmnGUCh/d8JPi7/ctR98cX FXNIuEIwJbYRN7LcKzYo2Tlz0qquWZYcTpG2z949c3hugQoJzMsWDm2hpYdzYLm5mdda P1ZM6qsbxXjOHvei4FtCG6ORWYhrYsFS2hV9T7//gXlOVXClPbBoLlFUry0RbugvYm9Y 7D/w== X-Gm-Message-State: ALoCoQmxj5ItEuWGoxOn1dGhnWivzau6JsmhH7QJYSMe1n6K1D5PhQqqnh9O7qeG491j6ogUjGFQ X-Received: by 10.180.91.40 with SMTP id cb8mr2739138wib.14.1445603846173; Fri, 23 Oct 2015 05:37:26 -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 s16sm2837652wik.16.2015.10.23.05.37.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 05:37:25 -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 v3 3/7] vfio: platform: introduce module_vfio_reset_handler macro Date: Fri, 23 Oct 2015 14:37:11 +0200 Message-Id: <1445603835-14506-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445603835-14506-1-git-send-email-eric.auger@linaro.org> References: <1445603835-14506-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 --- 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 277521a..5a1e8e6 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); \ +}; \ +module_init(reset ## _module_init); \ +module_exit(reset ## _module_exit) + #endif /* VFIO_PLATFORM_PRIVATE_H */