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: Auger Eric X-Patchwork-Id: 55671 Delivered-To: patches@linaro.org Received: by 10.112.61.134 with SMTP id p6csp106259lbr; Wed, 28 Oct 2015 06:02:58 -0700 (PDT) X-Received: by 10.194.223.39 with SMTP id qr7mr39203781wjc.92.1446037374003; Wed, 28 Oct 2015 06:02:54 -0700 (PDT) Return-Path: Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com. [2a00:1450:400c:c05::22b]) by mx.google.com with ESMTPS id xm4si36198124wib.90.2015.10.28.06.02.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Oct 2015 06:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c05::22b as permitted sender) client-ip=2a00:1450:400c:c05::22b; Authentication-Results: mx.google.com; spf=pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c05::22b as permitted sender) smtp.mailfrom=eric.auger@linaro.org; dkim=pass header.i=@linaro_org.20150623.gappssmtp.com Received: by wicfv8 with SMTP id fv8so11827193wic.0 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=NaDo6J7vNIR2VGgArB/GdgnENRoCS+qLh/y/HI4A+KSexEb+HmG2Brs96JNQ7JF0v6 F52tf7Ny8ie1LqssSMwlX5h/FjWXGXVSm8nXrpoLLcSGUIYbRanXGGopEUx74FtNoYu1 F2IvLDBSW3xI+Y3fza9q4++StdBvbRqj3/cZWb3Zo9QF/kg4cF+WUppeTtwMYc60kYFs 9QAG1xUc6+VBt0RICSh76RlKiggACxttbtru69m/Lcp3/ICX6Ek28nNElwdZi8hN0tTm T0YBDQiEx4trY3YqEeLC69vTID/sKbFR8J6RnRwDYRXfL2DN6jKglV4wUfXb3n2eEg6k GSeQ== X-Gm-Message-State: ALoCoQnQHSYb06FkVe6h81DjwwH5YOALUMcuZKyKXMCSePNqIoypzqx09kmH/Gt3Tk9tYODsl3VU X-Received: by 10.180.74.80 with SMTP id r16mr2864266wiv.88.1446037373786; Wed, 28 Oct 2015 06:02:53 -0700 (PDT) Return-Path: 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> 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(+) -- 1.9.1 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 */