From patchwork Tue Sep 10 09:31:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 13798187 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAE9117BEAE; Tue, 10 Sep 2024 09:39:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725961168; cv=none; b=NdVlpk5HQaqbm300udGxJH+g0Q6k1TdUblkVLGGy+/mJ2oCTZfrfSV9owXqXJcEHuwECVish8l5X5tfvuRtFvrClawifRWYCqz1Eb5Gz1mampSpvQ7Di4Tf/z7HbfhaQ4u6y4I+OguXMFknA8Cu48M9T8exOd64DTKoK7k9G2n4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725961168; c=relaxed/simple; bh=RVPqfolybn6PJsOg3syy7Ov/xyNEtr+8kU/jK7GJ3+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U9OxqmXeE4a6TTAbo82urpjdOfQr9tcPzRcSoOB7ucachswiDNTQ/R9RwFwehQtCjgpFIJcM1Q4uvyhNnxdo/E4weNyNJkaBZZ84b8S9cRubAJkesZLRg4flf0MYyV9mt+AJNzgPROd/HGXuU7Bb9GF28OCFsu+edtRkagOqA20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; dkim=fail (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b=iuHMvbTN reason="signature verification failed"; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="iuHMvbTN" Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 6.2.0) id 1c142ab01565bdd8; Tue, 10 Sep 2024 11:39:22 +0200 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 42CF46B836D; Tue, 10 Sep 2024 11:39:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1725961162; bh=RVPqfolybn6PJsOg3syy7Ov/xyNEtr+8kU/jK7GJ3+w=; h=From:Subject:Date; b=iuHMvbTNuiDWBsofV0qnE9bb9YYdzfrOO9c4f+7nbrDHRTRMVw6v5Vscl1FAQHqDt 4IY3Ms9F7l3eTvsywqG26NKuWJqcYKyGWT9dD3bsG0yRzWl0bwX2TOMHoSFrHZs5cr fiowAjxQCV4fZH+Esu5HnFFq1RmkQzO/c7QrBDhgf2Y/yTIgh2MdG7fa/F2nt3Ys2p Dpqxzhge0PiWtx5KryO5Q9W8gxaZkjgwXQpSkMCTaDnHSzYzFeKJkeMHwpMRKZMeUT pTGY6l7c2tBnH27BVg4E5+w900ENivf1J8tb6HZrhmrEpwCC6mX8KVG4FvPu1AOp4l c8RVsDnKIBgbw== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Daniel Lezcano , Lukasz Luba , Zhang Rui Subject: [PATCH for 6.13 v1 4/8] thermal: core: Initialize thermal zones before registerimg them Date: Tue, 10 Sep 2024 11:31:19 +0200 Message-ID: <10527854.nUPlyArG6x@rjwysocki.net> In-Reply-To: <4920970.GXAFRqVoOG@rjwysocki.net> References: <4920970.GXAFRqVoOG@rjwysocki.net> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: spam:low X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrudeiledgudejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenogfuphgrmhfkphculdeftddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuufhprghmkfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomheprhhjfiesrhhjfiihshhotghkihdrnhgvthdpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=15 Fuz1=15 Fuz2=15 From: Rafael J. Wysocki Since user space can start interacting with a new thermal zone as soon as device_register() called by thermal_zone_device_register_with_trips() returns, it is better to initialize the thermal zone before calling device_register() on it. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -1469,6 +1469,7 @@ thermal_zone_device_register_with_trips( thermal_zone_destroy_device_groups(tz); goto remove_id; } + thermal_zone_device_init(tz); result = device_register(&tz->device); if (result) goto release_device; @@ -1507,7 +1508,6 @@ thermal_zone_device_register_with_trips( mutex_unlock(&thermal_list_lock); - thermal_zone_device_init(tz); /* Update the new thermal zone and mark it as already updated. */ if (atomic_cmpxchg(&tz->need_update, 1, 0)) thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);