Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2866710pxb; Mon, 18 Apr 2022 09:53:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaWPpDl8WQWgsuIbYVQnh6dGc/kfxe59L14n7F6hBx153ugyDN6KtnGhBOOfjH5raEk1FK X-Received: by 2002:a17:906:58ce:b0:6e7:f925:fc5c with SMTP id e14-20020a17090658ce00b006e7f925fc5cmr9786681ejs.674.1650300818552; Mon, 18 Apr 2022 09:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650300818; cv=none; d=google.com; s=arc-20160816; b=v9L2RNB1L3xKUEWqGAcXf3nQbOeisr5NSrwg/NFf9MX+OU8H7I0+rc+L3NTmO5yYE5 AkJCujmIokgYOQOLfJKqwilZINwuaEECdSimnUo++UkJRxvrfuBAt5fyc2HzpkiBgjC7 VDe7AKzZqO4G+cLtAPfc1EDPgQJUjz2uWb33Vhbh1UvelhrCkUk0ps2Pld5kCcPh1fuR MxI1KRpbMyYW50w7lzbk6xUCYG9t3ZdAo+0JgXsqNuUbdIi4SSBGPwxYZ+OLhacsu5rW CCu1IESUq6WDYps+qAP1xB70DewJ7bBc/RPsCcRZaU1IiBEJru8FwsewDd+wtq5RTUq+ FB2w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dQe1L6gxH8Z3eb8D424yz+L0wZtv0sP/sW9zN55+/50=; b=P7ft9nR6qeRgyp+LiXq/l/IfrvpNhC4wiIqruBIEcbkOeRul/ft2ZFIXj/uiUiMtmT Iyf1BHAgQsdLAjirdCuX4PPL8/IJKCT/gKBzG3UaVG7gNovpcRu7lP1K5ZnRo74ZaVll ysB3EykoK1zhrz0xw4mYMiS07G54kt4dGwZjFa+R47GaoH73eLjXuvvJEjuOH/jLcAeO 2/ImIJPZZwa4lcr61AUncK43VtmTyOblX6vKch3pGb/fyZdcMMJjnBx/csZYmnuthHZg 6fwEwxszqfmvO89Lm61yB9ozGf+lxw5mOn4meIzA1ArJXx2B7XC+h/G0L1Cc0mZ9N0ZB AcdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BgIwHLMh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a05640226cc00b0041d709f5c58si4020213edd.329.2022.04.18.09.53.13; Mon, 18 Apr 2022 09:53:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BgIwHLMh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244762AbiDROAE (ORCPT + 99 others); Mon, 18 Apr 2022 10:00:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244252AbiDRNjJ (ORCPT ); Mon, 18 Apr 2022 09:39:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE5672E0AA; Mon, 18 Apr 2022 05:58:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E5937612BB; Mon, 18 Apr 2022 12:58:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6A09C385A7; Mon, 18 Apr 2022 12:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286731; bh=kLIZvva0TrNPgKx9Y7S4dXw5SpfgmKRbW6Q7tCDj1vM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BgIwHLMhbLu9E1UP10KC9l3xxkMaHg8CBx64jkYao0QbY+5igPP+xXULYoh97PL1/ aHM/ErDKbwySTHjuDZLAbA7PYDOnZ6jpt19EVK+UE8GjEqGDnMvaBu7U6A4Kfyv9ud FS9HqBemMFQhzyGLTCSj3ZwHSTut5Pac7QnQ4va8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Denefle , Sasha Levin Subject: [PATCH 4.14 228/284] w1: w1_therm: fixes w1_seq for ds28ea00 sensors Date: Mon, 18 Apr 2022 14:13:29 +0200 Message-Id: <20220418121218.194117878@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lucas Denefle [ Upstream commit 41a92a89eee819298f805c40187ad8b02bb53426 ] w1_seq was failing due to several devices responding to the CHAIN_DONE at the same time. Now properly selects the current device in the chain with MATCH_ROM. Also acknowledgment was read twice. Signed-off-by: Lucas Denefle Link: https://lore.kernel.org/r/20220223113558.232750-1-lucas.denefle@converge.io Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/w1/slaves/w1_therm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 259525c3382a..9b9870ba01cd 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c @@ -690,16 +690,20 @@ static ssize_t w1_seq_show(struct device *device, if (sl->reg_num.id == reg_num->id) seq = i; + if (w1_reset_bus(sl->master)) + goto error; + + /* Put the device into chain DONE state */ + w1_write_8(sl->master, W1_MATCH_ROM); + w1_write_block(sl->master, (u8 *)&rn, 8); w1_write_8(sl->master, W1_42_CHAIN); w1_write_8(sl->master, W1_42_CHAIN_DONE); w1_write_8(sl->master, W1_42_CHAIN_DONE_INV); - w1_read_block(sl->master, &ack, sizeof(ack)); /* check for acknowledgment */ ack = w1_read_8(sl->master); if (ack != W1_42_SUCCESS_CONFIRM_BYTE) goto error; - } /* Exit from CHAIN state */ -- 2.35.1