Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp746444ybh; Wed, 11 Mar 2020 09:59:59 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvjTDfoSTyJcj4JrEoPxD1EfUQD53VdJPuWFCTNY+AQZzHtC2zPFzLvRZt7eMe3xho+T1bw X-Received: by 2002:aca:4e08:: with SMTP id c8mr2630524oib.143.1583945999319; Wed, 11 Mar 2020 09:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583945999; cv=none; d=google.com; s=arc-20160816; b=fTuBBO6YwHYlz7qG2HMcexNpaakOcgU1dI+UC9N/CRRffjxHzFtCaYxBmrwaU7gqKu BmY+6T5MpU8M3lZ5EvScImTOfHzZrw0RGYecWD+hxVDBxZlS2Yw8E/qakO/T0s9RTK4X 2gAYvsh5BnVFVrKu5sID2mnzdvM5Jk46Yvhc+ucQD0Zk/UOgjMeykcViLwpzZQBvg+Un ZjwFTudMMleMJBZO6WDaLr8RHKq9QwIJKLCuw0vSNaPcFKh6Frg1y4Sxfzgtd9jl/+Ki 2x1IEQeK0509OXNL066FawhQOU0VuA58/5m2lZ0l0kMYajyrGsuhYctn/KeMFOuMcCU3 7x3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Kq6VVZa9pt+/DZBIalDZmPJCfkjSYklOqsY712qYdQs=; b=w8NrUhBMsx10f7JW2QI6WERG+z06g4aZvA9zwdHJR8Bx0Db9fL04aFIeKsAned8sJD Ts1cKCOPsIpVP+Ylvr43Ha+OfJLTJLc/gHEvWR3MIl8NtqVh1cX8swOKX/lrhvqmcQAq X8ioKXW8nMbqvMT4oW3KGtRk82qyhdMWpKtrhYFef4Z/Re+H+JMzzk6PINcCXkb23yUT poXVnazRJ5px3jVNWy8JAWcMBD+vkVfJHPeki2h4Hqo+1JtiArU55YOJ5C0nQaFPrFtR 3GOi/cxIlznGkt56LpVqZ5NLvg1tW/57MXsVJJu47uuATMDzuapawZ79UXi22DUva4ub p8Rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 71si1535767otm.111.2020.03.11.09.59.45; Wed, 11 Mar 2020 09:59:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730257AbgCKQ6X (ORCPT + 99 others); Wed, 11 Mar 2020 12:58:23 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:35795 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730031AbgCKQ6X (ORCPT ); Wed, 11 Mar 2020 12:58:23 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jC4gU-0003xs-3A; Wed, 11 Mar 2020 16:58:18 +0000 From: Kai-Heng Feng To: ajayg@nvidia.com Cc: Kai-Heng Feng , Wolfram Sang , Andy Shevchenko , linux-i2c@vger.kernel.org (open list:I2C CONTROLLER DRIVER FOR NVIDIA GPU), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] i2c: nvidia-gpu: Handle timeout correctly in gpu_i2c_check_status() Date: Thu, 12 Mar 2020 00:58:06 +0800 Message-Id: <20200311165806.12365-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nvidia card may come with a "phantom" UCSI device, and its driver gets stuck in probe routine, prevents any system PM operations like suspend. Let's handle the unaccounted case that the target time equals to jiffies in gpu_i2c_check_status(), so the UCSI driver can let the probe fail as it should. Fixes: c71bcdcb42a7 ("i2c: add i2c bus driver for NVIDIA GPU") Signed-off-by: Kai-Heng Feng --- drivers/i2c/busses/i2c-nvidia-gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c index 62e18b4db0ed..1988e93c7925 100644 --- a/drivers/i2c/busses/i2c-nvidia-gpu.c +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c @@ -88,7 +88,7 @@ static int gpu_i2c_check_status(struct gpu_i2c_dev *i2cd) usleep_range(500, 600); } while (time_is_after_jiffies(target)); - if (time_is_before_jiffies(target)) { + if (time_is_before_eq_jiffies(target)) { dev_err(i2cd->dev, "i2c timeout error %x\n", val); return -ETIMEDOUT; } -- 2.17.1