Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1373927lqa; Mon, 29 Apr 2024 06:59:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUnmtZ/gcGNfKD+ViJqVzcCL1X/pgvoGPTcyd4wdRWjv9MCWru0+bKfY2dXemqV7Dt6egh5CJr3UDQQSKT9FAOUF3p+P6elBoMCQPYhQg== X-Google-Smtp-Source: AGHT+IG3fxqSipAcgF1vSENikeNKLeLGVmXFeLngXWChDXBvIf3SUKEiYeQALM9R3x+A8PcByUPA X-Received: by 2002:a17:902:e887:b0:1eb:7d1d:67d7 with SMTP id w7-20020a170902e88700b001eb7d1d67d7mr6312247plg.3.1714399146113; Mon, 29 Apr 2024 06:59:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714399146; cv=pass; d=google.com; s=arc-20160816; b=DbDk/Z9xIwhgqKZiYWx7MLACyvmCT9YQoK/2C46LQfdqH1Aa8w5BZxMoI1UrFGjWj/ oXAC+nwkDQlLSEexf9yfygcz2sftT42ku7NU4FsVjKDuyLxe/XNlQl5EH4Xb+81QJCCp 3/woAjQISqgwQJOTQ3VeI+jmEftokUotcln6tLIrwtWzlvsoOfzyFJzJxTPH8hlXvYZq XiS6rjJyB4SWiwLeHLzrG5rs9+BvXZoCZ3T6WumPw9MPy0a6e9senEYbzX28w7RIfPKV nC7FHXvLRftesr9H57yv1FYxgKTZLnDRQRDO334Y40mjHi9d5Z6woVU9wqwQxPAHzUDC sWOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=u3kO8pISFRbCEy1Z0kVM5um+gFUTt2cTIlplF0izCEw=; fh=B36jcy8hOberfzXmOynkP4mDLTJVYAXuOMuGt2J8w3k=; b=0h5Iht9V1fQ+RLlJZFiOtOdMWlr8NeJxHvbNFLDrnUebeJldvrZYmpEVoB0YKgHXTr qcK3Gmow5jg+UXNPRFuMgy9GaZlylHuaK5SZiB8+WAEhYSS3s94YH84hqKJrWOhJtjAi tvJDFStC3FFW9IbG7Blbd67DkKj/hvWzmgFWzBHuceIVvQJNmzuxtcUe2kbLKifY+EML +ka+OJKseDMzYFcSHFg5Tb5l/M7Hwu2QAdZ9lpq2chDmJ+zyZMHZ4ybLDzZMHFHWEgOK x2vakbkr77475e3tgXTqKBp3Nq85uSDHB1kKZwAMxLM7Odqe7a3AB0Cdu1Z00ySGCw8B 8fEQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RGOwg+kk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-162391-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162391-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b10-20020a170902d50a00b001e43376415esi19905471plg.327.2024.04.29.06.59.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 06:59:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162391-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RGOwg+kk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-162391-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162391-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9663C28967C for ; Mon, 29 Apr 2024 13:49:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC54B745ED; Mon, 29 Apr 2024 13:49:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RGOwg+kk" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D0972E401; Mon, 29 Apr 2024 13:49:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714398566; cv=none; b=V7Lhb2AAe0YLqBx9ZuDMXqIFp9BL9VXWkDQzTR1U7hWVeq/EAkMAiEu/E3hHfRZugOLM/tXlzYqHxaI9jNoejTEHVDhNfqMuKpFz1A+uDE1GEErV4GJde1OXVly0+BY8w4cC790+BOnyNV5pJ8l20r5ZdPLYXI5ChUo6DJIHfzw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714398566; c=relaxed/simple; bh=EXfCw3rNz9McvbuzKSk45Zag0zYGIXbsQWF9BEZVsSA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ij0rSn01yaZKbAomkZH79cUdWngtvkW8fA8Or04vrlFePG+zuXk+/DkXTRLhC095ur6WTRKFtGBMVnGN16M9q0bCW4ZN1sN9thZXtrlvnhiIZmE8D15DLGLK/ij+UybnD2iOrxWXGq2Fnu72pYUFcqATdNB5BQZVayLSW1YVG4Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RGOwg+kk; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e3c3aa8938so28787625ad.1; Mon, 29 Apr 2024 06:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714398564; x=1715003364; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=u3kO8pISFRbCEy1Z0kVM5um+gFUTt2cTIlplF0izCEw=; b=RGOwg+kksI8vZUwUqvD+Hh8DTlHnRBrdyjfQGrHOO+Dbyld4WhL67YiUF2WcgHa5vG lTMnRFvdh0oVptMeBrMx6aFOdV47CGG5S4IzZ29hoMW+XHwBYqPVkYmoQ0eUOQHxRpvn pw1QqCOXOMofpUPWoYYkRMv/zcs5gLPvaydbliU2bwnidmljMtN0fmIzmSZ0+ndEVhB+ b/du92s0EHNRJCb2+/AzV3NfF9xe9Ny7ZmByYBPTlCRFZc1pa4SmSeY4TB3Bjkvzwl6p TLWixvxeaSfCY4ycdwKzvnugx1kpUC4hT4jdTC0dXGM3r9+36tDrhqMenbbygQERjaxg PLhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714398564; x=1715003364; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=u3kO8pISFRbCEy1Z0kVM5um+gFUTt2cTIlplF0izCEw=; b=s1FgVc8SMv5czz8aIRcuAjcEDuznZPkEn283Pg+G/QETLnIDdHx0WfpAbnuJmt2qEf 2OaECSuxDJPEGiI93Z6chMW1hh8fM6CeXADAlT4bjLcOY/O71zdQ2Coqgwmn9cVydhGk zoggvAPta1xFKsk4tHJT/F/jLT1GPDIrCUSZgW+RaES7Qj/dnaxUjLsGski8IaEe2DBd sX+2sXCkrKpBcg48JCrQZfmY8Sq/+MafhLv0EoTqonzU7UA8pbreeMjF//dVIN3Fg5vx AHVIMYU8K/YF9/yagZOBuVdZxQqdwa6N+PZCn/9SP/4I4JhpjN4dyVky1s5LUM6YswmP Bglw== X-Forwarded-Encrypted: i=1; AJvYcCWWkd6rjPGtbWvjlUcv7V6JRC0aPi6grvbxmi/ZP0VEMe2S5R3TFek0a5gEGVW4mPEKH9iIsrbnjn2hLqEr4RFtjXiCDunOiI5/5WZbaEAphZRdjds6LDrGF/ifvUZ7akS+yJa8NCMvlW8= X-Gm-Message-State: AOJu0YyQGBOOyefVHzjl4lcyN8jIHQ3D/nwdd3gAKVoVqngdRvK2J4JN zklE38MVXUo36YvpvsGvwzk6sUdGFg+x6kW+etVt08QvyTKoegL0 X-Received: by 2002:a17:902:d491:b0:1e4:c09:7f37 with SMTP id c17-20020a170902d49100b001e40c097f37mr12167894plg.54.1714398564475; Mon, 29 Apr 2024 06:49:24 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id l9-20020a170903120900b001e3e0aa9776sm20274770plh.27.2024.04.29.06.49.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Apr 2024 06:49:23 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Mon, 29 Apr 2024 06:49:21 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] hwmon (max6639): Use regmap To: Naresh Solanki Cc: krzysztof.kozlowski+dt@linaro.org, u.kleine-koenig@pengutronix.de, Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240416171720.2875916-1-naresh.solanki@9elements.com> <65607114-89f8-4f48-83fc-b89d87fee247@roeck-us.net> <116aeea1-c648-4abe-9ab2-693bf64000fc@roeck-us.net> <6d779d5b-b622-4e20-9449-64307b9b9582@roeck-us.net> 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/W8Vk BIsJMaWOhks//7d92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5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/29/24 01:19, Naresh Solanki wrote: > Hi Guenter, > > > On Sun, 28 Apr 2024 at 22:48, Guenter Roeck wrote: >> >> On 4/25/24 02:50, Naresh Solanki wrote: >> ... >>> This driver has 27 regmap accesses. Except volatile registers, others are >>> cached by regmap. >>> Some function which only access volatile registers will not be able to take >>> advantage of caching. This is also the case in various other drivers for similar >>> devices. >>> Also regmap offers bit handling which makes the code much cleaner. >>> >> >> Maybe I need to make it explicit in documentation. I will not accept regmap >> conversions unless local caching is dropped. Yes, that means that volatile >> registers will not be cached. I consider that a positive. > I agree with you. Regmap conversion wouldn't make sense if local caching > is present. > Correct me if I'm wrong, but in this context, local caching points to the > various variables in max6639_data ? > i.e., > bool valid; /* true if following fields are valid */ > unsigned long last_updated; /* In jiffies */ > > /* Register values sampled regularly */ > u16 temp[2]; /* Temperature, in 1/8 C, 0..255 C */ > bool temp_fault[2]; /* Detected temperature diode failure */ > u8 fan[2]; /* Register value: TACH count for fans >=30 */ > u8 status; /* Detected channel alarms and fan failures */ > > /* Register values only written to */ > u8 pwm[2]; /* Register value: Duty cycle 0..120 */ > u8 temp_therm[2]; /* THERM Temperature, 0..255 C (->_max) */ > u8 temp_alert[2]; /* ALERT Temperature, 0..255 C (->_crit) */ > u8 temp_ot[2]; /* OT Temperature, 0..255 C (->_emergency) */ > > /* Register values initialized only once */ > u8 ppr; /* Pulses per rotation 0..3 for 1..4 ppr */ > u8 rpm_range; /* Index in above rpm_ranges table */ > > Are you asking for removal of all these variables & each read sysfs > attribute read should access regmap cache directly ? > Mostly yes. Note that "ppr" is only used in max6639_init_client(), and it is unnecessary to keep it in max6639_data to start with. rpm_range is ok to keep because it is a calculated initialization value. The fixed initialization of temp_therm, temp_alert, and temp_ot is questionable to start with because it overrides bios/rommon initialization values. Guenter