From patchwork Fri Oct 23 12:37:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 55488 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id C839E20581 for ; Fri, 23 Oct 2015 12:37:35 +0000 (UTC) Received: by wiclg3 with SMTP id lg3sf10669382wic.3 for ; Fri, 23 Oct 2015 05:37:35 -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=Sdwq5grE/8/wuOCZAhiDtrvzdd9eC+zX9OHw0CSH9i8=; b=h7wzfD5UUntAQgeIbQVMsxEqES8cWW/53nEeu7+dahMwbIDzHKT7NAcTncWD3fTk5y R2y5oMfagJsdzV6jX+sLIWonLzIkeTrZSynfvP0uK33dY2fP8T6x9yAfG0QSiU0DgbZ3 bwA49FYsfvIUW0gkMxtscdNSFQhOnkcPc6O/70vdHbghIZmjPV2dFv5STc7D9PiNbVi3 vTR5TfHb0RTn2It4ewzJY9eRknIAH2j2b4JYAdWmSs8ZsrkVyyTtP9eCiACGA3jdbYw3 kjl64IX0LJRVancyZpsDdpk0hwD5WEanMAzAYfsBp2NmkG9Kc57cWnr9j1soZjE74RK/ gnlw== X-Gm-Message-State: ALoCoQkeMe+ej143BxV+mjUCIyRwi2UF2RNX8XQPJVDMGHt/jPf7YWosotpL7Gg6rex08SH6IGUm X-Received: by 10.194.71.166 with SMTP id w6mr4893945wju.6.1445603855083; Fri, 23 Oct 2015 05:37:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.213.66 with SMTP id m63ls391485lfg.102.gmail; Fri, 23 Oct 2015 05:37:34 -0700 (PDT) X-Received: by 10.112.205.69 with SMTP id le5mr11222442lbc.89.1445603854937; Fri, 23 Oct 2015 05:37:34 -0700 (PDT) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id m198si12535705lfb.78.2015.10.23.05.37.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 05:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lfbn126 with SMTP id n126so47427491lfb.2 for ; Fri, 23 Oct 2015 05:37:34 -0700 (PDT) X-Received: by 10.112.198.69 with SMTP id ja5mr9956099lbc.106.1445603854829; Fri, 23 Oct 2015 05:37:34 -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 w3csp1204374lbq; Fri, 23 Oct 2015 05:37:34 -0700 (PDT) X-Received: by 10.180.11.212 with SMTP id s20mr4252488wib.40.1445603849716; Fri, 23 Oct 2015 05:37:29 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com. [209.85.212.176]) by mx.google.com with ESMTPS id l10si4727330wib.93.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:29 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.176 as permitted sender) client-ip=209.85.212.176; Received: by wijp11 with SMTP id p11so75497287wij.0 for ; Fri, 23 Oct 2015 05:37:29 -0700 (PDT) X-Received: by 10.180.11.212 with SMTP id s20mr4252476wib.40.1445603849525; Fri, 23 Oct 2015 05:37:29 -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.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 05:37:28 -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 5/7] vfio: platform: add compat in vfio_platform_device Date: Fri, 23 Oct 2015 14:37:13 +0200 Message-Id: <1445603835-14506-6-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.42 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 --- v2 -> v3: - populate compat after vdev check --- 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 8eccd30..50a388b 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -41,16 +41,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); @@ -544,6 +539,12 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev, if (!vdev) return -EINVAL; + ret = device_property_read_string(dev, "compatible", &vdev->compat); + if (ret) { + pr_err("VFIO: cannot retrieve compat for %s\n", vdev->name); + return -EINVAL; + } + group = iommu_group_get(dev); if (!group) { pr_err("VFIO: No IOMMU group for device %s\n", vdev->name); diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index 5a1e8e6..f8072d8 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h @@ -57,6 +57,7 @@ struct vfio_platform_device { int refcnt; struct mutex igate; struct module *parent_module; + const char *compat; /* * These fields should be filled by the bus specific binder