From patchwork Tue Feb 23 21:25:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Ricard X-Patchwork-Id: 587095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id A56651401DA for ; Wed, 24 Feb 2016 08:26:21 +1100 (AEDT) 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 1aYKTJ-0007PP-Sq; Tue, 23 Feb 2016 21:26:17 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aYKTJ-0007PI-6Y for tpmdd-devel@lists.sourceforge.net; Tue, 23 Feb 2016 21:26:17 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com designates 74.125.82.44 as permitted sender) client-ip=74.125.82.44; envelope-from=christophe.ricard@gmail.com; helo=mail-wm0-f44.google.com; Received: from mail-wm0-f44.google.com ([74.125.82.44]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1aYKTI-0000rv-Gg for tpmdd-devel@lists.sourceforge.net; Tue, 23 Feb 2016 21:26:17 +0000 Received: by mail-wm0-f44.google.com with SMTP id g62so243169063wme.1 for ; Tue, 23 Feb 2016 13:26:16 -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=PyG9YleQNLNMen6o1EIA4xF39l/J3e/OOlocuJ0Xzfg=; b=cIc+vnYIyh8q0QBWSGrSRClCmDzFLygiSwj8LRwdNJUIBQws2eavHPSHmKVXrL9R0m fZEzRm07aSjBee0tAU3x92Omq8KlVDZW2jYQ/lpyjeSmMZikoVbQNgZa6zRvhygmG7+N 4V/sGrs72gtfGzva66THPci87YNaXvnNHZqCvtkDEjbNX0d8fEdfWsn9UlaiDI1XN/pD GniFw0w8IA4Oa1NMNl+nW8jRXu7VOTu+1kzAOxCqFPnLruMPu4xlXg/28B0OCIh9Gsq+ Xpk1H3FRXRmwBbrbi2F+QmAxKbR1pMp5gkyZj1kXWhiuh8TJ0F5hBfyTPA3o5aIMWCE2 slkg== X-Gm-Message-State: AG10YORTpWX18deaiSr6AeBB59cJxMegQ/6av5VrBnvdUEenkB8wcKVDjnSLzrtC5b372Q== X-Received: by 10.194.23.7 with SMTP id i7mr35755414wjf.9.1456262770517; Tue, 23 Feb 2016 13:26:10 -0800 (PST) Received: from localhost.localdomain (ax113-6-78-236-204-66.fbx.proxad.net. [78.236.204.66]) by smtp.gmail.com with ESMTPSA id v1sm31448264wjf.49.2016.02.23.13.26.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Feb 2016 13:26:09 -0800 (PST) From: Christophe Ricard X-Google-Original-From: Christophe Ricard To: jarkko.sakkinen@linux.intel.com, peterhuewe@gmx.de Date: Tue, 23 Feb 2016 22:25:46 +0100 Message-Id: <1456262751-12096-8-git-send-email-christophe-h.ricard@st.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456262751-12096-1-git-send-email-christophe-h.ricard@st.com> References: <1456262751-12096-1-git-send-email-christophe-h.ricard@st.com> X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (christophe.ricard[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1aYKTI-0000rv-Gg 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 v3 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 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 08e6bf5..a2ef8ec 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -214,6 +214,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() */