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: Eric Auger X-Patchwork-Id: 7430811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6796ABEEA4 for ; Sun, 18 Oct 2015 16:03:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B50220623 for ; Sun, 18 Oct 2015 16:03:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B173D204E7 for ; Sun, 18 Oct 2015 16:03:30 +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 1ZnqOg-0001F1-HA; Sun, 18 Oct 2015 16:01:22 +0000 Received: from mail-wi0-f180.google.com ([209.85.212.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZnqOP-000170-HL for linux-arm-kernel@lists.infradead.org; Sun, 18 Oct 2015 16:01:06 +0000 Received: by wicfv8 with SMTP id fv8so47220863wic.0 for ; Sun, 18 Oct 2015 09:00:45 -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=t3DHezDyVrIujLBHExcC49+3QSb1CBoY/uGN/TgkX4I=; b=Z0lzxlKCQoi3p9McLHfFkseL0Ii7hGGgpJoQp6q67ceS1ERwlfXEgCchk7FVA9RmhF nU3eFSlgsoFBZhA2U/6VS90iRzivtggMGgjNWPItO/ljaNB5mNgBZ7STj19C+wPqvdY4 qqrEWGwapc3bS6jHV/D2ktajeA8nIrPTGWRUarXPG1T9s18lMc1SnImrAiF5XtUycVU3 0tFop9MUcD02V0hFYOOHw2KsAmKuZpGe5Wtpvbdk0N7pnBpkctv9eGTj8m6kG8VL3cen i2tp96pGCac45txC7GLjUK4KrDmQmrlAFUvTK6tyj81Hl2+8K7sR6aXimQFw2NCKsVWz RMpA== X-Gm-Message-State: ALoCoQlNseawvZEemNZiRbGEiDO7+BgfKsxrvK4aGldSlYlAveppGKXJIeBN5nq7RbsqVENKW/TS 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151018_090105_794021_C9692EE5 X-CRM114-Status: GOOD ( 13.86 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, christoffer.dall@linaro.org, patches@linaro.org 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 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