From patchwork Sat Feb 13 15:15:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Ricard X-Patchwork-Id: 8300101 Return-Path: X-Original-To: patchwork-tpmdd-devel@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 97DCFC02AA for ; Sat, 13 Feb 2016 15:16:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AFB1D20398 for ; Sat, 13 Feb 2016 15:16:06 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B04D62025B for ; Sat, 13 Feb 2016 15:16:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aUbvX-00022t-HE; Sat, 13 Feb 2016 15:16:03 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aUbvV-00022a-Pu for tpmdd-devel@lists.sourceforge.net; Sat, 13 Feb 2016 15:16:01 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of gmail.com designates 74.125.82.67 as permitted sender) client-ip=74.125.82.67; envelope-from=christophe.ricard@gmail.com; helo=mail-wm0-f67.google.com; Received: from mail-wm0-f67.google.com ([74.125.82.67]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1aUbvU-0003dE-WD for tpmdd-devel@lists.sourceforge.net; Sat, 13 Feb 2016 15:16:01 +0000 Received: by mail-wm0-f67.google.com with SMTP id g62so7874233wme.2 for ; Sat, 13 Feb 2016 07:16:00 -0800 (PST) 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=5bzsXpxdubE+yyXV+dMHEskSRihP/J7K+QI1n4JtNmY=; b=YBsy2z1abbfoA2Vm2fuSfLqu5QLbr75tPbEYraKb0Vj/amqUROo9RxmBVaK3FSzr9n F1evZ6Z5efRVnr2IrVgdDHqX8x0dYPVFJwCRcYY03i46YvPHNWSQ1ir4NsVcEVyOvfvS ZnaDv1n8zUDG5u9wZI4SgzMbvjHdQoDe/bX1lQ5uKIqBFM+si3DCk6Zjc6112/sN1r9X Duwdy5kkF4/BXWPxaz4UKc1KSlZhDePe58vwnXEvnqxpVPfCnWRorjoD4n0J5egr9vrM 2DMH9cZzFcr8/8+Eyh3SG3rPowgE96uyFGTx+k6rZETOdR40iwemOQQLxlqpD3aA9JZV oy4Q== X-Gm-Message-State: AG10YOS3CdQuLK2zeVLfKhWmRMzU+sxd0aYPDoufxz4aQBzn9FUynaidZjbhd+7CFJIlxg== X-Received: by 10.28.158.198 with SMTP id h189mr3381108wme.74.1455376555027; Sat, 13 Feb 2016 07:15:55 -0800 (PST) Received: from localhost.localdomain (AMarseille-654-1-450-135.w92-150.abo.wanadoo.fr. [92.150.10.135]) by smtp.gmail.com with ESMTPSA id v66sm7129466wmb.18.2016.02.13.07.15.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Feb 2016 07:15:53 -0800 (PST) From: Christophe Ricard X-Google-Original-From: Christophe Ricard To: jarkko.sakkinen@linux.intel.com, peterhuewe@gmx.de Date: Sat, 13 Feb 2016 16:15:30 +0100 Message-Id: <1455376535-9549-8-git-send-email-christophe-h.ricard@st.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455376535-9549-1-git-send-email-christophe-h.ricard@st.com> References: <1455376535-9549-1-git-send-email-christophe-h.ricard@st.com> X-Spam-Score: -1.6 (-) X-Headers-End: 1aUbvU-0003dE-WD Cc: jean-luc.blanc@st.com, ashley@ashleylai.com, christophe.ricard@gmail.com, tpmdd-devel@lists.sourceforge.net, christophe-h.ricard@st.com, benoit.houyere@st.com Subject: [tpmdd-devel] [PATCH v2 07/12] tpm/st33zp24/spi: Improve st33zp24_spi_evaluate_latency X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,HK_RANDOM_ENVFROM,RCVD_IN_DNSWL_HI,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 Add check in st33zp24_spi_evaluate_latency helping to diagnose if the chip is present or in a bad state. Reviewed-by: Jarkko Sakkinen Signed-off-by: Christophe Ricard --- drivers/char/tpm/st33zp24/spi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index 0af836a..7cabf1d 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -213,6 +213,11 @@ static int st33zp24_spi_evaluate_latency(void *phy_id) &data, 1); latency++; } + if (status < 0) + return status; + if (latency == MAX_SPI_LATENCY) + return -ENODEV; + return latency - 1; } /* evaluate_latency() */