From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 E4103187553; Mon, 12 Aug 2024 21:26:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723497965; cv=none; b=hqU8ae/oKDsuNhrIQr4tYbzjk9bo+FfNJN2oFe5815xW+3j3vXXWnN7WYpVrG5BhEUU3hCz/+pf4c5h486wCoZbQMd7q3vG3VA7sJQVHvaFoXBAlIlhjjqTH39Of/eyyHCMNUCK1EbjaWh4V+fa5+iYAyn80gRd3MyyTLTlklRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723497965; c=relaxed/simple; bh=wMs2bOYJfqd0y0Ld2lLBq7F+nsDzAKceHbzNk6IdGDQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OUjRyNYXdL1JUN2GAiPnYlTgbDpO3hb/8IeKiBMaLH+lQrE0rb4+pAr9dTCkRTYWCcd2c+LiomlS5HQ0blz4EVsTNjozPiE/p9rzlIoT9Ad2ye9jxMIe6L3av+KvKiuaFEIEwQAe0D8cxlUVrSLu2TK2F/xf1VvgnilRmDnVap8= 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=m+iENSyK; arc=none smtp.client-ip=209.85.214.169 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m+iENSyK" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1fec34f94abso40620355ad.2; Mon, 12 Aug 2024 14:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723497963; x=1724102763; 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=DI60ENYKuc4jq86VizKF8fbWvTHIUGxC9Lcc7S83ceI=; b=m+iENSyK1MqgZQwQKV3BHRKXcX30niNY9HxAC0RsbkYMFhHYxO6C0RuDsP6/RBh5FI xk1QpnjjV4dOe5SoLh11iftnE5Y2MjO91RhqECM/bYmrK+yspYiD0gUnk6NkbufsY4H8 tVQZe1hPL6ZL1rcTvZBlZ1rPt6zEmdHjPJXWTxXP8a2MK0HpodDOWSf7OcNCWZeW9mP+ 8HFdg9h9Kd8+MwbqPT97VX42xGq/XAGRMqM/5fq5HP994x2R4oakDuQ+8IV45UAJSF7S 4/z9wih++QwJPdO0skkLm8zRZW6BnTXfQXjhtWvRqthJ1PdZW+0HRIHjxXKkn+nDmK65 Z7Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723497963; x=1724102763; 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=DI60ENYKuc4jq86VizKF8fbWvTHIUGxC9Lcc7S83ceI=; b=XAANvkxmbqG4hs+aQ/7aZAQsSoeoaA/I2SCVCZ93k6imqFajx4AZFgO9s4dIRZV4jW 4LWDa0Csxqb5vNKVNEDYaU6D6PFiVYI85BfWJ74ihpEHeSSyGdJ37cMb4Yaw9PCJ7cRt /nx2mLjCyEd5CE+laVtQTd2Pv8aATJnSnztfmbQyegCkMSjJmPHYUL5B6GSfN797+0wc 9Ld2HKTUuJfqHk54QGtxgogWuHr1cozKpyFd2wwZPXcnIzWbDFJa+vnQiLv0AYBjQzQs nHc8Ce2XXvDLqEjJa2RMaj8ALd1YDtKZGBxapNFN1KFwKbo1fLjHbQVCTZihzo+QYOkq gZwg== X-Forwarded-Encrypted: i=1; AJvYcCVYPBATg+4Vumfn9PYbOHsewahFNquYUn1dnhQdLKlEPTDWq8zYyHL3VkyaQLlAcoSuhONb9notJYtYy0I=@vger.kernel.org X-Gm-Message-State: AOJu0YxMWi2aa4dB/NZk6J0/ci+8TcGopXmN/Wg49dzKRGewMuxgcywU w1TqSlfxLPmWTc0Fw9ZgpvHaQ1PxhGW5iw+EkHmpJmoJSnAuCpgG X-Google-Smtp-Source: AGHT+IGqt/fUuxTHAHz0DhX0/bFLqYsrmXEJBrb5UBicd88Omvo8XNzCNnvK8QSix0iXrp1r/3j3LQ== X-Received: by 2002:a17:902:e5ce:b0:1fb:7b96:8467 with SMTP id d9443c01a7336-201ca1ddc48mr16689245ad.63.1723497962972; Mon, 12 Aug 2024 14:26:02 -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 d9443c01a7336-201cd131692sm1317705ad.60.2024.08.12.14.26.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Aug 2024 14:26:02 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Mon, 12 Aug 2024 14:26:00 -0700 Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] hwmon: chipcap2: disable sensor if request ready irq fails To: Javier Carrasco , Jean Delvare Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240812-chipcap2-probe-improvements-v1-0-3cdff6d16897@gmail.com> <20240812-chipcap2-probe-improvements-v1-2-3cdff6d16897@gmail.com> <9b4f88e8-5fc6-4c4a-b89c-7f96675e81ac@roeck-us.net> <9659c699-1ce4-4b74-b697-83d926d80b35@gmail.com> 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//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChMaW51eCBhY2NvdW50KSA8bGludXhAcm9lY2stdXMubmV0PsLBgQQTAQIAKwIbAwYL CQgHAwIGFQgCCQoLBBYCAwECHgECF4ACGQEFAlVcphcFCRmg06EACgkQyx8mb86fmYFg0RAA nzX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ply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/12/24 13:48, Javier Carrasco wrote: > On 12/08/2024 22:08, Guenter Roeck wrote: >> On 8/12/24 12:59, Javier Carrasco wrote: >>> On 12/08/2024 18:49, Guenter Roeck wrote: >>>> On 8/12/24 08:43, Javier Carrasco wrote: >>>>> This check is carried out after getting the regulator, and the device >>>>> can be disabled if an error occurs. >>>>> >>>> >>>> I do not see a possible path for a call to cc2_enable() at this point, >>>> meaning the regulator won't ever be enabled. Please provide a better >>>> explanation why this patch would be necessary. >>>> >>>> Guenter >>>> >>> >>> Hi Guenter, >>> >>> this patch enforces the state where the dedicated regulator is disabled, >>> no matter what the history of the regulator was. If a previous >>> regulator_disable() failed, it would still be desirable that the >>> regulator gets disabled the next time the driver is probed (i.e. a new >>> attempt to disable it on failure). >>> cc2_disable() checks first if the regulator is enabled to avoid any >>> imbalance. >>> >> >> That is very theoretic. Sorry, I am not going to accept this patch. >> >> Guenter >> > > I get your point, but given that this device requires a dedicated > regulator, I believe it makes sense that it tries to disable it whenever > possible if it's not going to be used. I think that makes more sense > that just returning an error value without even making sure that de > regulator was disabled, doesn't it? > No, it doesn't make any sense whatsoever. What are you planning to do, clutter the kernel with code to disable regulators if instantiating a device fails for whatever reason and it turns out that a regulator which should not have been enabled to start with turns out to be enabled anyway ? > Of course this is not a killer feature, and I don't want to make you > waste much time with it. But I think the dedicated regulator should be > shut down in all error paths, whatever status it had before. > I strongly disagree. This can only mess up the kernel all over the place. Maybe you can convince other maintainers to accept such code, but please refrain from doing that in my scope of responsibility. If the regulator subsystem has the habit of leaving regulators enabled even after they have been released, that problem should be fixed in the regulator subsystem and not be worked around in individual drivers. Guenter