Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3832115rdh; Tue, 28 Nov 2023 05:14:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHj3oVH4pu1rrsr4/YeqS32DCZDTO/O+wsVuv+UzvJudcVn4rxFktueeJ2Gi65O8SqvaFIz X-Received: by 2002:a17:902:bd46:b0:1cc:1efb:1bab with SMTP id b6-20020a170902bd4600b001cc1efb1babmr15546553plx.38.1701177278647; Tue, 28 Nov 2023 05:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701177278; cv=none; d=google.com; s=arc-20160816; b=UrsJ6E1zHUGvxs/ORQ4oRitPhJP18SUtGpWDuLYl2wsPKMhNE0xV3gSbB5OVJ9PwdJ KS9fbFYgzGEjSUW+8Z4JK3sS+HBWs1JGSHvJ8Au4oRuEtF2Xd//iTX4mEBFXrewS5lZJ JLDN/nGXnsLJyIQxjJOAVqA0beX30wiz8DKImecss7narC/YMqdWHxfGcwVk+p4ZtRf2 z2VAxvD+uiiMlBDq39kB2KhdX8FUFOC4dM0lkRoR1LNeiJbA69QeboVu/Cn4tVbuB43G SGNaJ23j3Q/iZ3XERXT0AHT+wYew9gH/GddhLZG1PvTxRzOLoEP1cIUhE5fW3yBsdP/c z/hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=dVcWD1nDlWTDj56Bi0cK3hyslZEkHt8XzDJHeBmltDs=; fh=5oGrtR1MsVU5/82MZ8X3kqya06j3pcOz8jqoavcMoNs=; b=ag7XfI7EHQbcYu0/FgKB9aV7x8Ak0z+Ky11GTK9EEHhC0nwGLe2q8Jcuarl6vzKX/j SWB7fnGY9g8khMOxeccWyTe0QiVyj8JTYISCcOcbuAw4Y9DsOY1Iis1FQLNDWrwo7pz8 WHpfAMRIV7suMMpLxbYQPS77KVSS+ZYtCfEnkM88GZ6pZvk1uABti2AYzUGKgSWgnbxZ ltIl4pagy1VHP3ka6SEAZWMvQ2tFXfBnqjYx+ze82c4KEiuOrX+KRhDEMU6HJECCgpRe bgFlPp6XEbag3MGGxuUk45MbMYSRgPiQOmM4dpY3qmJ+zyzIfziJcAcnY8UnePG2SBMt hwcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x7-20020a170902ec8700b001c7345bc01csi7132447plg.450.2023.11.28.05.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 05:14:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BBAB9822C621; Tue, 28 Nov 2023 05:14:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344966AbjK1NOR (ORCPT + 99 others); Tue, 28 Nov 2023 08:14:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344972AbjK1NOQ (ORCPT ); Tue, 28 Nov 2023 08:14:16 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1DAB7D51; Tue, 28 Nov 2023 05:14:22 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EC1BE2F4; Tue, 28 Nov 2023 05:15:09 -0800 (PST) Received: from [10.57.2.117] (unknown [10.57.2.117]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A77E3F73F; Tue, 28 Nov 2023 05:14:21 -0800 (PST) Message-ID: Date: Tue, 28 Nov 2023 13:15:21 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] thermal: trip: Rework thermal_zone_set_trip() and its callers Content-Language: en-US To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui References: <4892163.31r3eYUQgx@kreacher> From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 28 Nov 2023 05:14:32 -0800 (PST) On 11/28/23 12:57, Rafael J. Wysocki wrote: > On Tue, Nov 28, 2023 at 1:53 PM Rafael J. Wysocki wrote: >> >> Hi Lukasz, >> >> On Tue, Nov 28, 2023 at 9:16 AM Lukasz Luba wrote: >>> >>> Hi Rafael, >>> >>> On 11/27/23 19:59, Rafael J. Wysocki wrote: >>>> From: Rafael J. Wysocki >>>> > > [cut] > >>>> Index: linux-pm/drivers/thermal/thermal_trip.c >>>> =================================================================== >>>> --- linux-pm.orig/drivers/thermal/thermal_trip.c >>>> +++ linux-pm/drivers/thermal/thermal_trip.c >>>> @@ -148,42 +148,61 @@ int thermal_zone_get_trip(struct thermal >>>> EXPORT_SYMBOL_GPL(thermal_zone_get_trip); >>>> >>>> int thermal_zone_set_trip(struct thermal_zone_device *tz, int trip_id, >>>> - const struct thermal_trip *trip) >>>> + enum thermal_set_trip_target what, const char *buf) >>>> { >>>> - struct thermal_trip t; >>>> - int ret; >>>> + struct thermal_trip *trip; >>>> + int val, ret = 0; >>>> >>>> - if (!tz->ops->set_trip_temp && !tz->ops->set_trip_hyst && !tz->trips) >>>> - return -EINVAL; >>> >>> Here we could bail out when there are no callbacks. >> >> Not really, because the trip is updated regardless. > > Actually, the condition above is always false after recent changes, > because tz->trips[] is always present, so the if () statement is > redundant. Hmm, yes you're right. This is yet another sign to refactor the old code. For the rest of your comments in the earlier message - I agree. When you post the v2 I can give it a try later today. Regards, Lukasz