From patchwork Sun Oct 18 16:00:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 55178 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 patches.linaro.org (Postfix) with ESMTPS id D9F3F22F11 for ; Sun, 18 Oct 2015 16:00:47 +0000 (UTC) Received: by lbcao8 with SMTP id ao8sf37195687lbc.1 for ; Sun, 18 Oct 2015 09:00:46 -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=t3DHezDyVrIujLBHExcC49+3QSb1CBoY/uGN/TgkX4I=; b=OiZY1rz/CA4kz6h7obMO6IH1NCnIk5LOHwtHSEvApjULn5B2ZbfzQyJQDcs/8heYKg ukaZedWi4huTN1EubeD1cSx+K0Nm+abeerPo1601+qcmmGbBv8PpP1k4nXPv8X1YP5Kc 0kSTrm3EP0Y26z7ul5P/P5mk/04wVLRiqXpm1AtyvCOx1m6ZqLp6hqDPuPyKrsxLU2KL uPY8alTBuX+AnBw1Fi85ZBIFTC4v1eHCqsfiKkunu+5JV7vkW8boMIOCa8CTXOxD80+8 RjvXIZwzpLEYshnQq80foDr/5LHnFoNjUu6YTUH+gkcYIJkSjdcBCQo6ViCjhm8ezo3o XGnw== X-Gm-Message-State: ALoCoQm5zXcW16ZVN9QBg3sIMLsziInQso27/DoPM0HXcOW9H8Xvy32Rx3S5E3razPrRWoJgvrkE X-Received: by 10.194.156.193 with SMTP id wg1mr5850889wjb.3.1445184046480; Sun, 18 Oct 2015 09:00:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.153.196 with SMTP id b187ls494354lfe.80.gmail; Sun, 18 Oct 2015 09:00:46 -0700 (PDT) X-Received: by 10.112.198.97 with SMTP id jb1mr12406547lbc.8.1445184046331; Sun, 18 Oct 2015 09:00:46 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id jv8si19739173lbc.86.2015.10.18.09.00.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 09:00:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbpp2 with SMTP id pp2so98602957lbb.0 for ; Sun, 18 Oct 2015 09:00:46 -0700 (PDT) X-Received: by 10.112.180.230 with SMTP id dr6mr12447270lbc.72.1445184046233; Sun, 18 Oct 2015 09:00:46 -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 w3csp1033829lbq; Sun, 18 Oct 2015 09:00:45 -0700 (PDT) X-Received: by 10.195.11.165 with SMTP id ej5mr28502245wjd.117.1445184045648; Sun, 18 Oct 2015 09:00:45 -0700 (PDT) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com. [209.85.212.178]) by mx.google.com with ESMTPS id i4si17115721wiv.115.2015.10.18.09.00.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 09:00:45 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.178 as permitted sender) client-ip=209.85.212.178; Received: by wicfv8 with SMTP id fv8so47220860wic.0 for ; Sun, 18 Oct 2015 09:00:45 -0700 (PDT) X-Received: by 10.194.239.230 with SMTP id vv6mr26975044wjc.21.1445184045459; Sun, 18 Oct 2015 09:00:45 -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.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 09:00:44 -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 3/4] vfio: platform: add compat in vfio_platform_device Date: Sun, 18 Oct 2015 18:00:14 +0200 Message-Id: <1445184015-24414-4-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-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.217.179 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 d36afc9..31a6a8c 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -38,16 +38,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); @@ -538,6 +533,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 17323f0..b274646 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