From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794778812; b=V/3rOXOLqAzeoAA7FbX6ovyNXq7acQQ/w9iE8cMQMfL7QlfZGGaJibpLErN0Q6H5npac IDvd3owmAq9c6S3r7g2u6ul7XgbqDI7ko1DWkNqKIeFLpTIsdy3bR01jQeYAwMX2pNcmw ixL6Ga+uVQi/NTrCCa5EpzFZZzPurjd26pk9Yv74bxCF7+VFOqZRa09fdJWjjYFr/aWzd /Ho+QL5e+LBS6dni+jqIrBMthlQFd2FZ0UGKB3sCyFUAAlb12b36kFc6GLbRDF3wOxfl1 5GgVo7iEmSovr8meSG4fUn7yywdONcE4xeAcP0bZAK7ktNFB5/CWd4QoQI0xMFprvhg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794778812; h=DMARC-Filter:Received:Received:X-Authority-Analysis:DKIM-Signature: Received:Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc: References:Content-Language:From:Autocrypt:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-AntiAbuse:X-AntiAbuse:X-AntiAbuse: X-AntiAbuse:X-AntiAbuse:X-BWhitelist:X-Source-IP:X-Source-L:X-Exim-ID: X-Source:X-Source-Args:X-Source-Dir:X-Source-Sender:X-Source-Auth: X-Email-Count:X-Org:X-Source-Cap:X-Local-Domain:X-CMAE-Envelope; bh=KVX7vPJ9OTeTzfoMFASmwz/gzFZvz1nh0dPEPAyIr0I=; b=k/dS5PkpA1bC9+P9dFVsngBWP68fte9tF74xhSymzvEiyzTLJvLfORx/O7ni6EFpjAHQ +sCiw7DmgTH1CwlklsCaoBrx6Z6joMcXrsjZbFhpjCFBBEykwwnrfiuoVO/firKfeWJD7 NDnAuJGg9R2fZ8DwJR8gsx0eA6I5/87N5bDk6/79u4Y1kbx9B3wWefWgQd5Ho8K1VNvvZ C0hp1XQHVNknvTC63v4mpPu16M7XDDq/0NJCs0z3JYDdp8dhx6jeYbR2MbOf3lfW1A4c5 0wOSXV0LbzmeBfGVDhFbOWCb7PKdm9mhWy+khD2i4/M6G8BK/S6V60RRCYOBcPuAbvw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=roeck-us.net; spf=fail smtp.mailfrom=roeck-us.net; dkim=pass header.d=roeck-us.net header.i=@roeck-us.net header.a=rsa-sha256 header.s=default header.b=YxtgJo2W; arc=none smtp.remote-ip=35.89.44.37 Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B544606A32F for ; Sun, 15 Nov 2026 21:40:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8B544606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=roeck-us.net header.i=@roeck-us.net header.a=rsa-sha256 header.s=default header.b=YxtgJo2W Received: from eig-obgw-5007b.ext.cloudfilter.net ([10.0.29.167]) by cmsmtp with ESMTPS id SZq0xN8KyVK9UShxMxs62f; Sun, 15 Nov 2026 21:40:12 +0000 Received: from 162-215-252-36.unifiedlayer.com ([208.91.199.152]) by cmsmtp with ESMTPS id ShxLxtdxyxqjjShxLxlED7; Sun, 15 Nov 2026 21:40:12 +0000 X-Authority-Analysis: v=2.4 cv=bZxrUPPB c=1 sm=1 tr=0 ts=6afa26bc a=QNED+QcLUkoL9qulTODnwA==:117 a=2cfIYNtKkjgZNaOwnGXpGw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=M0FbrtG7MMAA:10 a=T8OswTi7en7Lat6lzKAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=KPbNTLLc3YvdawN95zVk:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner: List-Archive; bh=KVX7vPJ9OTeTzfoMFASmwz/gzFZvz1nh0dPEPAyIr0I=; b=YxtgJo2WD6n0 WmJugJPeVh5UlVsUmIS8e5Uyd3ctxtWEj5FuNKBl6gdX2sFInUqR3GphGv5cXNZ88vWiD3QE5gs5Z zSQqvxcG3YVBlpPgUch8bEShrjW7PeCAYfSAhQpT6JNlZbPLe69eVO1LzFNWtoYvzZSe1hoTv5Eww rAKxglVx4fEdEbGv1IUMhq42k22kHuPkoh3KUy/0hrHLq2N6ZohmfO2wIf+H3z3sjP9JpedudAF4f 6AuyWAnDp82UyMlhSQ9NERocloE+PRFwt3zCNbaSWjTmnwIsfkVBDeROSkwKVO4Znb8+SYuWRb5wF BqVeYesa5vS1sVrvvIqKuA==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:50662) by bh-25.webhostbox.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xShxJ-00000000Je9-288q; Mon, 16 Nov 2026 03:10:09 +0530 Message-ID: <62350363-b796-4637-a102-c668037bbbdd@roeck-us.net> Date: Sun, 15 Nov 2026 13:40:08 -0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/4] hwmon: (adt7475) Convert to hwmon_device_register_with_info() To: =?UTF-8?Q?Dav=C3=AD=C3=B0_Steinn_Geirsson?= Cc: Jean Delvare , linux-hwmon@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , linux-pwm@vger.kernel.org, Jonathan Corbet , Shuah Khan , Randy Dunlap , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261114004110.328050-1-david@dsg.is> <20261114004110.328050-3-david@dsg.is> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8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EygJ F0WaMvQMNrk9UAUziVcUkLU52NS9SXqpVg8vgrO0JKx97IXFPcNh0DWsSj/0Y8HO/RDkGXYn FDMj7fZSPKyPQPmEHg+W/KzxSSfdgWIHF2QaQ0b2q1wOSec4Rti52ohmNSY+KNIW/zODhugJ np3900V20aS7eD9K8GTU0TGC1pyz6IVJwIE= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-BWhitelist: no X-Source-IP: 108.223.40.66 X-Source-L: No X-Exim-ID: 1xShxJ-00000000Je9-288q X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 108-223-40-66.lightspeed.sntcca.sbcglobal.net [108.223.40.66]:50662 X-Source-Auth: guenter@roeck-us.net X-Email-Count: 7 X-Org: HG=direseller_whb_net_legacy;ORG=directi; X-Source-Cap: cm9lY2s7YWN0aXZzdG07YmgtMjUud2ViaG9zdGJveC5uZXQ= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHOwjqOHTabmm3rn5GzTBJ7jrcbnJBvnRtuUhGPgAr3aMovsXfXu1jSBUQ4/L112jB4XIztcgA3gHXiKX3QISnuNnqKFoX7qmFGz/jjRfrjaIy7fLcLW YJYiXpr+FDZ5wUTo0gTAW1T1wZCe/Ldnzrefpkfy8s+ztk7M0DstDEMfvM7u1XMcXIFw0tai/ayFtBFCeLqoGPRaEPsu1RAODxGkpxtSDXYN60ik2pPRrLZ7 On 11/15/26 06:16, Davíð Steinn Geirsson wrote: > On Fri, Nov 13, 2026 at 10:07:53PM -0800, Guenter Roeck wrote: >> On 11/13/26 16:41, Davíð Steinn Geirsson wrote: >>> Convert the driver from hwmon_device_register_with_groups() to >>> hwmon_device_register_with_info(). The standard voltage, temperature, >>> fan and PWM attributes move to hwmon_ops. The chip-specific attributes >>> stay driver-defined and are passed as extra groups: the automatic fan >>> control points, temperature smoothing, PWM stall disable, >>> pwm_use_point2_pwm_at_crit and the VID attributes. >>> >>> The driver keeps data->lock, although the hwmon core serialises the >>> hwmon_ops callbacks. The attributes in the extra groups run outside that >>> serialisation, and they share the register cache and its periodic update >>> with the hwmon_ops callbacks. They do not take hwmon_lock() instead, to >>> keep this conversion free of locking changes. >>> >> >> I disagree here. If you don't want to change the locks to use the hwmon >> subsystem lock in this patch, add another patch to change the code to >> use it. The subsystem lock was not introduced to be ignored. > > Understood. I did notice one issue while planning that change. Patch 4 > makes the chip a PWM provider, so its callbacks will also need the > lock. If the consumer is pwm-fan, then when userspace writes pwm-fan's > pwm attribute, the hwmon core holds pwm-fan's lock. pwm-fan then calls > into the PWM core, which calls into adt7475, which then needs to take > its own hwmon lock: > > hwmon_attr_store() takes pwm-fan's hwmon lock > pwm_fan_write() > pwm_apply_might_sleep() > adt7475_pwm_write_waveform() > hwmon_lock() takes adt7475's hwmon lock > > As far as I can tell no driver does this today. adt7470 and > aspeed-g6-pwm-tach are the other PWM providers I found in drivers/hwmon, > and neither takes the subsystem lock in its PWM callbacks. > Ah, the usual "someone else does (or does not) do it". > I haven't written any code for this yet, so this is based on my read > of the current code only. If correct, I think this would need a hwmon > core change to give each hwmon device its own lockdep class. > Hmm, if that is true (I'd like to see a lockddep warning), that will need to be fixed anyway. The situation above will be more common with the pwm subsystem maintainer pushing for that kind of architecture, so it will need to be fixed. Introducing / maintaining another layer of locks is not the solution. Anyway, you want to add the complexity of getting the pwm subsystem and the pwm-fan driver involved, even though this could as well be handled in the adt7475 driver, so you'll have to suffer the consequences. Thanks, Guenter > I'm not quite confident enough in my understanding of the core to > commit to implementing such a change. But I'd appreciate your thoughts > on this. > >> >> Thanks, >> Guenter >> > > Thanks again, > Davíð