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: Auger Eric X-Patchwork-Id: 55496 Delivered-To: patches@linaro.org Received: by 10.55.75.214 with SMTP id y205csp1169933qka; Fri, 23 Oct 2015 08:48:35 -0700 (PDT) X-Received: by 10.180.102.233 with SMTP id fr9mr907509wib.59.1445615257377; Fri, 23 Oct 2015 08:47:37 -0700 (PDT) Return-Path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com. [209.85.212.177]) by mx.google.com with ESMTPS id fx2si5787193wic.38.2015.10.23.08.47.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 08:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.177 as permitted sender) client-ip=209.85.212.177; Authentication-Results: mx.google.com; spf=pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.177 as permitted sender) smtp.mailfrom=eric.auger@linaro.org Received: by wicfv8 with SMTP id fv8so37830982wic.0 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=hjV/10eJC40yuZUSbyP/kT3krs41bgWMmAJQ0YOl5Y5H6mLUbL7MaG3YggqFzCeDid qHavBpHRqSwxBcvh6DlK5gH/vlzEPxyJ2WV93RdDFn6Q0HIBCeT66JZYZEWr6kM7NLzi YzfHXa9uL+8YdIAxZ5TSX/Z7LJ5XI8KuEnVcuPCMNAVVR2uQJ4Gntf1fuUv7dtoSn1/g cp26kqfxCGByF/szs6UvJOqY+0VG+QHm8DEXLVQsxEK+ncWsNTpEm27cPflhE8e9AxIj DBcAr9+9JTq5OdDHRRnWRe7qHmfionz3/9aDYoQCE04Bh12bLchugs5drrKNH3oiTC0Z RPGQ== X-Gm-Message-State: ALoCoQlUpnm7JkSktb0BExSdYnLuemQPlDaVOtEbD48Rc6rGJVohv1LR8O7X583g+d88PU12Iz1h X-Received: by 10.180.93.197 with SMTP id cw5mr5675941wib.53.1445615257165; Fri, 23 Oct 2015 08:47:37 -0700 (PDT) Return-Path: 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> 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 --- 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 */