From patchwork Sun Oct 18 16:00:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7430801 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 C62A89F37F for ; Sun, 18 Oct 2015 16:03:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D533920622 for ; Sun, 18 Oct 2015 16:03:31 +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 C0ADE2050E for ; Sun, 18 Oct 2015 16:03:30 +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 1ZnqOo-0001GK-H9; Sun, 18 Oct 2015 16:01:30 +0000 Received: from mail-wi0-f180.google.com ([209.85.212.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZnqOP-00016b-HM for linux-arm-kernel@lists.infradead.org; Sun, 18 Oct 2015 16:01:06 +0000 Received: by wijp11 with SMTP id p11so68458085wij.0 for ; Sun, 18 Oct 2015 09:00:44 -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=P352mE3IUNUOHRW7iEMRuOCzMvmsXlXkHrVZmMMJCbg=; b=nA0xkbUc58BvEUYizN/xN7A4kI1OqIXIGqncJMlHNMpGZYorLR+L6cuA6JOeLyhOZU MHtQR4FWus4vaR745TOG9u33oF4ZI6AQCQ7rSq85MVseQOMTZceS/bx6TDC4LcJMUaFs SOWWiJmR+eV2rtkXmcEWgNtT9tfrOujxZESurkeQdKBDu6OTRTphgnNHzkaUsYgq4lD/ o0MruFJlIoxjSv6S/HYi5TGZoyvfY32GzyBMDL6xwbu+NXmNkPy1nWMS8CJ9+MtBjVrZ jQeGLEBIriXeBAud7XdsFf/YsMgFc5EyXsxmw/wBNAp5oY67vK1AE6ldf2tkkT6HOzkd B7mQ== X-Gm-Message-State: ALoCoQkNvYUvNNvHSDyOtDpjQtgWeRqeQsEGTu8gDWNH92BkP43glYIpfy5xZ3NSp6KmWS2eo5Lz X-Received: by 10.180.85.226 with SMTP id k2mr16583879wiz.67.1445184043974; Sun, 18 Oct 2015 09:00:43 -0700 (PDT) Received: from gnx2579.st.com. ([78.232.41.119]) by smtp.gmail.com with ESMTPSA id jd7sm34740323wjb.19.2015.10.18.09.00.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 09:00:43 -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 2/4] vfio: platform: reset: calxedaxgmac: add reset function registration Date: Sun, 18 Oct 2015 18:00:13 +0200 Message-Id: <1445184015-24414-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445184015-24414-1-git-send-email-eric.auger@linaro.org> References: <1445184015-24414-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151018_090105_805398_8722BB51 X-CRM114-Status: GOOD ( 12.84 ) 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, T_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 This patch adds the reset function registration/unregistration. Also a MODULE_ALIAS is added. Signed-off-by: Eric Auger --- .../platform/reset/vfio_platform_calxedaxgmac.c | 40 ++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c b/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c index 619dc7d..4f76b17 100644 --- a/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c +++ b/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c @@ -29,8 +29,7 @@ #define DRIVER_VERSION "0.1" #define DRIVER_AUTHOR "Eric Auger " #define DRIVER_DESC "Reset support for Calxeda xgmac vfio platform device" - -#define CALXEDAXGMAC_COMPAT "calxeda,hb-xgmac" +#define COMPAT "calxeda,hb-xgmac" /* XGMAC Register definitions */ #define XGMAC_CONTROL 0x00000000 /* MAC Configuration */ @@ -80,6 +79,43 @@ int vfio_platform_calxedaxgmac_reset(struct vfio_platform_device *vdev) } EXPORT_SYMBOL_GPL(vfio_platform_calxedaxgmac_reset); +static int __init vfio_platform_calxedaxgmac_init(void) +{ + int (*register_reset)(struct module *, char*, + vfio_platform_reset_fn_t); + int ret; + + register_reset = symbol_get(vfio_platform_register_reset); + if (!register_reset) + return -EINVAL; + + ret = register_reset(THIS_MODULE, COMPAT, + vfio_platform_calxedaxgmac_reset); + + symbol_put(vfio_platform_register_reset); + + return ret; +} + +static void __exit vfio_platform_calxedaxgmac_exit(void) +{ + int (*unregister_reset)(char *); + int ret; + + unregister_reset = symbol_get(vfio_platform_unregister_reset); + if (!unregister_reset) + return; + + ret = unregister_reset(COMPAT); + + symbol_put(vfio_platform_unregister_reset); +} + +module_init(vfio_platform_calxedaxgmac_init); +module_exit(vfio_platform_calxedaxgmac_exit); + +MODULE_ALIAS("vfio-reset:" COMPAT); + MODULE_VERSION(DRIVER_VERSION); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR(DRIVER_AUTHOR);