From patchwork Tue Nov 3 18:12:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7546151 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 4787CBEEA4 for ; Tue, 3 Nov 2015 18:14:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61FCA20717 for ; Tue, 3 Nov 2015 18:14:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C6CC204D6 for ; Tue, 3 Nov 2015 18:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755833AbbKCSMf (ORCPT ); Tue, 3 Nov 2015 13:12:35 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:37124 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755775AbbKCSMb (ORCPT ); Tue, 3 Nov 2015 13:12:31 -0500 Received: by wicfv8 with SMTP id fv8so17268794wic.0 for ; Tue, 03 Nov 2015 10:12:30 -0800 (PST) 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=LkVGCcUSAQudwzbrsPuvINZda0A8rSg2Husl6kARZSSe7DepVS6FJuP1rxDuleJX68 xfnKmhgJd31nUN/u1YQNLcIEjR11tH+Jp/069BAveQtHBmigbxf0DxAsQyhcW9U5scpn LCVcawMidRCDdQtgPik5o9ADOhZ8uBRAQCYIrsT/TFwAEawTZmP2hq5QIyE9C0hdHhjF EADHyxX0XE/aT5kxclFBMDcoxecPycEUZ6/sumAKL5VZX+JRe61S0amNPzNuZceuxecX wMu0juCNBydjfeuiTW6kQX9nc2XxZ9jXxiyw/NrICw8oHRUYhKFNWJx4nDrXJTl77x/9 481Q== 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=ByV9T4PEZBZeUGoR8vUjZtdyco+rr1N+5QH+MTnbqochazIpmBCXDh0lnhSSoDUhPr 6+bfmYOV58UFiZUejV7TubndhuY8w1MtOuLmMCvaFjiXKTEIx7rROEUGnO9E+5q1XEyI 3zQexIXoJfl6mDzOU+e7Z05YNh8K0L0RTOzvKiIiKYeVsTt2MqulirmTzdWaYuJM24eZ 71f4cl5MIUDz7CEG473rz3DLmGxqf03TLJMfEBHtbkFtI2Ix4ObqjrwDIm/BEJza5+1H 5J57zFNC3PgM5EplkjQrJN5YLpgB/4quSjzff/Qyqv4Bi39V2uZq5uGSCCIDBE6/ruiz 69og== X-Gm-Message-State: ALoCoQlIddf/ulNPfB1u0dmPswPELp2Z7XXzgmelSshcM6yNN2HrEtUkC1Pgu+V8Y2tkz2DkZfX4 X-Received: by 10.194.76.178 with SMTP id l18mr31002499wjw.75.1446574350084; Tue, 03 Nov 2015 10:12:30 -0800 (PST) Received: from new-host-3.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id om1sm28830527wjc.2.2015.11.03.10.12.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Nov 2015 10:12:29 -0800 (PST) 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 v6 3/8] vfio: platform: introduce module_vfio_reset_handler macro Date: Tue, 3 Nov 2015 18:12:14 +0000 Message-Id: <1446574339-1843-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446574339-1843-1-git-send-email-eric.auger@linaro.org> References: <1446574339-1843-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,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 */