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: Auger Eric X-Patchwork-Id: 55486 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id CEDB120581 for ; Fri, 23 Oct 2015 12:37:30 +0000 (UTC) Received: by wikv3 with SMTP id v3sf10696137wik.1 for ; Fri, 23 Oct 2015 05:37:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=VvtYj/n4OJIRdnSaxImvm5sPU7SYcKeZO6144N1lhM0=; b=aD0QG0p+DvsxKrw60btsdT219ZAscDLs0T/UMNz/RJCt5xCO//0o43U9QMLxYiDXu0 nifcYV0mLjiNWyiNuKLU2b/ogn4JCJJuDcLZnzZ5jem/4g1TK0/FeZ99eJWxr2TpC+Tn FOKU6dfW66dq9tXDqxY0T6J/yVF5Jvn2UjAMDgcAi3ursh0SS6200x9W3S+1QueV4LsH 44y1wABuRqIZ2V2HqG/LahnLDfD8eY8cpy1bMz6IjY+OiH1QtVm72shhERrvnKbk4JtK fuk/StpwWWzkrDRaKSITaiZVs0EHUVqPiEu/rNBQbaxRwUdJsFtleI48SCN+K2r3+9Se l8KQ== X-Gm-Message-State: ALoCoQmnLS8WJ7MxlPl8wXE+s3ELkTfVcuRlB2dZtyLtgLAO6cdx19ppSFkFQnL1PlTnBcdcWRbo X-Received: by 10.112.142.195 with SMTP id ry3mr4920261lbb.22.1445603850157; Fri, 23 Oct 2015 05:37:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.18.90 with SMTP id h87ls446104lfi.9.gmail; Fri, 23 Oct 2015 05:37:30 -0700 (PDT) X-Received: by 10.112.150.168 with SMTP id uj8mr1819146lbb.22.1445603850028; Fri, 23 Oct 2015 05:37:30 -0700 (PDT) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id vv3si12526839lbb.102.2015.10.23.05.37.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 05:37:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lffz202 with SMTP id z202so82008165lff.3 for ; Fri, 23 Oct 2015 05:37:29 -0700 (PDT) X-Received: by 10.112.180.230 with SMTP id dr6mr10945206lbc.72.1445603849920; Fri, 23 Oct 2015 05:37:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1204323lbq; Fri, 23 Oct 2015 05:37:29 -0700 (PDT) X-Received: by 10.180.216.105 with SMTP id op9mr4709388wic.13.1445603846342; Fri, 23 Oct 2015 05:37:26 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com. [209.85.212.169]) by mx.google.com with ESMTPS id z19si4693154wij.114.2015.10.23.05.37.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 05:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.169 as permitted sender) client-ip=209.85.212.169; Received: by wicll6 with SMTP id ll6so29445575wic.0 for ; Fri, 23 Oct 2015 05:37:26 -0700 (PDT) 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 Cc: christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 */