Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5540706pxb; Wed, 26 Jan 2022 14:33:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJDEB4Cm7Eh5i1utoZUPkaQFYya05HkE6qt7ZeL+plrZJlpulMFl8jO75hrptSLiZiJ2st X-Received: by 2002:a17:907:7292:: with SMTP id dt18mr638532ejc.305.1643236387861; Wed, 26 Jan 2022 14:33:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643236387; cv=none; d=google.com; s=arc-20160816; b=CLDs2is9FSDx5Hr9Mt/6N1IS0pqLMXizR0JyKHEZRrmrlPzCCvPbWhVLofRrhUuo5A 9lhBkbrJJIckN1J6j6n1YIvSgvE6klRP7zk4AI0yXxGCcnztF5j8mp6APxWE7kMZNbGr rfEhxO7acxmGpJEARVUBdNYhcRoLkpfq8mYQKFroGyNDziBtIBGS+D5NMUPd09sjXSLh H8jNkz8Q1btx9MTBGTN4JjP/iKv+uVLbrLkMIqCkRMOV3Dsj+fDgY4hsng61cdn5Bhrc AZLQ/5RZXWqk4pTO5pSdKrEeIfDEv2cPN4ftcskJ+n/KL4xlvZzJoHwpDJ+8RvVXAnCB fSTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fSWaa136uNPsj+g5us2/d5ZsueLesJ/JipX1ew8npy4=; b=EAx0jY0L0Grr3K47/m/wwcQk+b6J7eLnRcznqYqEfu14QBm7MoZAQoBSuMS2LYrl+u GzBak7E/C6fy4SQNZvKdFrHBVJQtZiBL9yuKtlgYJqm5jgkbezp1UJFjF5xcFjZGPBva Ep0nRQlR0RYhz5bor2pOFWQT8IZsuSwyhr3tY8yspTeMeo6zx6tN60qi80mRKjQJPJha Kw+luoxCoJnV5G0hRaZa6jdN65V3m2QWNIA3lZrInNjCH+1tnjeQ23Tb8zNOPiY70vsV /OQK2FH686rhlPeunuXFc9EUsoa/Y5C9aZTlAnzepzywygt7OOYS+p7SbSPsZOy7tzV/ gsyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=houkxmz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si282985ejd.186.2022.01.26.14.32.42; Wed, 26 Jan 2022 14:33:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=houkxmz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236032AbiAZTCj (ORCPT + 99 others); Wed, 26 Jan 2022 14:02:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbiAZTCj (ORCPT ); Wed, 26 Jan 2022 14:02:39 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA50C06161C for ; Wed, 26 Jan 2022 11:02:38 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso5226580pjv.1 for ; Wed, 26 Jan 2022 11:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fSWaa136uNPsj+g5us2/d5ZsueLesJ/JipX1ew8npy4=; b=houkxmz5jw2oKJfEMxk0xeHsYc+3Vbw9wZ9JESaux1d7Ub5Duj47FaJcgJ2wwS0ZmH WbN3jhtT2VfQIse5dxVWpz3r4YDuxJZxxv3Xri33vrXETR3Ffxg6RRsCBsk1tn2VCxcv YXjNiFUPT4yI+AjQPwO3yUUEKxNMA4xw5N0gs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fSWaa136uNPsj+g5us2/d5ZsueLesJ/JipX1ew8npy4=; b=uJ1r1bFtPFDSKY4mJpUGfoaSFylpIEWDlFsxpA6IiU9ATTbMQhuv8NFRuU7xhbJipV 0LnbFSXQLcLmALjW1Z/QNfa9Z3Uai3JlfFjllbn7rdhrBfG8WZ6MKCTGnpC1kjg/H4kR fF6u9C41hh682atR1Rd7b+r8n54BS7YTW/gdhE/dOFNHZH70zwLFY/Ij0TQ4x8k78l16 bKJhLpNqSGn0AnwNEDBozkxXm22VjraR/5CcQ8ly6V/0YN0WZQ4ffhs5fzKHAOjFOeRH HMGYEaLW6nVRkoXq/By/KkHZClMojdE6DmRJY8rh1TH7A7HjC6GnZ4xSIUnJ0uzyr//v zcgw== X-Gm-Message-State: AOAM531U1AVeibDYvBEpJUJ6h1pugSSz70/Dz7EVSXJFPZI9XP4jt091 HviCz5IQpV1KYvdDQphvEqa5q7jaKR+12w== X-Received: by 2002:a17:90a:e7d1:: with SMTP id kb17mr307930pjb.1.1643223758090; Wed, 26 Jan 2022 11:02:38 -0800 (PST) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id s15sm3030998pfg.145.2022.01.26.11.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 11:02:37 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: Prashant Malani , Alyssa Ross , Tzung-Bi Shih , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , Heikki Krogerus Subject: [PATCH v2] platform/chrome: cros_ec_typec: Check for EC device Date: Wed, 26 Jan 2022 19:02:20 +0000 Message-Id: <20220126190219.3095419-1-pmalani@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands). To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found. Fixes: fdc6b21e2444 ("platform/chrome: Add Type C connector class driver") Reported-by: Alyssa Ross Reviewed-by: Tzung-Bi Shih Signed-off-by: Prashant Malani --- Hi Alyssa, could you kindly test this with your existing setup? Thanks! Changes in v2: - Added newlines as suggested by reviewers. - Added Reviewed-by tag from Tzung-Bi. drivers/platform/chrome/cros_ec_typec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 5de0bfb0bc4d..952c1756f59e 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -1075,7 +1075,13 @@ static int cros_typec_probe(struct platform_device *pdev) return -ENOMEM; typec->dev = dev; + typec->ec = dev_get_drvdata(pdev->dev.parent); + if (!typec->ec) { + dev_err(dev, "couldn't find parent EC device\n"); + return -ENODEV; + } + platform_set_drvdata(pdev, typec); ret = cros_typec_get_cmd_version(typec); -- 2.35.0.rc0.227.g00780c9af4-goog