From patchwork Wed Oct 28 13:02:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7510241 Return-Path: X-Original-To: patchwork-linux-arm@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 772FE9F40A for ; Wed, 28 Oct 2015 13:05:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9723F20686 for ; Wed, 28 Oct 2015 13:05:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A20E120685 for ; Wed, 28 Oct 2015 13:05:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZrQOX-0006hj-0I; Wed, 28 Oct 2015 13:04:01 +0000 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZrQNn-0006Pm-LF for linux-arm-kernel@lists.infradead.org; Wed, 28 Oct 2015 13:03:17 +0000 Received: by wicfx6 with SMTP id fx6so197447940wic.1 for ; Wed, 28 Oct 2015 06:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AqxxsIqG//NLpMx5REvUZSzkSwQ05IXiZioVFSuot7A=; b=BSTp3hQzt7CjHbiG8ut//xEychEiMgYIJ11KFixGLcW7AdvEXSXyGXd5a1ddylChwD aquHZNE8m4le4NYrSG5J4WHJmkez/5N+1m8jPT7u4RcwxLnSzlCWaCN73eWYVQnHW2wx HMVcg4CEZGY3D6zbJ2e1I704SBSL+oAPhja+Ms8a9zYWOi4qQg7spMa+mkWnAzKAWBQB 6JYBbSIDcfdoiF6/+DlzgPIdflRbpn67370HehYWTLdNjxeA50+3gp53nZ3zA3biQUTz KFjyDiaIeH41Po8d1MtmLiQY6w5z2iEo/0E1mawLw12pMpHGEkxll1sbBQhGqWISVgXb QFcA== 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=AqxxsIqG//NLpMx5REvUZSzkSwQ05IXiZioVFSuot7A=; b=WUDR+mYbRlR0N/jfXLsmf72eKiZbBNMr162nwAHNp9v+QwyLHzt2t0DVG7BuEoFzMB va5IHmKPcR2pvbYn1T/3jmc4wjSd+Nml7ny+EKkwT4pmTrn1lbR8J/RAFjmAHjbNWQH+ OFaJu7mwDt9cHmYLt5q57TfQeq8NY19PFmbYpy7dg17s/2FZcPe4CJJLckeqE1dpozAP SG7MJbWqxaAvpepwWfkO7X8vdXYmXcrZdcAiy2Air/OWWg1unBOEsS2eAxNNTL99Sa19 mGpC7LXgceOjkhPyAXfMkd42Rd0djtCV8ZZDLJdxVA7LPFpE0VZXGsg7F91bpLerj4w4 +nbw== X-Gm-Message-State: ALoCoQl000BrgKPjaOD8PS8XfH19eIbTpl0Rw9Df9wCIGP04JUZ4DHgLEIkfviajrrEGNknk6cRY X-Received: by 10.180.74.80 with SMTP id r16mr2864266wiv.88.1446037373786; Wed, 28 Oct 2015 06:02:53 -0700 (PDT) Received: from new-host-2.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id gl9sm49894196wjb.10.2015.10.28.06.02.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Oct 2015 06:02:52 -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 Subject: [PATCH v5 3/7] vfio: platform: introduce module_vfio_reset_handler macro Date: Wed, 28 Oct 2015 13:02:34 +0000 Message-Id: <1446037358-2079-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446037358-2079-1-git-send-email-eric.auger@linaro.org> References: <1446037358-2079-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151028_060315_967397_1F83A0BF X-CRM114-Status: GOOD ( 11.78 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, christoffer.dall@linaro.org, patches@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 --- v4 -> v5: - add Arnd's R-b 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 */