Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp247351lqd; Wed, 24 Apr 2024 00:28:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZb9IZDDIdio3pf6l2m0FI1iaNTLr+2Vw/kT8aigs7bRYjeO0xDM7y0ta5hXBbJYJ70cEz+8K9DdhAu7GyL/UYKSq6g8Qkn3aH2NbDxg== X-Google-Smtp-Source: AGHT+IHhxTIU73ydACGhRUcw4eV2US6YbWFsy7DDZdvdhiz/lqgabxsjV0/PLnHbnr/EpXM8Mf3a X-Received: by 2002:a0c:e586:0:b0:6a0:949d:6ca with SMTP id t6-20020a0ce586000000b006a0949d06camr808840qvm.2.1713943684414; Wed, 24 Apr 2024 00:28:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713943684; cv=pass; d=google.com; s=arc-20160816; b=E/FQlOMlSgD1P8++ParC082AoE+VRWGqNiDBYCX46qIWg6Y1VnSKzkWjnnX+11G8z4 J+hxoWUkogrtGPn/7EQ6MihCPUUGabmJ0bBEWRmHNPw0RJ5kk5ijdp88GZxt9MefTuEH aGs+N0VgwCSosTaUV2B3vWp0HZrbZM9fTKV5EgX6Bs1R2xWnLYUWu0KH9UQbbRBq0stx 8ucc4GExviNdpafwqggEEnQZ0rlVv1wUmjRyau0fLLUvA227ieivMU0NH5xfHqz2fQ+/ hj3Zg3nKbDC2HjO9OW0mRc19nl4w/7XQ4nN2Qfs4O4lh5F7rvikctZzDgn+tFTIG1KBx /ppg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=lO5NKg2qkYxw9NtORYh6DeGIs7yy6jLKjXjR7Nk7zDI=; fh=B9qYJMd4Q6l4HLgq3OHMbuz/YiH2zKy1qTcBtJDSQcY=; b=USZbA3tpK4W5Oqe3h8uW0DLrSVNjOcOccnIJuaR4CZJS4G/Ne6tgTlHkZ/8yezrqV0 ics8tTV7NfGdmVg5cVCGgr8L5fO7JUvmfYg0q+mkk6w6UDCCqkM1fC0Ks3LPItXbudrZ /6kJFKpFzwu41DwAnys2oykA6chGoT6bTBd+YzYAO3mmkydHHy+dW5W5pZ2FrKyv0Mtk 9qAkOzj+u+T6cWl4Y2utQUaNsnxa8pUeC7UU0sfVsgkJK7oPOwfzUKwrB6tzsLSRwyWV 5Lq/JVrnF3gxOTkRuUvFgv5MsR9CtlBFdGdamCMj5amVwXy86EbKrkKigPyi3srbc+UL Ia4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-156487-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156487-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f6-20020a0562141d2600b006a04132300asi15370812qvd.413.2024.04.24.00.28.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 00:28:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156487-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-156487-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156487-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8341A1C22A60 for ; Wed, 24 Apr 2024 07:26:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF35E157E7D; Wed, 24 Apr 2024 07:26:44 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6947360; Wed, 24 Apr 2024 07:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713943604; cv=none; b=YfKAutAQoXz/KtrL1h/FtzIbYUpHqoMsIYrJ1nFqc7oJ5m51cJdP7b5TQDPegkoKULD85Rceyww4GnDPASikt6T4ZX0+N9BK4IMydpQczVTrVf6VGmYapB/rfc3ZddV91zHskr6KA+hPKjZO7On8FIx94f+n77fkmRIEBsSDGA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713943604; c=relaxed/simple; bh=iaiBma88Wg7RrGzKR4KWO3mS/NRsYch6lG9D0Epj3jQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=A7z5reOCOAhvkBP9jcB0at6QUO5e3W0/hadKPytHGuNqv6oPYPoZVULh9NSeIw88gWbCsGAse5YePdJmY7jCLMU5hMgmkXtn79h9Y/RUUY5Uf5u2HiVJFbd7m6GFa9m69+kRPtaRFfrByZKF8wZUA1X+tFBgJ1mWgPhXhMq2jzQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 2792E339; Wed, 24 Apr 2024 00:27:08 -0700 (PDT) Received: from [10.57.77.67] (unknown [10.57.77.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AA7533F64C; Wed, 24 Apr 2024 00:26:39 -0700 (PDT) Message-ID: <1016c73b-9bcb-49b8-85a6-854476681558@arm.com> Date: Wed, 24 Apr 2024 08:26:48 +0100 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 v1] thermal: core: Introduce thermal_governor_trip_crossed() To: "Rafael J. Wysocki" Cc: LKML , "Rafael J. Wysocki" , Linux PM , Daniel Lezcano References: <12426299.O9o76ZdvQC@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <12426299.O9o76ZdvQC@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/23/24 20:01, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Add a wrapper around the .trip_crossed() governor callback invocation > to reduce code duplications slightly and improve the code layout in > __thermal_zone_device_update(). > > No intentional functional impact. > > Signed-off-by: Rafael J. Wysocki > --- > > As requested in https://lore.kernel.org/linux-pm/3c169af3-e9c3-47c0-b343-48f699680009@linaro.org/ > > --- > drivers/thermal/thermal_core.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > Index: linux-pm/drivers/thermal/thermal_core.c > =================================================================== > --- linux-pm.orig/drivers/thermal/thermal_core.c > +++ linux-pm/drivers/thermal/thermal_core.c > @@ -450,6 +450,15 @@ static void thermal_zone_device_init(str > pos->initialized = false; > } > > +static void thermal_governor_trip_crossed(struct thermal_governor *governor, > + struct thermal_zone_device *tz, > + const struct thermal_trip *trip, > + bool crossed_up) > +{ > + if (governor->trip_crossed) > + governor->trip_crossed(tz, trip, crossed_up); > +} > + > static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a, > const struct list_head *b) > { > @@ -489,16 +498,14 @@ void __thermal_zone_device_update(struct > list_for_each_entry(td, &way_up_list, notify_list_node) { > thermal_notify_tz_trip_up(tz, &td->trip); > thermal_debug_tz_trip_up(tz, &td->trip); > - if (governor->trip_crossed) > - governor->trip_crossed(tz, &td->trip, true); > + thermal_governor_trip_crossed(governor, tz, &td->trip, true); > } > > list_sort(NULL, &way_down_list, thermal_trip_notify_cmp); > list_for_each_entry(td, &way_down_list, notify_list_node) { > thermal_notify_tz_trip_down(tz, &td->trip); > thermal_debug_tz_trip_down(tz, &td->trip); > - if (governor->trip_crossed) > - governor->trip_crossed(tz, &td->trip, false); > + thermal_governor_trip_crossed(governor, tz, &td->trip, false); > } > > if (governor->manage) > > > Good suggestion from Daniel. That code would probably be inlined anyway by most of compilers today, so no harm & LGTM. Reviewed-by: Lukasz Luba