Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3818117rdh; Tue, 28 Nov 2023 04:58:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHgkXTSeNSQ6fTluh++q5xiMdtV8GIS5MYB0H5T8vcHbxbHwitDkoQJ1CLb6oTNZo6ttv5 X-Received: by 2002:a05:6808:1707:b0:3b8:4406:73a with SMTP id bc7-20020a056808170700b003b84406073amr19378077oib.9.1701176287857; Tue, 28 Nov 2023 04:58:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701176287; cv=none; d=google.com; s=arc-20160816; b=CjJtaVocdbaM9nCnU/yh7BfAjEvT+saq2juXMyrn79bOfTj/Z/ydMkdlhEfwJfo0dA U1D23K+Sky1wAmjqRe+PN7h6oCVDdOBEf1krOV4ln3LsqkZcTuabQe1Ip4pJC4Ki/n2T iFQrhtDkdLEl82uNSzOvU14tfhNKzSamsgyc/eHtnQHcZkWb98ZLitFrHdfvAyIRn2v2 5jYzXghFHovPJnwSP6NXopr24050uTfUyJsY/ns2/dmlsUvrSPciTofYxaXUAjTyA1sg oO/2SDb0LzDxQN9NXNfviUGO5x5aFdPDLPWL+vbFKJ2yghTP8YjiEEpzVbPuMCTOCdmb vBlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=xszn4Ig13wEV7o2Jx7EOGVgjLfJg2QBIoO9eSyCDJFk=; fh=0cpBOKuWf+FfnPJZG/zhkSBJdPvgX7kxtRw/of8L22s=; b=wWNjYl2VFhHhT5WIIWi211CgJa0xbhC1gs8uJ/+4ii9nicH/URos2/xVIMw8Z8f1Zc kI1JaHR5EddzO/u4GUk7uJPspeN0auCSmShhCg989vlHIZ/EyWsOj8v+JqwCWucwkXQg JYqqR3hvX1qjmjJ1vGr18DS+4B6YkL6vXEgwz6ZptfMBEQ+EFKh50t+A32aKS1GqbKLB rBZ7f+ugPbpOkKKJdw5sX06dZmuMEfh6HrIfCaNgjxlVW1gQWRpQt6zGe36VCsQJV/lX xUB4a9ADenLy6tEbcCuUMz9sSfvErPTObd0c+MjxvKZLcafx98OYlaOZ2gk3r1i7w2iH CIhg== 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:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b19-20020a63d313000000b00584ca25959csi12564373pgg.540.2023.11.28.04.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 04:58:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 95538804ACE9; Tue, 28 Nov 2023 04:58:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344813AbjK1M54 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 28 Nov 2023 07:57:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344416AbjK1M54 (ORCPT ); Tue, 28 Nov 2023 07:57:56 -0500 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93AA0D51; Tue, 28 Nov 2023 04:58:02 -0800 (PST) Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-58d9a0ead0cso302593eaf.0; Tue, 28 Nov 2023 04:58:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701176282; x=1701781082; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8YG0kmMybYYlsW64Xr/XYrAZDTr9Z329CgjHG1/4iHg=; b=w3Mf/AfyA2KIwky/anWd2Xvu7hGWIzYDjRkRxCDEufhJQOeqTYWA58FZ7NNt6yGe7a WvEIwAMS0KZr2qyN779RDBzXqnG7sr85e8ooPfFnUskQ7m4qPxpyqStGmXX8go0qgOdz PB3swlqerWtGQ1eeQMagm4NKZx1aM9f6dCeV/V6bpgB6C09B/TZWMWeAJiJLWaCFbX1g xqeq9KeZf9sAQEFfWgIQlIly6dsm96Ji5s3+95xuRlDIOkOxEa0wdDTUJ+wIFOGRNIbQ Skp2brWlH+vf9K9VSYm+KcZt8C6jxenW8FcnAkZ1pdbm8/0jMA99BqQ19U8zkdyT7fZN onGw== X-Gm-Message-State: AOJu0Yxey8IMYQDnP+txsBDeWKa5b+u/CXdJoHsSsE5+nygJZCdgRqyU ogsv7KPOk2JHeRjPwl4jCY/gKydfGijEe0vV7Yc= X-Received: by 2002:a4a:c691:0:b0:584:1080:f0a5 with SMTP id m17-20020a4ac691000000b005841080f0a5mr14243522ooq.1.1701176281795; Tue, 28 Nov 2023 04:58:01 -0800 (PST) MIME-Version: 1.0 References: <4892163.31r3eYUQgx@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 28 Nov 2023 13:57:50 +0100 Message-ID: Subject: Re: [PATCH v1] thermal: trip: Rework thermal_zone_set_trip() and its callers To: Lukasz Luba Cc: "Rafael J. Wysocki" , LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 28 Nov 2023 04:58:06 -0800 (PST) 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.