From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385725; b=vZ8UbeLf0ljPQxPSBuMtl6s1TSCNJUD/0Zpk2WZdDFjN3ML1Ck/nIL/0YGowZpsO4W9O U0Tx2Iu5VeRJNcFDqD4yAA9VULbZTvpd60N9Ek3IGRQxkbhg2haB1pYJb1kx2ShsEsvQy 1YcdtIvk4x9GbQXdSXvRttD6uefcrbVB5IK0kmj6wlXp7bj1axk1F+jBXmte7hoCVVO2A iF+tCLYg+vDhCDg0GLgFyNZga3gZDoxAvYD53N7DAVItL/ESd9mfY5XY34a2VGG6yHRs9 wh/3WY32PRc92tjnp1ILMJ+Gees4v39K/BW5kk/50o56jbSvADdmkEFqIUY6pp2mdow== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385725; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=IzaA/WKT/JCb5d5UFbql2g/S4vAqJFuDQ0sUODNnZ6s=; b=C12VUjUbOct8/j2MVgbKzafMBThuQPknJhve7NCa3IbI3FiIua7ZwoWoWObmj8EhMgfM ncDZM1b6icZpFuzECqlTnpGE1uX8xi9oaTGwEJ/3aWsOagLCczyM/kKRvEFih1qZwZBTI V1jbouwr8RFwxHvG9JDsVkk5V6TleCuxlBiV2N/r9SoVTDcFplCasVfLR9D6c7PoOscjk w05AX/fbpwMYBZzxP+Vos87xcRDf7ssXM88qxZ190MpR6paCh5FJ4ioNVQwTndUPwTAkV abmHGNkQqSxs8YfaZLqGF/NW1Bndjg6CbWbNpxpZWFzKfFwGahHNcBixyUiTBYbP06w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UkhyF5KX; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A617606A322; Fri, 4 Dec 2026 12:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UkhyF5KX Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBD5A1F000C2; Fri, 4 Dec 2026 12:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385725; bh=IzaA/WKT/JCb5d5UFbql2g/S4vAqJFuDQ0sUODNnZ6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UkhyF5KXh7JF0BghO7KTSd8z72hL5E3LcdMgFgP1JekTP0zi5cJWrRjJfC0gghN8E 5dgh3jofrM9DqsRXIwVIv5YZRuqWUs6jriyZGHh//RUipgGw/V2ui6NdS1JphTmAA1 0zmHxQduyP6tt91C3p9pleNIY5RUeP/h3+YNHHVc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Josef Bacik , Krzysztof Kozlowski Subject: [PATCH 6.6 0667/1167] w1: w1_therm: leave the slaves of other families alone Date: Fri, 4 Dec 2026 19:01:34 +0900 Message-ID: <20261204100719.429162621@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik commit c0eadd2e06e52563cae2b80491e56eb9712eb727 upstream. The file therm_bulk_read belongs to the bus master. Its callbacks walk all the slaves of the bus and look at sl->family_data as if every slave were a temperature sensor. A 1-wire bus can carry other devices too: - The family data of a slave which is driven by another driver, such as w1_ds2433, w1_ds250x, w1_ds28e04 or w1_ds28e17, is a structure of that driver. bulk_read_support() takes whatever is at the offset of specific_functions for a pointer and dereferences it, and if the result happens not to be 0, the callbacks write the state of the conversion into that foreign structure. - For a slave without family data, which is the case for most of the other drivers and for the default family, trigger_bulk_read() gives up with -ENODEV. A single serial number chip on the bus is enough to make the bulk read unusable for all the sensors. Only look at the slaves whose family is one of ours. A bulk conversion now works on a bus with other devices. Fixes: 57c76221d5af ("w1_therm: adding bulk read support to trigger multiple conversion on bus") Cc: stable Signed-off-by: Josef Bacik Reviewed-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20261027-llm-char-misc-w1-v1-9-d2e6bfafb6a4@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/w1/slaves/w1_therm.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c @@ -917,6 +917,19 @@ static inline bool bulk_read_support(str } /** + * bulk_read_slave() - check if a slave of the bus takes part in a bulk read + * @sl: any slave on the list of the master + * + * The family data of the slaves of other families is none of our business. + * + * Return: true if it is one of our devices and supports bulk read + */ +static bool bulk_read_slave(struct w1_slave *sl) +{ + return device_family(sl) && sl->family_data && bulk_read_support(sl); +} + +/** * conversion_time() - get the Tconv for the slave * @sl: device to get the conversion time * @@ -1507,9 +1520,7 @@ static int trigger_bulk_read(struct w1_m * so we can apply a strong pullup if required */ list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) { - if (!sl->family_data) - goto error; - if (bulk_read_support(sl)) { + if (bulk_read_slave(sl)) { int t_cur = conversion_time(sl); t_conv = max(t_cur, t_conv); @@ -1547,7 +1558,7 @@ static int trigger_bulk_read(struct w1_m /* set a flag to instruct that converT pending */ list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) { - if (bulk_read_support(sl)) + if (bulk_read_slave(sl)) SLAVE_CONVERT_TRIGGERED(sl) = -1; } @@ -1576,7 +1587,7 @@ mt_unlock: set_flag: /* set a flag to register convsersion is done */ list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) { - if (bulk_read_support(sl)) + if (bulk_read_slave(sl)) SLAVE_CONVERT_TRIGGERED(sl) = 1; } error: @@ -1944,16 +1955,14 @@ static ssize_t therm_bulk_read_show(stru int ret = 0; list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) { - if (sl->family_data) { - if (bulk_read_support(sl)) { - if (SLAVE_CONVERT_TRIGGERED(sl) == -1) { - ret = -1; - goto show_result; - } - if (SLAVE_CONVERT_TRIGGERED(sl) == 1) - /* continue to check other slaves */ - ret = 1; + if (bulk_read_slave(sl)) { + if (SLAVE_CONVERT_TRIGGERED(sl) == -1) { + ret = -1; + goto show_result; } + if (SLAVE_CONVERT_TRIGGERED(sl) == 1) + /* continue to check other slaves */ + ret = 1; } } show_result: