From patchwork Thu Oct 22 09:42:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 55422 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 265CC230CB for ; Thu, 22 Oct 2015 09:42:17 +0000 (UTC) Received: by lfaz124 with SMTP id z124sf29384968lfa.0 for ; Thu, 22 Oct 2015 02:42:16 -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=sIi9SbbIo46c53gx2eQLrYqxW65Og5G2PI3y+hsSdrE=; b=gZSzsC91EFi92bMjv3RK6Hie1eO4NKft4E7WR24OtyjAyiSOCp/3zWwIjvHzeSZLjd xMJvQzLjW05/eA5sY6qSBkFot5u8mUQgsNGy/2th9NHTon/OeDbrLpOC+mFx+XzPw/ME jFZHtGb8GqmYh0NnC/FJFb4LysrvJXmnZo19CeU+nKT9qZ1gfJEIeyo4Un18QxV4fP2O KB5WeENWC+raZ8hY9o3HX1NWU8VC9JN+RyTqb4bDly8r1SrLpj9TCVM4GBR04wpLzXSb 9uB2/AnmZGeacNClGXKBsZKINKLKzPpb7Tb+OLbeMWm9KL7ctjgwsUdsl5IjNFyE+aBJ OdUg== X-Gm-Message-State: ALoCoQk3yzmN4ZpR0AA5FafWiLnrXAHB8g86b8zDgmM5AP7ex/Q8Y3DSHurbgUZGWGmcilEBPnQj X-Received: by 10.180.87.164 with SMTP id az4mr8108065wib.1.1445506936085; Thu, 22 Oct 2015 02:42:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.42.209 with SMTP id q200ls328033lfq.72.gmail; Thu, 22 Oct 2015 02:42:15 -0700 (PDT) X-Received: by 10.112.52.40 with SMTP id q8mr7979592lbo.100.1445506935940; Thu, 22 Oct 2015 02:42:15 -0700 (PDT) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id bm7si3175450lbb.172.2015.10.22.02.42.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 02:42:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lfaz124 with SMTP id z124so41208621lfa.1 for ; Thu, 22 Oct 2015 02:42:15 -0700 (PDT) X-Received: by 10.25.40.130 with SMTP id o124mr4987936lfo.41.1445506935828; Thu, 22 Oct 2015 02:42:15 -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 w3csp485381lbq; Thu, 22 Oct 2015 02:42:15 -0700 (PDT) X-Received: by 10.194.239.105 with SMTP id vr9mr2780510wjc.90.1445506935216; Thu, 22 Oct 2015 02:42:15 -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 mx8si42512911wic.34.2015.10.22.02.42.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 02:42:15 -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 wikq8 with SMTP id q8so22996320wik.1 for ; Thu, 22 Oct 2015 02:42:15 -0700 (PDT) X-Received: by 10.194.118.102 with SMTP id kl6mr15712510wjb.29.1445506935030; Thu, 22 Oct 2015 02:42:15 -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 lr6sm9376859wic.3.2015.10.22.02.42.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 02:42:14 -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 v2 4/6] vfio: platform: add compat in vfio_platform_device Date: Thu, 22 Oct 2015 11:42:00 +0200 Message-Id: <1445506922-6005-5-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445506922-6005-1-git-send-email-eric.auger@linaro.org> References: <1445506922-6005-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.44 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: , Let's retrieve the compatibility string on probe and store it in the vfio_platform_device struct Signed-off-by: Eric Auger --- drivers/vfio/platform/vfio_platform_common.c | 15 ++++++++------- drivers/vfio/platform/vfio_platform_private.h | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c index 52a4c7b..e7d615f 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -45,16 +45,11 @@ static const struct vfio_platform_reset_combo reset_lookup_table[] = { static void vfio_platform_get_reset(struct vfio_platform_device *vdev, struct device *dev) { - const char *compat; int (*reset)(struct vfio_platform_device *); - int ret, i; - - ret = device_property_read_string(dev, "compatible", &compat); - if (ret) - return; + int i; for (i = 0 ; i < ARRAY_SIZE(reset_lookup_table); i++) { - if (!strcmp(reset_lookup_table[i].compat, compat)) { + if (!strcmp(reset_lookup_table[i].compat, vdev->compat)) { request_module(reset_lookup_table[i].module_name); reset = __symbol_get( reset_lookup_table[i].reset_function_name); @@ -545,6 +540,12 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev, struct iommu_group *group; int ret; + ret = device_property_read_string(dev, "compatible", &vdev->compat); + if (ret) { + pr_err("VFIO: cannot retrieve compat for %s\n", vdev->name); + return -EINVAL; + } + if (!vdev) return -EINVAL; diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index 1fb1410..620ee40 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h @@ -56,6 +56,7 @@ struct vfio_platform_device { u32 num_irqs; int refcnt; struct mutex igate; + const char *compat; /* * These fields should be filled by the bus specific binder