From patchwork Sat May 23 17:32:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Nikolaus Schaller" X-Patchwork-Id: 211375 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ADD4C433E0 for ; Sat, 23 May 2020 17:33:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3276E20849 for ; Sat, 23 May 2020 17:33:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=goldelico.com header.i=@goldelico.com header.b="q6QU98it" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388222AbgEWRd3 (ORCPT ); Sat, 23 May 2020 13:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387665AbgEWRdN (ORCPT ); Sat, 23 May 2020 13:33:13 -0400 Received: from mo6-p02-ob.smtp.rzone.de (mo6-p02-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5302::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89BECC08C5C0; Sat, 23 May 2020 10:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1590255191; s=strato-dkim-0002; d=goldelico.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=iGg8/prgUoeOR6lnau4lx4rMI7jQxFMO2Su2hEl3N+M=; b=q6QU98itgkjUqk2JlG4FXuMcAFOdf82h4UxRxEEBJCI/TY+amGksjmRhJrrpKUuk+x R0w0E5K/ex9xliJO1Q548q7W8spKJk6I1HxkadBOAGlChQXUi9X3FBdG7FHWMhCoA18r /3TCjp93xXw+AeQNob8InFBkaAf/2ETbD9vExSQN0PT9tnImDY8WrqVAYjcLmeR2+deT A+OM8H9WCbNkhHzyCsMkG/tTzRpmynUJhwhstXFFLnQe5kamOisE//ASzIYhLTmLT+9g YY5lIGbg2IsbizccfQ8JDARqBfVgMrqgy4F8eE5Up1IHjJaeH1pR5B+FW0jxDUJq5UW4 qB0A== X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMhflhwDubTJ9o19MtK65S+//9m1YB9g=" X-RZG-CLASS-ID: mo00 Received: from iMac.fritz.box by smtp.strato.de (RZmta 46.7.0 AUTH) with ESMTPSA id D0a7c0w4NHX0Fac (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 23 May 2020 19:33:00 +0200 (CEST) From: "H. Nikolaus Schaller" To: Evgeniy Polyakov , "H. Nikolaus Schaller" , Greg Kroah-Hartman , YueHaibing , Tony Lindgren Cc: linux-kernel@vger.kernel.org, kernel@pyra-handheld.com, letux-kernel@openphoenux.org, linux-omap@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 2/4] w1: omap-hdq: fix return value to be -1 if there is a timeout Date: Sat, 23 May 2020 19:32:55 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org omap_w1_read_byte() should return -1 (or 0xff) in case of error (e.g. missing battery). The code accidentially overwrites the variable ret and not val, which is returned. So it will return the initial value 0 instead of -1. Fixes: 27d13da8782a ("w1: omap-hdq: Simplify driver with PM runtime autosuspend") Cc: stable@vger.kernel.org # v5.6+ Signed-off-by: H. Nikolaus Schaller --- drivers/w1/masters/omap_hdq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index d363e2a89fdfc4..9f9ec108b189e2 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c @@ -464,7 +464,7 @@ static u8 omap_w1_read_byte(void *_hdq) ret = hdq_read_byte(hdq_data, &val); if (ret) - ret = -1; + val = -1; pm_runtime_mark_last_busy(hdq_data->dev); pm_runtime_put_autosuspend(hdq_data->dev); From patchwork Sat May 23 17:32:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Nikolaus Schaller" X-Patchwork-Id: 211376 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 908D7C433E1 for ; Sat, 23 May 2020 17:33:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6467C20679 for ; Sat, 23 May 2020 17:33:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=goldelico.com header.i=@goldelico.com header.b="YuUpB9a1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388182AbgEWRdP (ORCPT ); Sat, 23 May 2020 13:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388161AbgEWRdN (ORCPT ); Sat, 23 May 2020 13:33:13 -0400 Received: from mo6-p02-ob.smtp.rzone.de (mo6-p02-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5302::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47206C05BD43; Sat, 23 May 2020 10:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1590255191; s=strato-dkim-0002; d=goldelico.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=6zUSrqNpmPH2RtkkjpPpsaxaburuNS1KBzwK7uv+CMk=; b=YuUpB9a1jdDI+KgXXVJe+TvNLBcO1XUCUpPiBN/ONjXyD82UY00K7Y60HchwQOjT/r JYl8D2px73gGdN98K6L8NVGbMDo9r+4INBOll80GtVtIac6PX2fdfiuPm5zPbJz1tKNc r57BpwmydGsuCVhl0DRp6yjnzj3TqI/XkTZcIS1kD8XCKBKn8JdN7minpwJ8H/uF2t8A fT6D8SlUaYzafM4aUU+qaTyb8j1Gp24qHWIcl/xvzUisz+cW9qvb4O18gD8fVoE0kiwd Y3v6eFmG0XTlc8e0v+45kjJCtHoyBzyiDwVMIM4fKzuFNPhv+FkkAwvdZzaH2iJqaIv9 9zHw== X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMhflhwDubTJ9o19MtK65S+//9m1YB9g=" X-RZG-CLASS-ID: mo00 Received: from iMac.fritz.box by smtp.strato.de (RZmta 46.7.0 AUTH) with ESMTPSA id D0a7c0w4NHX2Fae (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 23 May 2020 19:33:02 +0200 (CEST) From: "H. Nikolaus Schaller" To: Evgeniy Polyakov , "H. Nikolaus Schaller" , Greg Kroah-Hartman , YueHaibing , Tony Lindgren Cc: linux-kernel@vger.kernel.org, kernel@pyra-handheld.com, letux-kernel@openphoenux.org, linux-omap@vger.kernel.org Subject: [PATCH 4/4] w1: omap-hdq: print dev_err if irq flags are not cleared Date: Sat, 23 May 2020 19:32:57 +0200 Message-Id: <2de305d3046c7281a7123347899abbaa64c54fb8.1590255176.git.hns@goldelico.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org If irq flags are not cleared for certain operations we print an error message. Since this should never occur in normal operation, this patch is an optional safety-net and debugging tool. Signed-off-by: H. Nikolaus Schaller --- drivers/w1/masters/omap_hdq.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index a6484700f3b388..bf2ec59c1f9ddc 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c @@ -146,6 +146,10 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) goto rtn; } + if (hdq_data->hdq_irqstatus) + dev_err(hdq_data->dev, "TX irqstatus not cleared (%02x)\n", + hdq_data->hdq_irqstatus); + *status = 0; hdq_reg_out(hdq_data, OMAP_HDQ_TX_DATA, val); @@ -243,6 +247,10 @@ static int omap_hdq_break(struct hdq_data *hdq_data) goto rtn; } + if (hdq_data->hdq_irqstatus) + dev_err(hdq_data->dev, "break irqstatus not cleared (%02x)\n", + hdq_data->hdq_irqstatus); + /* set the INIT and GO bit */ hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, OMAP_HDQ_CTRL_STATUS_INITIALIZATION | OMAP_HDQ_CTRL_STATUS_GO,