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: Auger Eric X-Patchwork-Id: 47289 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 14DCD20553 for ; Fri, 17 Apr 2015 13:40:10 +0000 (UTC) Received: by lbbrr5 with SMTP id rr5sf23981439lbb.3 for ; Fri, 17 Apr 2015 06:40:09 -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=b1urSkgahXsJoUf2NPftC0asHkf7j5lx1CRQq99y+o0=; b=eHeUr5ke/S1QNkCkqiiEn33f9fuUHgFVOLsvOUy3AHcXp2KXaPJvVEXGbofYOkjA7Q OiDslxPjIS1wLgwYO9euLuuSm/Q8Tzynh04Zs4ivZjOgvuDgdK3u09RTnNX3jp+I/A0O wIlDNFcFeG4Ad0I7EeZs0Zvjy7bKrcjUFomkiYcn8FjbePiS2BMGlI+g4FYmo6b5n6Nb F6fz2oQGLNyeBct3Nf6HRecKMfGw2oTiaKWUrQEWKInZ9FB4Cvjm7u8llpLXTlK/fEtF YE5/tgCTyoUAK5YX+v03eS4Awkc/Qy0WrgiXHXinGpJgKI5ETXl8Dc7wPHqYSYwFYuDd 6XZQ== X-Gm-Message-State: ALoCoQlai/+ifHmc2+PzOq9gAERZJBoPWqLIY9gSbxCk5NPA+zvjT+p7VyYpleKRJJqOE/95Iflg X-Received: by 10.112.13.200 with SMTP id j8mr1488071lbc.14.1429278009024; Fri, 17 Apr 2015 06:40:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.4 with SMTP id ls4ls518414lac.73.gmail; Fri, 17 Apr 2015 06:40:08 -0700 (PDT) X-Received: by 10.112.218.40 with SMTP id pd8mr3664475lbc.71.1429278008886; Fri, 17 Apr 2015 06:40:08 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id qa7si8827748lbc.18.2015.04.17.06.40.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2015 06:40:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laat2 with SMTP id t2so80551346laa.1 for ; Fri, 17 Apr 2015 06:40:08 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr3730660lac.41.1429278008809; Fri, 17 Apr 2015 06:40:08 -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.67.65 with SMTP id l1csp3743782lbt; Fri, 17 Apr 2015 06:40:08 -0700 (PDT) X-Received: by 10.112.190.10 with SMTP id gm10mr3660682lbc.2.1429278006354; Fri, 17 Apr 2015 06:40:06 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com. [209.85.212.171]) by mx.google.com with ESMTPS id eb1si3045824wib.34.2015.04.17.06.40.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2015 06:40:06 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; Received: by widdi4 with SMTP id di4so22266842wid.0 for ; Fri, 17 Apr 2015 06:40:06 -0700 (PDT) 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 Cc: linux-kernel@vger.kernel.org, patches@linaro.org, Bharat.Bhushan@freescale.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-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.49 as permitted sender) smtp.mail=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: , 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 */