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: 7510351 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EF11CBEEA4 for ; Wed, 28 Oct 2015 13:07:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D0642069D for ; Wed, 28 Oct 2015 13:07:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A5AE20697 for ; Wed, 28 Oct 2015 13:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965673AbbJ1NHO (ORCPT ); Wed, 28 Oct 2015 09:07:14 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:35569 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965629AbbJ1NCz (ORCPT ); Wed, 28 Oct 2015 09:02:55 -0400 Received: by wicll6 with SMTP id ll6so197601048wic.0 for ; Wed, 28 Oct 2015 06:02:54 -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=gKf54cD0GuH/9D3BdGkvXSnxXPR4XkOaBQ8n6+4zyTbxlmm/YfglR1kfBivDFFrpUZ jqjp1KEuhvZmgUmgdLGT9kjYlMP8W2YRaVIab8spDSfqPxoq8l/jmR+LL2ATprY/TrE/ E7MaoPC4GCYgndKHiGNehug/HK0muCVJEtCXKuexop8dD2MAcNPqrDJzecqiBWQM5yEI 5QN6g3RuCSE2RCjrs73B0Qs7cWwz9ljzhwwKPpQ/x8X1K0kTd2hr3yeuGP9vTU1tM6Fw iOziRATpZl7m0TYDZqlJvKmMiriqT76Kf274BWJUXLOkqeo3mFPb7I8QwJQFqNrRv5XS /YhA== X-Gm-Message-State: ALoCoQlny+0aamtzDjfpXfOR4Fjf5uo4saiyzRLlVW8tcfbVuUzDDfi2Kob8B5xrDF+YR6vmfgtX 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 Cc: christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 */