From patchwork Tue Sep 13 00:57:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Ceraolo Spurio X-Patchwork-Id: 12974258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B470C6FA82 for ; Tue, 13 Sep 2022 00:59:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD71110E505; Tue, 13 Sep 2022 00:58:57 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id BDAD410E3A0; Tue, 13 Sep 2022 00:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663030681; x=1694566681; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+VUXprBFuTcnVtT2k324nO8mYM4LJwI6PdImwIvX7eY=; b=GNqHiLz1HtonmDlSlpWi4qDp29mruDYFrjNYd+3ca/kE5jW8Fy/MHquA w9QfaoWWpFCc7n4/wPrG6ifHowhxhcOdus0BQKBORwRBGTvQ9znDF1TDm nbPnvPqNjoYaXMXihmJHW3AUYFOrm8Rf3+zb48b35ltgDPpFsJ1cqPQdX nky3jap0Zz0IMxg7gS9kGefN+MS2BNyPp20MP0HbnvZ4B6TEd25YvsAk2 D/XudWfi/2W/ATmddpxlZylYgAo8AjQlep82bBywaNgzpLuSWQYsQC9rn 2O77z7/pwy7CcLhY0PqJcPpCIravjGbGD1ouG1vhunXPI4uv13c1bWO9b Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10468"; a="281024405" X-IronPort-AV: E=Sophos;i="5.93,311,1654585200"; d="scan'208";a="281024405" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 17:58:01 -0700 X-IronPort-AV: E=Sophos;i="5.93,311,1654585200"; d="scan'208";a="758593545" Received: from valcore-skull-1.fm.intel.com ([10.1.27.19]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 17:58:01 -0700 From: Daniele Ceraolo Spurio To: intel-gfx@lists.freedesktop.org Subject: [PATCH v5 06/15] mei: pxp: support matching with a gfx discrete card Date: Mon, 12 Sep 2022 17:57:30 -0700 Message-Id: <20220913005739.798337-7-daniele.ceraolospurio@intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220913005739.798337-1-daniele.ceraolospurio@intel.com> References: <20220913005739.798337-1-daniele.ceraolospurio@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alan Previn , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, Daniele Ceraolo Spurio , Tomas Winkler , Vitaly Lubart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Tomas Winkler With on-boards graphics card, both i915 and MEI are in the same device hierarchy with the same parent, while for discrete gfx card the MEI is its child device. Adjust the match function for that scenario by matching MEI parent device with i915. Signed-off-by: Tomas Winkler Signed-off-by: Daniele Ceraolo Spurio Cc: Vitaly Lubart Cc: Greg Kroah-Hartman Reviewed-by: Alan Previn Reviewed-by: Greg Kroah-Hartman --- V2: 1. More detailed commit message 2. Check for dev is not null before it is accessed. V3-5: Rebase drivers/misc/mei/pxp/mei_pxp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c index f221464c4009..8dd09b1722eb 100644 --- a/drivers/misc/mei/pxp/mei_pxp.c +++ b/drivers/misc/mei/pxp/mei_pxp.c @@ -156,17 +156,24 @@ static int mei_pxp_component_match(struct device *dev, int subcomponent, { struct device *base = data; + if (!dev) + return 0; + if (!dev->driver || strcmp(dev->driver->name, "i915") || subcomponent != I915_COMPONENT_PXP) return 0; base = base->parent; - if (!base) + if (!base) /* mei device */ return 0; - base = base->parent; - dev = dev->parent; + base = base->parent; /* pci device */ + /* for dgfx */ + if (base && dev == base) + return 1; + /* for pch */ + dev = dev->parent; return (base && dev && dev == base); }