From patchwork Fri Apr 17 13:37:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6232101 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 BDA569F9D0 for ; Fri, 17 Apr 2015 13:43:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFBB320390 for ; Fri, 17 Apr 2015 13:43:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C510E20351 for ; Fri, 17 Apr 2015 13:43:27 +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 1Yj6Vj-0005Dh-IG; Fri, 17 Apr 2015 13:40:47 +0000 Received: from mail-wi0-f169.google.com ([209.85.212.169]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yj6VQ-000563-60 for linux-arm-kernel@lists.infradead.org; Fri, 17 Apr 2015 13:40:29 +0000 Received: by wizk4 with SMTP id k4so22269227wiz.1 for ; Fri, 17 Apr 2015 06:40:06 -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=b1urSkgahXsJoUf2NPftC0asHkf7j5lx1CRQq99y+o0=; b=Z01vxGt4Byr97cu/ouI/ypI0ViUhPI7nIOKkSbWAr9zKCqSuOBy1UR8In4mdQvjQ9U 5nNSOBpUypkzEnvFuXq8+Whv2zyT+eHLTyXLmz8RB4OrvQk9Pd/RJUKSzw2H6w3UBBTp zSReGX1lxrWCIuRn6bW9DKougVc/EHVarwu7w+gzZuLzG+I9wR6KgOQe5UtTfMweft19 cBiJHKCsm0U/1uDykCC8Q91nBfzzKTf7BZ3xx/wSkTNCQK0JvkKJTN+CpJTGMdCluEn7 ZXgtm0Al0XHONWYB3ItEipKY1SLqil7YTTGT8Zx4byGACsGrXf9+qN+NyIOlq9/INK2m fEng== X-Gm-Message-State: ALoCoQmHrpUbeJTNK3DrUGo/4rKxwNZ8UJyqdaCpLyMa9j+ylcSllMCUtsDc7ABOM+z1BH7QbDwM X-Received: by 10.194.59.199 with SMTP id b7mr6259756wjr.26.1429278006064; Fri, 17 Apr 2015 06:40:06 -0700 (PDT) Received: from gnx2579.gnb.st.com (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id ub1sm14712357wjc.43.2015.04.17.06.40.04 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Apr 2015 06:40:05 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, alex.williamson@redhat.com, agraf@suse.de, b.reynal@virtualopensystems.com Subject: [RFC 2/3] VFIO: platform: export platform callbacks, probe and remove Date: Fri, 17 Apr 2015 15:37:12 +0200 Message-Id: <1429277833-28663-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429277833-28663-1-git-send-email-eric.auger@linaro.org> References: <1429277833-28663-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150417_064028_395689_DD5DA98A X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Bharat.Bhushan@freescale.com, linux-kernel@vger.kernel.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 We intend to derive the platform driver into specialized ones, featuring reset modality. In order to avoid duplication, let's export the functions that can be reused in all vfio_platform drivers: - get_platform_resource - get_platform_irq - vfio_platform_probe - vfio_platform_remove Practically, only the vfio_platform_probe method should need to be overridden. Signed-off-by: Eric Auger --- drivers/vfio/platform/vfio_platform.c | 14 +++++++++----- drivers/vfio/platform/vfio_platform_private.h | 7 +++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/vfio/platform/vfio_platform.c b/drivers/vfio/platform/vfio_platform.c index cef645c..81adb03 100644 --- a/drivers/vfio/platform/vfio_platform.c +++ b/drivers/vfio/platform/vfio_platform.c @@ -25,8 +25,8 @@ /* probing devices from the linux platform bus */ -static struct resource *get_platform_resource(struct vfio_platform_device *vdev, - int num) +struct resource *get_platform_resource(struct vfio_platform_device *vdev, + int num) { struct platform_device *dev = (struct platform_device *) vdev->opaque; int i; @@ -43,15 +43,17 @@ static struct resource *get_platform_resource(struct vfio_platform_device *vdev, } return NULL; } +EXPORT_SYMBOL_GPL(get_platform_resource); -static int get_platform_irq(struct vfio_platform_device *vdev, int i) +int get_platform_irq(struct vfio_platform_device *vdev, int i) { struct platform_device *pdev = (struct platform_device *) vdev->opaque; return platform_get_irq(pdev, i); } +EXPORT_SYMBOL_GPL(get_platform_irq); -static int vfio_platform_probe(struct platform_device *pdev) +int vfio_platform_probe(struct platform_device *pdev) { struct vfio_platform_device *vdev; int ret; @@ -72,8 +74,9 @@ static int vfio_platform_probe(struct platform_device *pdev) return ret; } +EXPORT_SYMBOL_GPL(vfio_platform_probe); -static int vfio_platform_remove(struct platform_device *pdev) +int vfio_platform_remove(struct platform_device *pdev) { struct vfio_platform_device *vdev; @@ -85,6 +88,7 @@ static int vfio_platform_remove(struct platform_device *pdev) return -EINVAL; } +EXPORT_SYMBOL_GPL(vfio_platform_remove); static struct platform_driver vfio_platform_driver = { .probe = vfio_platform_probe, diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index 0a20028..e2b4f0b 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h @@ -95,4 +95,11 @@ extern int vfio_platform_external_set_automasked(void *device_data, unsigned count, bool automasked); +struct platform_device; +struct resource *get_platform_resource(struct vfio_platform_device *vdev, + int num); +int get_platform_irq(struct vfio_platform_device *vdev, int i); +int vfio_platform_probe(struct platform_device *pdev); +int vfio_platform_remove(struct platform_device *pdev); + #endif /* VFIO_PLATFORM_PRIVATE_H */