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: 7472961 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 248299F36A for ; Fri, 23 Oct 2015 12:40:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 403AA20457 for ; Fri, 23 Oct 2015 12:40:57 +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 4A2752054E for ; Fri, 23 Oct 2015 12:40:56 +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 1Zpbc5-0005C5-LL; Fri, 23 Oct 2015 12:38:29 +0000 Received: from mail-wi0-f176.google.com ([209.85.212.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpbbP-0004mY-OP for linux-arm-kernel@lists.infradead.org; Fri, 23 Oct 2015 12:37:49 +0000 Received: by wicfv8 with SMTP id fv8so30054434wic.0 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=JhRi4RRRn7ys2z7NaxKAevyIF1T0j7ZsUnnO8UKhUW73IU1Ood3iEFU3DvF9wj/FsZ MJrUNBh0IUmeHQwDk28vTvy2vipknMFVVaUYbc+R6cnaNV3C747ce1XaImlnc1DG1vM3 5CSAcf705kICfJG3VSdpJClBqHLgh/7B/aQ02+QWQwoqwpeq7Z2gA7xxDpY1rxbu6mAy 2ZWeiB4jMxQsJOJa5ZR6YK1dBxbl7qEkW0m/+uAO5NlV7i3Q3pdYHXUtKs87QhvcG1YD UQBpGMQidxJGzHBGG+365q8tv3Zb9zTDTu3Yx8KePdclnrSiuC/YEPjqxdr4ixE9BWE6 /i8Q== X-Gm-Message-State: ALoCoQnLqa9tvdRN4nV56YfcFOGhjVBYdY9I7DqW3r62e1gGcVgy3FAJUqRtHxvUplUehfygJA7X 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151023_053748_069712_9E3E79EE X-CRM114-Status: GOOD ( 11.36 ) 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 */