From patchwork Wed Jan 15 07:10:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857664 Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (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 7674E230275; Wed, 15 Jan 2025 07:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925091; cv=none; b=GHHyAZ4jI04RO9NY7v/LRkGH5ziXkcyc9cnmAE1XU6eGhg3AzCPtWnyrn8a6ogEd5cPC38UFQd4TVvABlZ4QEonU6CW5m08M6H1dTv4N1WJhVh5k5qOi4i/qqtov5upFRh2MYQHAFsKECUSY4qFrbOUV+DkWrwfuhPLTTo5lRF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925091; c=relaxed/simple; bh=1gO5DFdQ2/8QLirmkIPoM4mGWdV+DHCejShE0rJ2D70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EyIopv2p0C6hi6Ls1UPOq+zAzS9QWwxVKbhxF+ZSRV8ZcFKOu9k6/CtDku1LyjBLtooxzVVkkBEKE46VjWF4X6x8RP+YKfv0soNQyqd/vtghnbpgklIiVn7foZrDcgFwNAW7MV12KPxWcYf3ecqbPqF8+h3XBNvI5CAvKD91IH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d0wFkKQj; arc=none smtp.client-ip=209.85.217.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="d0wFkKQj" Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-4b11a11a4f0so2218270137.3; Tue, 14 Jan 2025 23:11:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925088; x=1737529888; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IFAZztCM4wG+aiC5QIUpxsGJy6gqYlsI0Iyd3BzzVjU=; b=d0wFkKQjvLlfV5nS4vPzOxmSCckxWGdz26BejxCUrzLD+u4QtDb22GktkhR9ZQp1rA J/rnucAgSvBn3ujjZxCL0oF1np6YDByc4ndaHDgJa2lUpL/kCNTKJbS3z0HaHH+H5Q0R 0pC1ztzYztySbS7+w9ARKyomBctsFHCkIK3+5bQcWMmDSV47ZTB+iwQKtV9fwp6a+yEV Nt3uiFJwYSCnTWco4yNKx1qiZMm4JkhykDnEb3zemqFP8sgobNOMyJQjYmgIe3kUmZWy XZUtlq/j126QF8uv74OezxcYo2pJY2opcZDgvUb3z6fIdw4t5A/7RxE1iLLjOhgpASaW ecfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925088; x=1737529888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IFAZztCM4wG+aiC5QIUpxsGJy6gqYlsI0Iyd3BzzVjU=; b=sFZF+QskqiV2N3Yozvq5K3AURjrZwg1cGcgmJ2AasgPukzqx7dliZAz7bx6o2mA8oz 4zYLO0WopeIyTwIlAj+ajkRI/HB8hMRRPaq9dY9FWTZEwDnFYNG0SRjslXKNXIM7o0rg llbtEDdip/n/mjIS7eBjrgDO0aeVe1OodCDsJYqTc5gHiUCbw0TtE6AT/cQFlX0CIuhP Io6p4upSPtlyinpVdTg1qOAAkKiTQQJA8sW6eYqKJ67uEre3qX0L45vrZR4dwHvAhtK7 z0KDMO5NE54tVT8cyz7cFhobYB+/fVERsPhedxed16v9u63htP/LsPbhyDrCGvxb9hN4 8vJw== X-Forwarded-Encrypted: i=1; AJvYcCUQJdEcXza4LaDu9I5o3tjoKvCOk8QUpsWnPPeDcfqAOMwqadUGlou0rz3KFHIJTENNapRsD8+PeL/D@vger.kernel.org, AJvYcCXWDwIoOX/6vPjHqTVsF+qx5P7ZzoOxwcAaocoPCn2bMgFExxfM+ihNDV0wR9e14Do7F1YDXg8slRgXKZ1E@vger.kernel.org X-Gm-Message-State: AOJu0YwsKqVaBTmYUHMjSQ32LaoflWSw1mQ8C6kjSX1XFzxWGcHJHFo2 +bVUm+/CuODgjN3MF4uPk1IjVCF9vrZT4kp5KaL51/gva1pqnR7AXTEuYQ== X-Gm-Gg: ASbGncuqZZEaS4KBLtbRjdYXCp9ff+5J8/H8PvmM8TJoIbPUGPtGUXThDSrnYSkqK0Q 9x8gMXT1/9U5MoR4tNIf80bICCXze0fP7zwwSm1oLnD48PAlzxXRhZffKYIoPlqyRYmXHUARIFU G3k5uqUes1L4sZ1KGwgP068akg3b5leHv5m7dYOkjz6CyxL56hLUsj+97T8wfdXfYKx0+F+px4/ TVYzDW0tz1sS8fglLeNeLDbjiDL6dgBw0noz5Hp5u06YnqHToip6554oKW/PSpa X-Google-Smtp-Source: AGHT+IGiY6wDtxyzNArzNxqqFoVS6NtfNKBBvuJ8MEjVxrUPg+2iid77r6KklN4XmfBb1/qMmKF+jg== X-Received: by 2002:a05:6102:3a08:b0:4af:3973:6b22 with SMTP id ada2fe7eead31-4b3d0e8aad4mr23985995137.22.1736925087939; Tue, 14 Jan 2025 23:11:27 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:11:27 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 02/19] ACPI: platform_profile: Let drivers set drvdata to the class device Date: Wed, 15 Jan 2025 02:10:05 -0500 Message-ID: <20250115071022.4815-3-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add *drvdata to platform_profile_register() signature and assign it to the class device. While at it, pass specific driver state as drvdata to replace uses of container_of() with dev_get_drvdata(). Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 7 ++++--- drivers/platform/surface/surface_platform_profile.c | 6 +++--- drivers/platform/x86/acer-wmi.c | 2 +- drivers/platform/x86/amd/pmf/sps.c | 6 +++--- drivers/platform/x86/asus-wmi.c | 6 +++--- drivers/platform/x86/dell/alienware-wmi.c | 2 +- drivers/platform/x86/dell/dell-pc.c | 2 +- drivers/platform/x86/hp/hp-wmi.c | 2 +- drivers/platform/x86/ideapad-laptop.c | 6 +++--- drivers/platform/x86/inspur_platform_profile.c | 8 +++----- drivers/platform/x86/thinkpad_acpi.c | 2 +- include/linux/platform_profile.h | 4 ++-- 12 files changed, 26 insertions(+), 27 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 15f24adc57d4..689541d2e66c 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -460,7 +460,7 @@ int platform_profile_cycle(void) } EXPORT_SYMBOL_GPL(platform_profile_cycle); -int platform_profile_register(struct platform_profile_handler *pprof) +int platform_profile_register(struct platform_profile_handler *pprof, void *drvdata) { int err; @@ -480,6 +480,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) pprof->class_dev.class = &platform_profile_class; pprof->class_dev.parent = pprof->dev; + dev_set_drvdata(&pprof->class_dev, drvdata); dev_set_name(&pprof->class_dev, "platform-profile-%d", pprof->minor); err = device_register(&pprof->class_dev); if (err) { @@ -529,7 +530,7 @@ static void devm_platform_profile_release(struct device *dev, void *res) platform_profile_remove(*pprof); } -int devm_platform_profile_register(struct platform_profile_handler *pprof) +int devm_platform_profile_register(struct platform_profile_handler *pprof, void *drvdata) { struct platform_profile_handler **dr; int ret; @@ -538,7 +539,7 @@ int devm_platform_profile_register(struct platform_profile_handler *pprof) if (!dr) return -ENOMEM; - ret = platform_profile_register(pprof); + ret = platform_profile_register(pprof, drvdata); if (ret) { devres_free(dr); return ret; diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 6c87e982bfc8..edb9362003a4 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -161,7 +161,7 @@ static int ssam_platform_profile_get(struct platform_profile_handler *pprof, enum ssam_tmp_profile tp; int status; - tpd = container_of(pprof, struct ssam_platform_profile_device, handler); + tpd = dev_get_drvdata(&pprof->class_dev); status = ssam_tmp_profile_get(tpd->sdev, &tp); if (status) @@ -181,7 +181,7 @@ static int ssam_platform_profile_set(struct platform_profile_handler *pprof, struct ssam_platform_profile_device *tpd; int tp; - tpd = container_of(pprof, struct ssam_platform_profile_device, handler); + tpd = dev_get_drvdata(&pprof->class_dev); tp = convert_profile_to_ssam_tmp(tpd->sdev, profile); if (tp < 0) @@ -224,7 +224,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices); - return platform_profile_register(&tpd->handler); + return platform_profile_register(&tpd->handler, tpd); } static void surface_platform_profile_remove(struct ssam_device *sdev) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 57d6b680f5b9..4594beb4b9d7 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1939,7 +1939,7 @@ static int acer_platform_profile_setup(struct platform_device *device) set_bit(PLATFORM_PROFILE_LOW_POWER, platform_profile_handler.choices); - err = platform_profile_register(&platform_profile_handler); + err = platform_profile_register(&platform_profile_handler, NULL); if (err) return err; diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index bd2bd6cfc39a..259a598acd3e 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -285,7 +285,7 @@ bool is_pprof_balanced(struct amd_pmf_dev *pmf) static int amd_pmf_profile_get(struct platform_profile_handler *pprof, enum platform_profile_option *profile) { - struct amd_pmf_dev *pmf = container_of(pprof, struct amd_pmf_dev, pprof); + struct amd_pmf_dev *pmf = dev_get_drvdata(&pprof->class_dev); *profile = pmf->current_profile; return 0; @@ -366,7 +366,7 @@ int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev) static int amd_pmf_profile_set(struct platform_profile_handler *pprof, enum platform_profile_option profile) { - struct amd_pmf_dev *pmf = container_of(pprof, struct amd_pmf_dev, pprof); + struct amd_pmf_dev *pmf = dev_get_drvdata(&pprof->class_dev); int ret = 0; pmf->current_profile = profile; @@ -416,7 +416,7 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) set_bit(PLATFORM_PROFILE_PERFORMANCE, dev->pprof.choices); /* Create platform_profile structure and register */ - err = platform_profile_register(&dev->pprof); + err = platform_profile_register(&dev->pprof, dev); if (err) dev_err(dev->dev, "Failed to register SPS support, this is most likely an SBIOS bug: %d\n", err); diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index fdeebab96fc0..0c68635a0aa3 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3806,7 +3806,7 @@ static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof, struct asus_wmi *asus; int tp; - asus = container_of(pprof, struct asus_wmi, platform_profile_handler); + asus = dev_get_drvdata(&pprof->class_dev); tp = asus->throttle_thermal_policy_mode; switch (tp) { @@ -3832,7 +3832,7 @@ static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof, struct asus_wmi *asus; int tp; - asus = container_of(pprof, struct asus_wmi, platform_profile_handler); + asus = dev_get_drvdata(&pprof->class_dev); switch (profile) { case PLATFORM_PROFILE_PERFORMANCE: @@ -3887,7 +3887,7 @@ static int platform_profile_setup(struct asus_wmi *asus) set_bit(PLATFORM_PROFILE_PERFORMANCE, asus->platform_profile_handler.choices); - err = platform_profile_register(&asus->platform_profile_handler); + err = platform_profile_register(&asus->platform_profile_handler, asus); if (err == -EEXIST) { pr_warn("%s, a platform_profile handler is already registered\n", __func__); return 0; diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index b4b43f3e3fd9..28c39e25228e 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -1129,7 +1129,7 @@ static int create_thermal_profile(struct platform_device *platform_device) pp_handler.name = "alienware-wmi"; pp_handler.dev = &platform_device->dev; - return devm_platform_profile_register(&pp_handler); + return devm_platform_profile_register(&pp_handler, NULL); } /* diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 3797a5721dbd..1a0a721d706f 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -271,7 +271,7 @@ static int thermal_init(void) set_bit(PLATFORM_PROFILE_PERFORMANCE, thermal_handler->choices); /* Clean up if failed */ - ret = platform_profile_register(thermal_handler); + ret = platform_profile_register(thermal_handler, NULL); if (ret) goto cleanup_thermal_handler; diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 6d6e13a0c6e2..8e5e1422e024 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1629,7 +1629,7 @@ static int thermal_profile_setup(struct platform_device *device) set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices); - err = platform_profile_register(&platform_profile_handler); + err = platform_profile_register(&platform_profile_handler, NULL); if (err) return err; diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index dc98f862a06d..ed0d880a07a9 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -936,7 +936,7 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe static int dytc_profile_get(struct platform_profile_handler *pprof, enum platform_profile_option *profile) { - struct ideapad_dytc_priv *dytc = container_of(pprof, struct ideapad_dytc_priv, pprof); + struct ideapad_dytc_priv *dytc = dev_get_drvdata(&pprof->class_dev); *profile = dytc->current_profile; return 0; @@ -989,7 +989,7 @@ static int dytc_cql_command(struct ideapad_private *priv, unsigned long cmd, static int dytc_profile_set(struct platform_profile_handler *pprof, enum platform_profile_option profile) { - struct ideapad_dytc_priv *dytc = container_of(pprof, struct ideapad_dytc_priv, pprof); + struct ideapad_dytc_priv *dytc = dev_get_drvdata(&pprof->class_dev); struct ideapad_private *priv = dytc->priv; unsigned long output; int err; @@ -1114,7 +1114,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) set_bit(PLATFORM_PROFILE_PERFORMANCE, priv->dytc->pprof.choices); /* Create platform_profile structure and register */ - err = platform_profile_register(&priv->dytc->pprof); + err = platform_profile_register(&priv->dytc->pprof, &priv->dytc); if (err) goto pp_reg_failed; diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 53af73a7fbf7..471fca50d1c9 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -87,8 +87,7 @@ static int inspur_wmi_perform_query(struct wmi_device *wdev, static int inspur_platform_profile_set(struct platform_profile_handler *pprof, enum platform_profile_option profile) { - struct inspur_wmi_priv *priv = container_of(pprof, struct inspur_wmi_priv, - handler); + struct inspur_wmi_priv *priv = dev_get_drvdata(&pprof->class_dev); u8 ret_code[4] = {0, 0, 0, 0}; int ret; @@ -135,8 +134,7 @@ static int inspur_platform_profile_set(struct platform_profile_handler *pprof, static int inspur_platform_profile_get(struct platform_profile_handler *pprof, enum platform_profile_option *profile) { - struct inspur_wmi_priv *priv = container_of(pprof, struct inspur_wmi_priv, - handler); + struct inspur_wmi_priv *priv = dev_get_drvdata(&pprof->class_dev); u8 ret_code[4] = {0, 0, 0, 0}; int ret; @@ -186,7 +184,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) set_bit(PLATFORM_PROFILE_BALANCED, priv->handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, priv->handler.choices); - return platform_profile_register(&priv->handler); + return platform_profile_register(&priv->handler, priv); } static void inspur_wmi_remove(struct wmi_device *wdev) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 22f871e9f53c..fe37c26891d8 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10640,7 +10640,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) dytc_profile.dev = &tpacpi_pdev->dev; /* Create platform_profile structure and register */ - err = platform_profile_register(&dytc_profile); + err = platform_profile_register(&dytc_profile, NULL); /* * If for some reason platform_profiles aren't enabled * don't quit terminally. diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 8a9b8754f9ac..1c8fdda51eaa 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -40,9 +40,9 @@ struct platform_profile_handler { enum platform_profile_option profile); }; -int platform_profile_register(struct platform_profile_handler *pprof); +int platform_profile_register(struct platform_profile_handler *pprof, void *drvdata); int platform_profile_remove(struct platform_profile_handler *pprof); -int devm_platform_profile_register(struct platform_profile_handler *pprof); +int devm_platform_profile_register(struct platform_profile_handler *pprof, void *drvdata); int platform_profile_cycle(void); void platform_profile_notify(struct platform_profile_handler *pprof); From patchwork Wed Jan 15 07:10:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857663 Received: from mail-ua1-f48.google.com (mail-ua1-f48.google.com [209.85.222.48]) (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 9000422FE15; Wed, 15 Jan 2025 07:11:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925106; cv=none; b=SAy0xFDddr5pLiEm7OugozAqPK7z0TsKFxPvAL1iq4n2N9V077HTDqyJns5dcxa6CMLq7yzR9E5pzNFpKfkSeCEFg0youRpmi55xunCaIaqgyd+MrC6KiBgydTbcqAXx7WAlqFSoTtyG/qfsDJc/7vtYMt8NRn6C1cdh+0H/CAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925106; c=relaxed/simple; bh=XEz9oJAUBT2RwLxUnHLdSRU8aJjoAvp9C2HU2zGLkJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r81paWNUOlCqFRxh+kGsfUqokw/KLKcMNwmC/RAVdhsI9E31CyerwIdPWa3hcouT43ZD7/7jvNbljIZgMMYo/uKRCtHuXrW1iLHxf53P8tsVqwP0B6RI5Z1+VuhKk9pD/GSQ/xOetm3HbuwyQmViptzZOtLNIwTvSGTRSW68brA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f4oepZOZ; arc=none smtp.client-ip=209.85.222.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="f4oepZOZ" Received: by mail-ua1-f48.google.com with SMTP id a1e0cc1a2514c-85c436db302so291688241.0; Tue, 14 Jan 2025 23:11:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925103; x=1737529903; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e49qYcPnDENsUUC2orJ2fqi6GUiaqPE5ESOJS7IvRv0=; b=f4oepZOZi7cnlTtRBjTqMnbaAqpALTLXkNFmeJOAs7WpVQxHizcMDCvH/8Dai0SWvH nVsfkssEJIDsilmT12JInxsAOpQpfrOEHgilfbPj5jOE5rMSoQuLrYfPQdvqhJsVl1rc cRboQwDJK47vD5uMBVAf6ZT0NrYVYydPaKheDYDxpKvRnhen0b+MMdDLZ516+FiLapcf uKS85AF/xDwGXeuBCAcl03UeqO2XJJKgPgzHLUeCnhWpisb1+Dp4RxtFzTZQNq9346lY wj6KpLpdqhNU+tp1X/NB5z4zoMcmjH1sL01UcXn8kDRfpa21RvbPtEnRzHBhZW3/sMEN fe6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925103; x=1737529903; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e49qYcPnDENsUUC2orJ2fqi6GUiaqPE5ESOJS7IvRv0=; b=VS6LjQcSDz4MjGHIm9JBOg0suznRi3NOI4lcGsesI/JDn0+14oQ9MrqRMeVKovpO/M gnlxgNWVLERXLAv3zwEmNI+7vjc2lMzBcyZpFayjbAnbkkVKikSybebaUZbtxxyciNdE 6wS0ZLRGMp5yBwv1pz2UnLl4Sfpal8j5HvPfagL92j1TDL7on50Vexdx42r5s8t2q8ET F+lwvAbAatK0CzAM0h3ukyazGDeZ1lS7AhjEImqhMhTr2Wi7ewrgJH1JyM6mXEQpl2IQ rApkR7kmRVjeirmkUbGlbwUtm3r3CCOIaGrWcNO55QW13F3+gVblmoIomH7/8d4ezWoX Xaqg== X-Forwarded-Encrypted: i=1; AJvYcCV289xybPscgnFanDhtsi3ykG7Iy17y8qXDJgSAq1AT7Y8HYyxYuhw2WiowVr06dhcXMyvyVsqvx1mX@vger.kernel.org, AJvYcCVM/cBg8rIW0TXvbY3FPyCOCQ+wBV/HcA+V0cBt7rhkzI1u8T37q4Ih5VKu8phuhW2cvTuVgso6NkhU4KEI@vger.kernel.org X-Gm-Message-State: AOJu0YxekA81UXhsUK1AzRW536FrhyKVx2wYvfbp49+l30lDyAFLVPO1 gZQXlhRmVRb/2b+K7ThWV896k0sE9ZxNPiW05sHgxqyNAdoFyju41bzRdA== X-Gm-Gg: ASbGncuGGXMJt0LyhCS6hDm2+rtkhiZ1FBF3NSGA5PWne1i32lldkxN4CfNLNYOhZy7 FsuxHToiEAj+bG2jp/+SJdmF5rl1U1BMACJcYEELJEoE5XbjoTupY4ZZ53sS4soo8lMLmK+gewQ Jz/GB6c4qUoVEdgoTXWbniXR16jty4hq7ickjG8y0TJ2qNvk0WaRKk2KfOLh8KKLsFE7EqyL78r USl2ud37m2DZywnxxVA26YxkCAy7KBEtv2+Cwu+GKVrI2KPiLRxGuR1Y5YwXula X-Google-Smtp-Source: AGHT+IEEdrS3q62CSm0iKBYHybP2NH0M3rXKaBQiKxk0Qm+uq7Lq/BJd0S2S768JFwkCnbwoEAS5/Q== X-Received: by 2002:a05:6102:41a8:b0:4af:d4f8:caee with SMTP id ada2fe7eead31-4b669ed1c8dmr1325715137.1.1736925102978; Tue, 14 Jan 2025 23:11:42 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:11:42 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 04/19] ACPI: platform_profile: Add `ops` member to handlers Date: Wed, 15 Jan 2025 02:10:07 -0500 Message-ID: <20250115071022.4815-5-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace *profile_get and *profile_set members with a general *ops member. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 6 ++--- .../surface/surface_platform_profile.c | 8 +++++-- drivers/platform/x86/acer-wmi.c | 11 +++++---- drivers/platform/x86/amd/pmf/sps.c | 8 +++++-- drivers/platform/x86/asus-wmi.c | 8 +++++-- drivers/platform/x86/dell/alienware-wmi.c | 8 +++++-- drivers/platform/x86/dell/dell-pc.c | 8 +++++-- drivers/platform/x86/hp/hp-wmi.c | 24 ++++++++++++++----- drivers/platform/x86/ideapad-laptop.c | 8 +++++-- .../platform/x86/inspur_platform_profile.c | 8 +++++-- drivers/platform/x86/thinkpad_acpi.c | 8 +++++-- include/linux/platform_profile.h | 10 ++++++-- 12 files changed, 84 insertions(+), 31 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index bd90aa4e8371..161a05d57b0f 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -65,7 +65,7 @@ static int _store_class_profile(struct device *dev, void *data) if (!test_bit(*bit, handler->choices)) return -EOPNOTSUPP; - return handler->profile_set(dev, *bit); + return handler->ops->profile_set(dev, *bit); } /** @@ -102,7 +102,7 @@ static int get_class_profile(struct device *dev, lockdep_assert_held(&profile_lock); handler = to_pprof_handler(dev); - err = handler->profile_get(dev, &val); + err = handler->ops->profile_get(dev, &val); if (err) { pr_err("Failed to get profile for handler %s\n", handler->name); return err; @@ -466,7 +466,7 @@ int platform_profile_register(struct platform_profile_handler *pprof, void *drvd /* Sanity check the profile handler */ if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || - !pprof->profile_set || !pprof->profile_get) { + !pprof->ops->profile_set || !pprof->ops->profile_get) { pr_err("platform_profile: handler is invalid\n"); return -EINVAL; } diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 26c1230e75df..76967bfeeef8 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -201,6 +201,11 @@ static int ssam_platform_profile_set(struct device *dev, return tp; } +static const struct platform_profile_ops ssam_platform_profile_ops = { + .profile_get = ssam_platform_profile_get, + .profile_set = ssam_platform_profile_set, +}; + static int surface_platform_profile_probe(struct ssam_device *sdev) { struct ssam_platform_profile_device *tpd; @@ -214,8 +219,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) tpd->handler.name = "Surface Platform Profile"; tpd->handler.dev = &sdev->dev; - tpd->handler.profile_get = ssam_platform_profile_get; - tpd->handler.profile_set = ssam_platform_profile_set; + tpd->handler.ops = &ssam_platform_profile_ops; tpd->has_fan = device_property_read_bool(&sdev->dev, "has_fan"); diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index d609bd105db3..91ae48adf6cf 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1916,6 +1916,11 @@ acer_predator_v4_platform_profile_set(struct device *dev, return 0; } +static const struct platform_profile_ops acer_predator_v4_platform_profile_ops = { + .profile_get = acer_predator_v4_platform_profile_get, + .profile_set = acer_predator_v4_platform_profile_set, +}; + static int acer_platform_profile_setup(struct platform_device *device) { if (quirks->predator_v4) { @@ -1923,10 +1928,8 @@ static int acer_platform_profile_setup(struct platform_device *device) platform_profile_handler.name = "acer-wmi"; platform_profile_handler.dev = &device->dev; - platform_profile_handler.profile_get = - acer_predator_v4_platform_profile_get; - platform_profile_handler.profile_set = - acer_predator_v4_platform_profile_set; + platform_profile_handler.ops = + &acer_predator_v4_platform_profile_ops; set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices); diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index cf2e51f67787..6ae82ae86d22 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -387,6 +387,11 @@ static int amd_pmf_profile_set(struct device *dev, return 0; } +static const struct platform_profile_ops amd_pmf_profile_ops = { + .profile_get = amd_pmf_profile_get, + .profile_set = amd_pmf_profile_set, +}; + int amd_pmf_init_sps(struct amd_pmf_dev *dev) { int err; @@ -407,8 +412,7 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) dev->pprof.name = "amd-pmf"; dev->pprof.dev = dev->dev; - dev->pprof.profile_get = amd_pmf_profile_get; - dev->pprof.profile_set = amd_pmf_profile_set; + dev->pprof.ops = &amd_pmf_profile_ops; /* Setup supported modes */ set_bit(PLATFORM_PROFILE_LOW_POWER, dev->pprof.choices); diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 9bed170abb92..d88860dd028b 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3852,6 +3852,11 @@ static int asus_wmi_platform_profile_set(struct device *dev, return throttle_thermal_policy_write(asus); } +static const struct platform_profile_ops asus_wmi_platform_profile_ops = { + .profile_get = asus_wmi_platform_profile_get, + .profile_set = asus_wmi_platform_profile_set, +}; + static int platform_profile_setup(struct asus_wmi *asus) { struct device *dev = &asus->platform_device->dev; @@ -3878,8 +3883,7 @@ static int platform_profile_setup(struct asus_wmi *asus) asus->platform_profile_handler.name = "asus-wmi"; asus->platform_profile_handler.dev = dev; - asus->platform_profile_handler.profile_get = asus_wmi_platform_profile_get; - asus->platform_profile_handler.profile_set = asus_wmi_platform_profile_set; + asus->platform_profile_handler.ops = &asus_wmi_platform_profile_ops; set_bit(PLATFORM_PROFILE_QUIET, asus->platform_profile_handler.choices); set_bit(PLATFORM_PROFILE_BALANCED, diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index b8131b803368..f7a854d40575 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -1078,6 +1078,11 @@ static int thermal_profile_set(struct device *dev, return wmax_thermal_control(supported_thermal_profiles[profile]); } +static const struct platform_profile_ops awcc_platform_profile_ops = { + .profile_get = thermal_profile_get, + .profile_set = thermal_profile_set, +}; + static int create_thermal_profile(struct platform_device *platform_device) { enum platform_profile_option profile; @@ -1124,10 +1129,9 @@ static int create_thermal_profile(struct platform_device *platform_device) set_bit(PLATFORM_PROFILE_PERFORMANCE, pp_handler.choices); } - pp_handler.profile_get = thermal_profile_get; - pp_handler.profile_set = thermal_profile_set; pp_handler.name = "alienware-wmi"; pp_handler.dev = &platform_device->dev; + pp_handler.ops = &awcc_platform_profile_ops; return devm_platform_profile_register(&pp_handler, NULL); } diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index c86b05b5a1cb..9010a231f209 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -231,6 +231,11 @@ static int thermal_platform_profile_get(struct device *dev, return 0; } +static const struct platform_profile_ops dell_pc_platform_profile_ops = { + .profile_get = thermal_platform_profile_get, + .profile_set = thermal_platform_profile_set, +}; + static int thermal_init(void) { int ret; @@ -258,8 +263,7 @@ static int thermal_init(void) } thermal_handler->name = "dell-pc"; thermal_handler->dev = &platform_device->dev; - thermal_handler->profile_get = thermal_platform_profile_get; - thermal_handler->profile_set = thermal_platform_profile_set; + thermal_handler->ops = &dell_pc_platform_profile_ops; if (supported_modes & DELL_QUIET) set_bit(PLATFORM_PROFILE_QUIET, thermal_handler->choices); diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index b8e62dc9cecd..60328b35be74 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1565,6 +1565,21 @@ static inline void omen_unregister_powersource_event_handler(void) unregister_acpi_notifier(&platform_power_source_nb); } +static const struct platform_profile_ops platform_profile_omen_ops = { + .profile_get = platform_profile_omen_get, + .profile_set = platform_profile_omen_set, +}; + +static const struct platform_profile_ops platform_profile_victus_ops = { + .profile_get = platform_profile_victus_get, + .profile_set = platform_profile_victus_set, +}; + +static const struct platform_profile_ops hp_wmi_platform_profile_ops = { + .profile_get = hp_wmi_platform_profile_get, + .profile_set = hp_wmi_platform_profile_set, +}; + static int thermal_profile_setup(struct platform_device *device) { int err, tp; @@ -1582,8 +1597,7 @@ static int thermal_profile_setup(struct platform_device *device) if (err < 0) return err; - platform_profile_handler.profile_get = platform_profile_omen_get; - platform_profile_handler.profile_set = platform_profile_omen_set; + platform_profile_handler.ops = &platform_profile_omen_ops; set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); } else if (is_victus_thermal_profile()) { @@ -1599,8 +1613,7 @@ static int thermal_profile_setup(struct platform_device *device) if (err < 0) return err; - platform_profile_handler.profile_get = platform_profile_victus_get; - platform_profile_handler.profile_set = platform_profile_victus_set; + platform_profile_handler.ops = &platform_profile_victus_ops; set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices); } else { @@ -1617,8 +1630,7 @@ static int thermal_profile_setup(struct platform_device *device) if (err) return err; - platform_profile_handler.profile_get = hp_wmi_platform_profile_get; - platform_profile_handler.profile_set = hp_wmi_platform_profile_set; + platform_profile_handler.ops = &hp_wmi_platform_profile_ops; set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices); set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index fc317f42bb82..96e99513b0b5 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1063,6 +1063,11 @@ static const struct dmi_system_id ideapad_dytc_v4_allow_table[] = { {} }; +static const struct platform_profile_ops dytc_profile_ops = { + .profile_get = dytc_profile_get, + .profile_set = dytc_profile_set, +}; + static int ideapad_dytc_profile_init(struct ideapad_private *priv) { int err, dytc_version; @@ -1105,8 +1110,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) priv->dytc->pprof.name = "ideapad-laptop"; priv->dytc->pprof.dev = &priv->platform_device->dev; priv->dytc->priv = priv; - priv->dytc->pprof.profile_get = dytc_profile_get; - priv->dytc->pprof.profile_set = dytc_profile_set; + priv->dytc->pprof.ops = &dytc_profile_ops; /* Setup supported modes */ set_bit(PLATFORM_PROFILE_LOW_POWER, priv->dytc->pprof.choices); diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 47d2dbbf3392..d0a8e4eebffa 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -164,6 +164,11 @@ static int inspur_platform_profile_get(struct device *dev, return 0; } +static const struct platform_profile_ops inspur_platform_profile_ops = { + .profile_get = inspur_platform_profile_get, + .profile_set = inspur_platform_profile_set, +}; + static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) { struct inspur_wmi_priv *priv; @@ -177,8 +182,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) priv->handler.name = "inspur-wmi"; priv->handler.dev = &wdev->dev; - priv->handler.profile_get = inspur_platform_profile_get; - priv->handler.profile_set = inspur_platform_profile_set; + priv->handler.ops = &inspur_platform_profile_ops; set_bit(PLATFORM_PROFILE_LOW_POWER, priv->handler.choices); set_bit(PLATFORM_PROFILE_BALANCED, priv->handler.choices); diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 47f87bb213a9..9978fd36a3d1 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10538,12 +10538,16 @@ static int dytc_profile_set(struct device *dev, return err; } -static struct platform_profile_handler dytc_profile = { - .name = "thinkpad-acpi", +static const struct platform_profile_ops dytc_profile_ops = { .profile_get = dytc_profile_get, .profile_set = dytc_profile_set, }; +static struct platform_profile_handler dytc_profile = { + .name = "thinkpad-acpi", + .ops = &dytc_profile_ops, +}; + static void dytc_profile_refresh(void) { enum platform_profile_option profile; diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 5296d886c243..6013c05d7b86 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -28,14 +28,20 @@ enum platform_profile_option { PLATFORM_PROFILE_LAST, /*must always be last */ }; +struct platform_profile_handler; + +struct platform_profile_ops { + int (*profile_get)(struct device *dev, enum platform_profile_option *profile); + int (*profile_set)(struct device *dev, enum platform_profile_option profile); +}; + struct platform_profile_handler { const char *name; struct device *dev; struct device class_dev; int minor; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; - int (*profile_get)(struct device *dev, enum platform_profile_option *profile); - int (*profile_set)(struct device *dev, enum platform_profile_option profile); + const struct platform_profile_ops *ops; }; int platform_profile_register(struct platform_profile_handler *pprof, void *drvdata); From patchwork Wed Jan 15 07:10:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857662 Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) (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 40411234D1A; Wed, 15 Jan 2025 07:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925120; cv=none; b=mzK6mz+TZxgO1Iou8RoEueCZqKJyrn4HvazKtspWX/XjEYyUrmHGj/eAGayRizKEPjijZGjcLsXN/MuwhDZ6hQ78wF2gnQk+4RAwAq4ph2OZz51mpiq3by45cRGWH1ciQT+Kek7NtkcK2JxCpQY2+bVduPM+GxFPFto27x7PuKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925120; c=relaxed/simple; bh=xxpFolKZ3QIWrSeNZx2UGrFKgXHvd9r/4p1nFCx3I6c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V1oUWD3pmi9VavO6d4TUvk0JMOeMWs8lvevUAWwoZAR/MsqbRsz6pnycFrxN9DMa/ApX+KzNMj1C5JV7kTm4jSfiUU3v2BEFjSh7ceG62MKBiPob/GLHNJq3JLX8+Nxjb3ozYkOzCLw8zmQWU6eKGTYKNgmQ5FUsOmcDbFxN8d0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dcUKB69K; arc=none smtp.client-ip=209.85.222.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="dcUKB69K" Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-85c4b057596so1386659241.3; Tue, 14 Jan 2025 23:11:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925117; x=1737529917; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c3ef8ZxwB/RtbrqRwLVcEe60IFIru377XMlbDqmQIbY=; b=dcUKB69KqGzrnsH6Jai6Dfb8VIhBXExA4l6ihoF6cHyS/rabPo5yZ8DPlJwDb54J7/ G3ZAvb8q6ukcfjGzOpbCju2I77R2OK/bghEoxApLxy65mQkGwxnZZZfBhbj7TIBzkzL6 5HNC6TqdU2BJ5W3+8edk5YyAIBaYas0YCsO6qYVyP1YyhppFBNyZFa7KSSFNuFijjdgA hGg6/LiLbPj5B/8kZ42c7uIcEs4tjwUptQQEsSFYsVy91YPO5tcK9ItzUndQlvH+lGeG WSt31oRfxB7nPEFqVz/0n+rNy7yHcafkNmtIVhLkX7onUk4vMOQ8gBe3H5XDju688Pq6 BjNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925117; x=1737529917; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c3ef8ZxwB/RtbrqRwLVcEe60IFIru377XMlbDqmQIbY=; b=ZaT9NM8EIGPm2Jg3r6Y2fqmlhHsJkQYj7A9Lf1WeIrLT/nl7eGZ2tMq7NDN5HJ3Uym 2XK3Em/vNWSUbjcF7tuuIf7LkjQJ54+ySKJ2Inyksn4mI4dQNxONnZZMd81VjeveQDJl qHPpgox2w5DzVbMwkBLq3ICb+5LgY5LPxriQCvQAWdKoz2K/dH1mTcJKN7n9Cd8DB1KI M+wq/3WLu9wvU0+Rzl/bTbUfVO6NFbNhx6iLxLi/kkP/FhDm6Cbw6TdPmbRf3ZqEkEQa Un3g5Pa2EfpYH7BC253fVhFzrvNrMlVdJ3EXnTC7qMnOh9Z26Fe0M2p5WY5iHYb3F8nG QVmw== X-Forwarded-Encrypted: i=1; AJvYcCWP1Pr4zVmRlSzaMqS30BuTnNRWrfQq45NjRonA5TzfbcUjgfAcoIoHzlZFKUglm75VT8bg1iG6LGE4VZJM@vger.kernel.org, AJvYcCXbh3PyQCeuPuPd7Hc7rPAlvMNDirLY53Y+wMYldGLmaTDPvTUYsERn5nhq2D6Dlf4JwNE27pcz/0lJ@vger.kernel.org X-Gm-Message-State: AOJu0YyZDJCoYqmikgpzrUrcuSVsTRW07WC6sw3jH/7DF/f/yG5YYcuJ nS+HvS3bsMGXvpR7gJNXwu0N9RoqCdigFct5iqM8JifcxJk+V5fPu0tEiA== X-Gm-Gg: ASbGnctpIpdcT8i+qOuOdod+6f3bQdt8cX5D1eij/5MBN/ACoOGahNowMPP2PMGjs8l rUVM1l10Op7Mzw2CFKtnINV/UxLHGNMH0zB/irIyVHYLLYr//u34kNAVMttYa7tza2fSnX6h/XY 2sWxI9LwkwdQ3wE+Sl24L5KDFmKZyRnbbpgXf7dWvuRzBlFGOL0y3Yf6egaTndQHaMGUIvKb2mC Cv8fddquv13gNgG7OZOQ6uIquUaCKRPkUMhYuIxH5sEXK+/nOd0cmuX6uyQPWtz X-Google-Smtp-Source: AGHT+IG9UZghEc6LXZuT2SOZCui+uTBb38w3hHu+Rkg5xOIGNBNMHwfFOdoktEnAcVwFa0iZv/PkQQ== X-Received: by 2002:a05:6102:1624:b0:4b2:5c4b:55e7 with SMTP id ada2fe7eead31-4b3d106a3a0mr24283737137.25.1736925117607; Tue, 14 Jan 2025 23:11:57 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:11:56 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 06/19] platform/surface: surface_platform_profile: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:09 -0500 Message-ID: <20250115071022.4815-7-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace platform_profile_register() with it's device managed version. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/surface/surface_platform_profile.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 48cfe9cb89c8..bbdc873cb788 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -234,15 +234,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) tpd->has_fan = device_property_read_bool(&sdev->dev, "has_fan"); - return platform_profile_register(&tpd->handler, tpd); -} - -static void surface_platform_profile_remove(struct ssam_device *sdev) -{ - struct ssam_platform_profile_device *tpd; - - tpd = ssam_device_get_drvdata(sdev); - platform_profile_remove(&tpd->handler); + return devm_platform_profile_register(&tpd->handler, tpd); } static const struct ssam_device_id ssam_platform_profile_match[] = { @@ -253,7 +245,6 @@ MODULE_DEVICE_TABLE(ssam, ssam_platform_profile_match); static struct ssam_device_driver surface_platform_profile = { .probe = surface_platform_profile_probe, - .remove = surface_platform_profile_remove, .match_table = ssam_platform_profile_match, .driver = { .name = "surface_platform_profile", From patchwork Wed Jan 15 07:10:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857661 Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) (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 EE56E2309B3; Wed, 15 Jan 2025 07:12:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925135; cv=none; b=sRDmyH53RwViWDsB1YWyQtBYsb7AOCSRIOc51b7sd/F82aPE5BB4NxFZ1Qx1zv0dZb1fiaEWlCg8L8A3gXvudJd2KrDFxtRZZ+Of8FNyj4gTpkYKD+1l+qSLeYQyh8rbwIwKJLm5SGz5unDK9vynSEVbWDZnra4rFs+aTnuKraI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925135; c=relaxed/simple; bh=oxgHftrvXpsaeUmf64aRPx7+pUW+fVHAj8lkNglYXtw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ROzkC/YYDOq6y6cLw7ekr47e+qbCsnmDlpVjx9hgNyZNPJteVudRFrV/5+tc2QSH8wuNChLrv83CKpVKMxPA3b8j/NeuAUiJ49ioy/NIIU6h9e7NXDHxdcfzcEslajFbqPm0GZlCTv5+N0JkZ0aMYW1m6x1ZeEvYhbvfCqGp+7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VRvDiCgT; arc=none smtp.client-ip=209.85.217.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="VRvDiCgT" Received: by mail-vs1-f43.google.com with SMTP id ada2fe7eead31-4afdd15db60so1984132137.1; Tue, 14 Jan 2025 23:12:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925132; x=1737529932; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lttd5e/XgGU5D1dWcZNa2fZ0ZfD8k7ZaaUNVAG5OZco=; b=VRvDiCgT9H3HnYL6Y53PTsxDHcfAScJTguJPnPAusZ8+sZIB/m5ahnBeQ90kej+GXp pqpZ5UrLfV8pspfT7qLMMzmgZopDfENd/dw+eA+Dl57L3Cx/m6/y70iI5tNGWCNYP2mL 92LgfIwVavAju4hZ6mUK5f6yiSyLRkxdMD4vdkbQLOUcOUwIIVqiGxj75NEVpLBfne28 grokMgMLrf+TZ8XqN+oAZ1ZOvBAXWWU3RCoR02isf/bE8K4TxDEW1fc0vQGyPtZlow8+ +eYIs8D4L0TvoTDVy5eFI31IFO4OHk2G0teNAICetWjdicfBcMeDbEbj9mUZ+MzxYjxQ YZ6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925132; x=1737529932; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lttd5e/XgGU5D1dWcZNa2fZ0ZfD8k7ZaaUNVAG5OZco=; b=Cy323rlaI09yIRv+dueUAeUgn1QVQd4y/0L5NyPix7F1hrJctKPDny7zJQPxrCS7mx aRaGPZMd5WdZmUY/IthDNnf0iJWFD7x3qbZN3fgVYT1b7v1SKY8Bn5Q3glKFafuhnlSC YBW2OHXZ5hor0RSepCJG7T5DQ/CCxwMoFp4Lsj+upPh46+Law4eCobSiC92onEuy7KOm CUARXt/WosgfeELeO89a9yDGOzs6olqHifHRS2oO66/klYaGQAjIFn+i58X+mQEHuAZh RXYw5vZ0Fzh0FVCBoWb+Azi9jBKtOtEVJHLRFPvp0kA/j8kouoaSGpmW6Eo6+0PPeqke MFxA== X-Forwarded-Encrypted: i=1; AJvYcCUfkkqx1j5lJJWXnDDfFYW1DQPVkXU0fKxXnB/lGdmRo1eFSMvjApDX948IqvXJ6UR68BBOIFE9PJ1a@vger.kernel.org, AJvYcCXoBF9VJl+K6X4EpvkhHGZ01OxNmAGrwmF7OYNjvuA1lBwAeJy2Q7bIgErrpiMZxHNFNOIPIN2GodwYV76F@vger.kernel.org X-Gm-Message-State: AOJu0YwEAhlbN3YpAFgv75rRwKhLWMZDVypfExURaUlh359EtTFjnBkP fzx1neoxNkuD8ufAB3JNg7pK7lU7EocmZWLNYhQJvDAChEl0687YTvklcg== X-Gm-Gg: ASbGncu8zw/lvV9AfcEjZy7+DUivEKbXRNPuyXum5U+ZcB8Vg/czekbD3iykXexKfiy oU0CvVcRhc4trONwgV4XxHI2SOzrBdh8/m2XHWYaxet8DxRumDqCFBzuRLg0spKdvWoOHmv4omG iEa46u4g1fDwhm69Rx4AAgvmJDi8bBRG4fGclHYJ2TTbjwiSEDiDxczrGBsyIo6LEGWBFcHqcrR kt1QP5jr6rdzI9A9hOqKRCTVGgryeraJCZYpn6tlP91DM3zbB93BC0q175Qt9KL X-Google-Smtp-Source: AGHT+IHILB1uzLUhtVDU8UGO3sIb6FO+6bCvUtaVO9PY5aLhHwham5BMinNn19cI79JKKSvG7HWJcw== X-Received: by 2002:a05:6102:b06:b0:4af:adf8:523f with SMTP id ada2fe7eead31-4b3d0f97294mr20423665137.9.1736925132467; Tue, 14 Jan 2025 23:12:12 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:12:11 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 08/19] platform/x86: amd: pmf: sps: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:11 -0500 Message-ID: <20250115071022.4815-9-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace platform_profile_register() with it's device managed version. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/amd/pmf/core.c | 1 - drivers/platform/x86/amd/pmf/pmf.h | 1 - drivers/platform/x86/amd/pmf/sps.c | 7 +------ 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index 57ee95a327be..1211a753fee8 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -371,7 +371,6 @@ static void amd_pmf_deinit_features(struct amd_pmf_dev *dev) if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR) || is_apmf_func_supported(dev, APMF_FUNC_OS_POWER_SLIDER_UPDATE)) { power_supply_unreg_notifier(&dev->pwr_src_notifier); - amd_pmf_deinit_sps(dev); } if (dev->smart_pc_enabled) { diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 080818dd173b..d99b3556205b 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -780,7 +780,6 @@ int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf); void amd_pmf_update_slider(struct amd_pmf_dev *dev, bool op, int idx, struct amd_pmf_static_slider_granular *table); int amd_pmf_init_sps(struct amd_pmf_dev *dev); -void amd_pmf_deinit_sps(struct amd_pmf_dev *dev); int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev, struct apmf_static_slider_granular_output *output); bool is_pprof_balanced(struct amd_pmf_dev *pmf); diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index e710405b581f..7c7ed2b9de01 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -425,15 +425,10 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) dev->pprof.ops = &amd_pmf_profile_ops; /* Create platform_profile structure and register */ - err = platform_profile_register(&dev->pprof, dev); + err = devm_platform_profile_register(&dev->pprof, dev); if (err) dev_err(dev->dev, "Failed to register SPS support, this is most likely an SBIOS bug: %d\n", err); return err; } - -void amd_pmf_deinit_sps(struct amd_pmf_dev *dev) -{ - platform_profile_remove(&dev->pprof); -} From patchwork Wed Jan 15 07:10:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857660 Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) (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 CFEAB234D0C; Wed, 15 Jan 2025 07:12:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925150; cv=none; b=UpuilNuz58ZomHdVQtY5IMA/QhsJlIHhvvVxwoRnU3XfbFUOtSVEuAFmSwHS1qB5wRkdgZQItl5njPIndumi9+3o0N1VawTRjgFj3HgiDqd3ozQF7b2MLdmkT8/2alc1jyhOwwgfSXW3Z6ZtKSwCiI80/xU7ycPPRcmFuS1geLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925150; c=relaxed/simple; bh=si37KGSHX/ewSFMJ+nzgzSZQFSgJ2idpK6K/FB1yymg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TE1O7C+eoHpsDGrj9S6YiVrKIf1MhaJ6yLQg5JtIy4r4BldtGzX98CVqFa7tE0gE+X+0PARC52pdjNSMg3ZfCJ/euMqQgBaWcwIhHKr18xgOjtm9OuoNLS7IbkjgyMNuEFCmOwz/muxpDas1+uYYRceKDpxmwJKNXSHtC30+ZAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P0Ps1oi9; arc=none smtp.client-ip=209.85.217.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="P0Ps1oi9" Received: by mail-vs1-f42.google.com with SMTP id ada2fe7eead31-4aff78a39e1so2091156137.1; Tue, 14 Jan 2025 23:12:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925147; x=1737529947; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pXqMhXSFhpzzUaGn7Ji6wnQLUeEerxmcX7mppMJSFzk=; b=P0Ps1oi9A3EFjb0NQHlfWPg6e/V5sea9d+7BTxhXadowEOb7OqADkaTcnRvTX1bbcg ScxQJ7VsqodK/Ig/rwAIkq7W5cKG9Om3L4sudKSwl2DrAJR5L/r3qVW/3gsWZ4PQgZa1 GDtiHE+HDje+hAd0xVJDJAvgpdzRvtvmsz2HBVdcS1yU2vbOfKcmVfk0Boi9Qec9Gr93 xCvxWIQ5bRmtS1boHbVGjw1yLcpcI7oRdUIG+Py1oyaZTgUa3VtF1chSRiQnNM8FQ8Fz qGy2Y9tu0Pa7NpBxpKTBbJMfT7/5XqhqPnpJ3mxj/T1qmDmqL9ZQQ61M2Kdqbbw7EH5E x3PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925147; x=1737529947; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pXqMhXSFhpzzUaGn7Ji6wnQLUeEerxmcX7mppMJSFzk=; b=luB8Xm3FBeS27PeM4VSXkU6FLEKJGQAoRCT7Pl+p7IG+Z/vyDOdEAzv45+ivI7crss Z9VVuqTB1xUT4fY07F4e0nlm70QIdw69lrLySkX+h8DeUVVMXuMFQl8E+Qlq4anVszes Sr0fWukMcCcxCsIoDmGrxkjL0n/0oGJWG27WWE+fkC0nL62hQApUmYr61dYvS3nyAG9s 4u8/iDrfmCLq/xYyTlr/I1U9Xi3xlZKFjbLpSPKdoZUhJuolvyfYp5aTvGhhUQgiSkur mOjKW5Vb8OetMFyyG1Ph7OT3/Iz/q6P1JI33LfhR1kQQuHRgXw1k97pEdRDDmbza8v1W kXqg== X-Forwarded-Encrypted: i=1; AJvYcCW7+rYxIibSPNK3CugYz3Isgs1nFFMwFCLtLAilRzEYYNEMgM5cTcrjn8oVPPPmgCp2/08VD7P1Ru7GUiNg@vger.kernel.org, AJvYcCXl8rLgm5Vh2qLgxNubgUSMnqnUp+ZIqVx6T9p6R+xasqVzdZHatsDdafRIPaCf5D0oXXxgKegMWvmM@vger.kernel.org X-Gm-Message-State: AOJu0YwAK+EmEwaVjcd4ypO9zR2ANxWG5SGSOb07fkbaa81A2nyvUr+i yiyGYiQWozKWX7u1J3Ro3v7a3ZQgph4ErzBQqXO1dOP6Ne6Q3e6Xk9NqzQ== X-Gm-Gg: ASbGncuSU8ni05eUU9JKjHSNoUZ9t1YfNB0e/Wfb0VrCTkY0Gqwrj18/UIZCy+kx3a0 1MKqUhy+kiYd75dWHCMJXnEXWzXI7nYsjjP+x64fwodLt460LKi3y7R45I73/hRg66HuM23uX+t 8Rkyn3Nc4Fo0F/YI10CxLNf5C0SZDoEXi+A7rwep0Re5PPPSssv5/+4Ba1d2z9n1gglBh5n6qUp JfoTFRdniFk79otpLlG6n/3ODSWAZZyWdYxqZTV36FXbkk8pnMjnrQ+uXNsuwWG X-Google-Smtp-Source: AGHT+IE8cMN6763yvEseYS7F8mziXmnwL3gCNkh7QukZh3CWLkVXZlQrlkzMi/+c2+Nx0S8pkb6fiQ== X-Received: by 2002:a05:6102:80a2:b0:4b1:1caf:f61b with SMTP id ada2fe7eead31-4b3d104867bmr26190938137.18.1736925147245; Tue, 14 Jan 2025 23:12:27 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:12:26 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 10/19] platform/x86: dell-pc: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:13 -0500 Message-ID: <20250115071022.4815-11-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace platform_profile_register() with it's device managed version. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/dell-pc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 32b3be0723f8..2759bb608b1a 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -281,7 +281,7 @@ static int thermal_init(void) thermal_handler->ops = &dell_pc_platform_profile_ops; /* Clean up if failed */ - ret = platform_profile_register(thermal_handler, NULL); + ret = devm_platform_profile_register(thermal_handler, NULL); if (ret) goto cleanup_thermal_handler; @@ -298,8 +298,6 @@ static int thermal_init(void) static void thermal_cleanup(void) { - if (thermal_handler) - platform_profile_remove(thermal_handler); platform_device_unregister(platform_device); } From patchwork Wed Jan 15 07:10:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857659 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) (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 B47F12361CD; Wed, 15 Jan 2025 07:12:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925165; cv=none; b=uKGBmYytnWaNtnK631nzORfvkFDmGqi6YgsgxNfd1Ncn+Fo28tqddeX/Dywy8nPjavy3uiwJc6jLfOl1IVtsMTgmO0YSQXPGG5qXI9azPSb4q8FiVdruN2VKimq3/m3QGCHmp6SV1c/GUu+CtgUFrcOFkhCNpazxgvIYF7FCoR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925165; c=relaxed/simple; bh=E1PDiKWtIzx9DrFxfQ6dGzeyp3el/gCtXDZ5vSIUXhY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AjHhuAQewBya/EN2TnY0E7aQLGaDGUqycUyBaSbIgytuUwUeY36/nA+DfQmWVYjuL4pIfI7ByO9o4GEyv/OR2hDeHPCJJLYoI83kUvyMTw+whxHxkAFGYx7tXGCqryvb7ruO5Im5sbRrAmY59PTK0qGeJvUAd72XvWbslaCXiMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fDxtAss5; arc=none smtp.client-ip=209.85.217.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="fDxtAss5" Received: by mail-vs1-f45.google.com with SMTP id ada2fe7eead31-4afd56903b7so1938301137.1; Tue, 14 Jan 2025 23:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925162; x=1737529962; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HSK0zhDEMxd4tkmOOiUu8UbApn4gKIO3/NyOhkVPaoo=; b=fDxtAss5KwkGgREM9Lfr9wNtlkZTjFpgs6ob24h0ABaKrkaf433L9fQ4oQOnIWlTnl WkmUFIptzeM8syfBlim1xHv4sG4uothobX1pmGerjTuCz4EaG0aLc3NOjcqRUCmAUoNQ aNJFYnsv/a2g3sGSHvVHGKh1vHrdUXpHMu+FjfAW+sAZzMzBDnzTHeJjj+alGcfzteWL X9En1MPs7oCWQxczEiLVxz0F4s1zoAa+PsuRWhznPq+YvKbmDPtRDT9eqOPG5G7AGzn3 E8WLuJ12Gq5Sobr5Jn35IDu6a0Q7jdHvb2LtBWzZ1hdjX+ixwHJxeOBY3yqkuU2bANxM K6jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925162; x=1737529962; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HSK0zhDEMxd4tkmOOiUu8UbApn4gKIO3/NyOhkVPaoo=; b=fNLDMa0eQPxVRQFemLQb+0zNNLIhoFiwCieRnufsL6AHDAiwtbZVTDu5oD2VhHBPw8 SehLEzu1rRig20ccjaUFqN+8gSqeAlY2IuXhYvprKeSZD4qkyNaYyWqhiNYbn6BGwudP ebCC8eZaDMFz5079VMzzGzASjTGXG/4kXsaEbbK4lKs2U4Cz4ShPcCuG33NAUc/oDyWu Bmsp8RQCPmxf5/7tGExkEPwYasbZKMiedlq2HpVneFmdDyFo5Am6XoC5NaE7GgpbkSIw QWie8I8Jzebtl3+a3Xybwd+bZZikYWb34S158jCL9nt9eR4lb1wW31u9k2k2TXNxT1kJ HghQ== X-Forwarded-Encrypted: i=1; AJvYcCUfqBcaAGu5GuMYN4AKCanAcl1nxTgICtn4hTiTqIf7hC3teWf5fm/wl03G66BdS8OBI1fwpTshoBQGBjmU@vger.kernel.org, AJvYcCXLsjXnKqpAEOYbL7Ug+xKslK04cq7pWC/UeIlJoaAb9DdW3jSDCtjVbaVZbqbk7ZWWjPqcLpk+5H1n@vger.kernel.org X-Gm-Message-State: AOJu0Yx2+5aap1kn/y0P+T6Zz+RGTUai2uz2zBIufIHghX0aasZliu/U FeaKyVcszMdP/Fp99MCerGyXmVrraoysnaAfj54DVHVMYy0LkOpnffdoqw== X-Gm-Gg: ASbGncsOoN1zi4F0umbHVQXynL6fz8W2t7sE7GHLdx2s7WCKyM76LkzmF1lY5kX05bp yB0CEMAnCXjI3YfBBiedRnznMsYLUvRSxZSHZu2gShlxJZ8tR6T4iWrvCZGfE2jAkmza8S4ZKYK n3j4lPkf3Arek4ZL44kvdNhZPpRaXiT+odBjYZAKzzC5hAz23Cgf5CEzG+tzp9ECNfpry6St2K3 rQkBRMNIqnXxr5baViQo6RFUf+uDJtpi0Ad2gEwYjOYkzk+GV44Yys6jiF6jWEV X-Google-Smtp-Source: AGHT+IHLS1vMhIvA3+oiMZgfTw60397it8QMB5uyukRtv3c2B9UYTlqXGoHstOLk+5nQFCxB8HneWQ== X-Received: by 2002:a05:6102:3591:b0:4af:be6e:f0aa with SMTP id ada2fe7eead31-4b3d0eccc9dmr24954908137.25.1736925162148; Tue, 14 Jan 2025 23:12:42 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:12:41 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 12/19] platform/x86: hp-wmi: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:15 -0500 Message-ID: <20250115071022.4815-13-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace platform_profile_register() with it's device managed version. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/hp/hp-wmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 75bcd8460e7c..1304dfc65aab 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1652,7 +1652,7 @@ static int thermal_profile_setup(struct platform_device *device) platform_profile_handler.name = "hp-wmi"; platform_profile_handler.dev = &device->dev; - err = platform_profile_register(&platform_profile_handler, NULL); + err = devm_platform_profile_register(&platform_profile_handler, NULL); if (err) return err; @@ -1714,9 +1714,6 @@ static void __exit hp_wmi_bios_remove(struct platform_device *device) rfkill_unregister(wwan_rfkill); rfkill_destroy(wwan_rfkill); } - - if (platform_profile_support) - platform_profile_remove(&platform_profile_handler); } static int hp_wmi_resume_handler(struct device *device) From patchwork Wed Jan 15 07:10:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857658 Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) (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 450E028EC8D; Wed, 15 Jan 2025 07:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925179; cv=none; b=be2yoCEv73BVTAHlY8PHT5e6rCkhHyxuEjljqq687nFLtI5/vkiGu7o1MeD4I3ux37vtRtLs/CjvpiHRtLka8dnRIPWn0u+yWZFQthweSqRcMI1E/w7fXIoLauSAVxO2gOkdL4RYsDcfkxdHfU6OzmuUP2ocL60IvBLpM5jy21Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925179; c=relaxed/simple; bh=SyfEQGHP6LGcWMnqkteiLZdrNsvZbSA19OO1o9QRFfs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jfdY7zhHUfZPKLV1fIZaoZSsuQHwe0AqEMi4s6S0gWC2FGi4d57BfnSQ1yp6DiHLH7P/c90K9f4ke6HD22hz8r0f4mQbwORkOw7vylcxUIBMMY7eZSkIGNbcQ1Sk5v8X2KD9EalaW259+8tKx0lwuOiWiLTtVMmA0yiUhiiwRLw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V1yS7rdk; arc=none smtp.client-ip=209.85.222.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="V1yS7rdk" Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-85c4b057596so1386869241.3; Tue, 14 Jan 2025 23:12:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925177; x=1737529977; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1aJR6DdYv47JT/4lcD3sQqlqAq2WEhI3FMDLoR8PT20=; b=V1yS7rdkcbKjWXvJbdMjga3jXoyXCe9mKv49+Y1UIpSSZBy2tTrvNUaW+LCq3K9gMi Y46/xWpasVIIryO9184dPfrcC++GSfQAuMHYOfH0NOSYZ07X7v8tGdVsf31J9zyF8Wwc wwlGZ/iNi/UQoS1VFXVB5rOWX5V8yV0QxehhMS/LsoUT6dNQRL9nANtvNV7sM5AQIJHU qUqsZYaoBzJxmibosOVsUR2VFzOMrbE+egSwbXomI8JvED1GmwCCwej3AKiNFraNkkIs CwjM+WlNMo1pfq6qWm4CE0gVAn1/0TlWHqW6ppAqYputmlN+seZ9pVjys2kW7sWxdmC6 upuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925177; x=1737529977; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1aJR6DdYv47JT/4lcD3sQqlqAq2WEhI3FMDLoR8PT20=; b=i8hi0rdNhB+e89SK/T8rBs6yL4/UHFrxK2BhQO2uiG7n7SJ6QsUgTCdTjeXj18WToB 7mM9omncwpQrJlbG42yAvZHeyu1tHtYxq2NifKHnqIDYLWBr3FCYTwxQ8HxDQz0RZhGQ SjYRI3TcbghLhD1/mJMpQPWHTMSNJH+ZstY0Wg56+o5qOSqlOwDmffl1lCcrTqFif5n7 8HBIdsXFVlaFBSI42g2hQCj+0KMG9IX2GfRB7B+5evtIznkt1++zfVgn/7zox+ZepHAD TOOW7/1oYn4W3FCUchX6Az8guaZusBhUjSvjcjCfLU5iz+ufvugOgJfOe1IRPhaw+urS hV/g== X-Forwarded-Encrypted: i=1; AJvYcCUdcF0vbC0IpN+qOG1GgN0k7Lp6FX6XIL0Vjgfxlj+OxMsfZh07he3Jc3H/isPU6amZMFVTgocQqWfF/xKd@vger.kernel.org, AJvYcCWrKWqrIjKzcf9ktR9Y7j1+qMpn2dI+NY6Q/PwEzKyHFQeOORiQpv9x3Eh5MY4BpDrM1gjsPEUvTyFc@vger.kernel.org X-Gm-Message-State: AOJu0Yypjb5wXsVnQOMxkgv2FaoBo6PquXDHuLVS4uLDTSyHNSXtVCdI m5CZvxe35hhLgMOhViWCaGT86FS5ARaEPn6fhCk35dzhoulS9fo/q4+bJQ== X-Gm-Gg: ASbGncs3b/FQE7qRzsCJww36jnmsoq4wYYSgO/aT6ZIDV1rjAA5UUddOjTWvilIrT8Q 3P3yzahxphGf6m6vtBQFD/0cD4qCaxtx7iEEzw0kLyM3jNOWY8mpM6fX8x11/qjOij+xWaUTv26 d/d5zk0zQwqAXolv48GUkUFn5rzMtg+oeQM4NlJbnR5apId8igR1vRZ7z+uR37eggUvNmTt1yuZ V56GPe/UDgq/AR6XzmCyT9JsEvhGTXlj7yVNcBjhDZHoM4mJTlbSZil82Dgaf1v X-Google-Smtp-Source: AGHT+IHzzBrq0F7G+S/vKNe+90+H6gLjAkWejibhgo8I4PqoLhH6TsiDXllh/UFjt7wMqIg21XwxLw== X-Received: by 2002:a05:6102:4192:b0:4b2:5ccb:1596 with SMTP id ada2fe7eead31-4b3d1069a8bmr25880149137.24.1736925176882; Tue, 14 Jan 2025 23:12:56 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:12:56 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 14/19] platform/x86: thinkpad_acpi: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:17 -0500 Message-ID: <20250115071022.4815-15-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace platform_profile_register() with it's device managed version. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/thinkpad_acpi.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 5c250867678f..54ff3e6b8b1a 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10649,7 +10649,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) dytc_profile.dev = &tpacpi_pdev->dev; /* Create platform_profile structure and register */ - err = platform_profile_register(&dytc_profile, NULL); + err = devm_platform_profile_register(&dytc_profile, NULL); /* * If for some reason platform_profiles aren't enabled * don't quit terminally. @@ -10667,14 +10667,8 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) return 0; } -static void dytc_profile_exit(void) -{ - platform_profile_remove(&dytc_profile); -} - static struct ibm_struct dytc_profile_driver_data = { .name = "dytc-profile", - .exit = dytc_profile_exit, }; /************************************************************************* From patchwork Wed Jan 15 07:10:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857657 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (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 CFCF23DABFE; Wed, 15 Jan 2025 07:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925195; cv=none; b=Q8zO5f8/43OhK32ZKtqGkrVPnrw1Tbvbacajq95ReOQKIvcIKrBMzox/83cFNiphNJjr9+KN0gv9L+3Vv/EhwVMJy/2UvpdQPoIhnFOcIR7N3Ev/zUdfZloqFkCMvCFI5DXz177equ55AZATZEIMCUDh0cQuiLTxOGzsCgn4Gio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925195; c=relaxed/simple; bh=peKlMULYKbhUxnauJG3cMHQTyc0I9bp43emAqauWqho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lr2G3Bc8pCM7fERVpF7ypQFxsNeYYG51cy8dRVdiVyOkyykQiUeXm+C+NdEKKkvL4TdD+8OOxx83RPhq79S2iMNXSk3CaeeGivdmiIv0pMk/IGAEx1Rhg9Z3Uc0H4Z03s4JR42h8uRPyLAhB8bgSIpmKpTPNM0HXprSNxEpF9ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hPvj0b+o; arc=none smtp.client-ip=209.85.217.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="hPvj0b+o" Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-4b1279ca1d2so1870198137.3; Tue, 14 Jan 2025 23:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925192; x=1737529992; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jgDJuLF/A0sxRdnv5k+7wxzIykATCCCsCWNWr0UTVc0=; b=hPvj0b+ooZGsTGQAuYeUBYwf98vm8CAacnBmI0fiRdsxABfyHVN7J3OZT/A24X3CLx C/kHvh00hgPQnZFmku8/3qsVSWqNdqYm0Hi88AlfJZGnMbvItfQ36zc00Nl2ql5qSEc9 cxS4sby4pBmFvr/tHx0LyxupiNxFPz8UTf6n8EYQopFVwQaWbl1vP0CC6Mq3zYHIt+R4 BWKkj2xEqMSff1xgQXT9qILj9lstm5h1fXmNprGIvsJO2P9nfltg1jG5IVe0DlAl6GBu i0ghmWbGEO9o57LDaF7syR7+wRRZZYQ+AeipCTkv8TCIw0lIFVkrvnA0sCWpSob05ORG GxwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925192; x=1737529992; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jgDJuLF/A0sxRdnv5k+7wxzIykATCCCsCWNWr0UTVc0=; b=UZQrvIDSlw4YrFWFmKzSc0TzsHzbZpGLNQ5joHU0yNk3zHQYC0SQQHSD3LbLfJXsZf jU8igsPal9iy+Bn6/f8Pp+kzHLKofrqAjPebM4+wuDZmLEYQEecTcXwqaLH02BpzJwta lBc2bJWFS7w5kqnERT7nVga0TlMTxMlJG0SESZRoy6eNk0SN7enByza9SDEf+vQAnZP5 p6MwKUehue9ojzddMmrF0BL89M7CJxi8pWE6gxng6t4xyrdo5wqaF/1YqR/4QnqyL32F 0UYqTbzIVSwO4shEOGG8KnF9LEyWFkl6HSJv6G6tR9rpEvyOLyuor1d4r+8TxfSn3Fv6 UjOg== X-Forwarded-Encrypted: i=1; AJvYcCWb0hKwWlT/xHT3ccBdX3JsNvdH/ZKUVERchpRJP+2vmMYyUUIzXZc/qxseSXwyzJk9rk2meUnez1WUXywo@vger.kernel.org, AJvYcCXf74i3Y3LqjAdNoZByeQjc6NXprS3VhhPB3P2z3aUEmniQzTSCo9hdguE30uVJz0sScZL7eFIQaMW5@vger.kernel.org X-Gm-Message-State: AOJu0YyhRX561gAgWKTjj3reg2uUKpjbmxzNI3E7XILr39ov0x9nq+uu 5nnTp1shnIU+of2erP23WNfUrHXorQs5ASIIVv/BkGrVlKjhTNMYgRdO5g== X-Gm-Gg: ASbGnctkp/1oHvPxDgFvPp5iJAObStjAPmeaja7pZsCKwt4GI6LkD4K+OQglr5/aOgI O3j1zIBHoj9QlOjZ/a9JqOys/O1ami7T5ehbMNN3lFpk17Q6DCE387FHxzMkBqKVghacja6CSgn UJCqXfcgR3p4FzjyTEu1sgfwWoPDR2VBbSLDNrN8jXimxe96gmbVA50gGcc3V2v9YcPitd8jPMj 0q1JzaHEYXIJRQA3QJk/Sa3j2pvYCs8a0uZglVYe0yy9HlkLPv6PSwYEZy4MDp4 X-Google-Smtp-Source: AGHT+IGAjQBi0cdKj/tm24nvCo/6aX7+GLTjz+iSsgCQ6G8Z0ARTz4gA+mWCkkDZZqfleBVptRt6BA== X-Received: by 2002:a05:6102:b02:b0:4b2:cc94:187e with SMTP id ada2fe7eead31-4b3d0fb4cfemr24376348137.18.1736925192274; Tue, 14 Jan 2025 23:13:12 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:13:11 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 16/19] ACPI: platform_profile: Move platform_profile_handler Date: Wed, 15 Jan 2025 02:10:19 -0500 Message-ID: <20250115071022.4815-17-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 platform_profile_handler is now an internal structure. Move it to platform_profile.c. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 9 +++++++++ include/linux/platform_profile.h | 11 ----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index a1dfa168f51f..f27005a267a1 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -14,6 +14,15 @@ static DEFINE_MUTEX(profile_lock); +struct platform_profile_handler { + const char *name; + struct device *dev; + struct device class_dev; + int minor; + unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; + const struct platform_profile_ops *ops; +}; + static const char * const profile_names[] = { [PLATFORM_PROFILE_LOW_POWER] = "low-power", [PLATFORM_PROFILE_COOL] = "cool", diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 778d4c661c3c..eea1daf85616 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -28,23 +28,12 @@ enum platform_profile_option { PLATFORM_PROFILE_LAST, /*must always be last */ }; -struct platform_profile_handler; - struct platform_profile_ops { int (*probe)(void *drvdata, unsigned long *choices); int (*profile_get)(struct device *dev, enum platform_profile_option *profile); int (*profile_set)(struct device *dev, enum platform_profile_option profile); }; -struct platform_profile_handler { - const char *name; - struct device *dev; - struct device class_dev; - int minor; - unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; - const struct platform_profile_ops *ops; -}; - struct device *platform_profile_register(struct device *dev, const char *name, void *drvdata, const struct platform_profile_ops *ops); From patchwork Wed Jan 15 07:10:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857656 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (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 169461DB13C; Wed, 15 Jan 2025 07:13:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925210; cv=none; b=RIac7EJ+sdrUgBv9raL14E8p6NuAdTgeqbZzn3ZpV+h77NDkEAmJKxKLXE+EI68J2htbREdc06hvvh3tu2UreKi+rNvRSYtQ9nGkXVyQLn0VO6lM4U07ZkIOQsAvtxc6zf/Dk2cBR3jP/oF9O+j6liLbC4ADr2h+Jyoco0dSJGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925210; c=relaxed/simple; bh=e1ueNPjFTPGDH9jxtLMCUdv6jqcuEiQgi1FB6PFQBQY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j+xORFT29rslJB+kSUkLjuHKb7PchXrSviQoa0X0bY71SfkkUvxwWmF0+vu/bvWXWqwWByxQcj74EO3YbJ4Rqq9s6ao/IYiUa6LlTgQEYpgC37geJLY5eU8G2ArZgBG7V6Z+pf1yj6OlSZTBciexx+F5+WHIaogOCyAXsLo8Tm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aRwrl7iM; arc=none smtp.client-ip=209.85.217.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="aRwrl7iM" Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-4aff1c57377so336092137.0; Tue, 14 Jan 2025 23:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925206; x=1737530006; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=enEYXwYCYpXtBd0/XTy30bZ8PlokduQNIpiMs89Aw/0=; b=aRwrl7iMTVcp/qlCsB2QJSsC4fDAcE4HpVIJmufGsgLo/nhvpDq/pHxzZ19jPdSUlJ vJj0Xs8bIKJZ4ox87VVv1kbu23lf+G5NBHRW9xptYyCyO4xXpxVtW3xPxddUFbsWOZ3m C3dSoq99AHmmN3azim0gJBlcCxVN+FspSsx+sYQcT+GdFeEjUHBBYIIswjaJ6ujOLs5B EyKbJaKpIE1/S+TMPvgPBN94GMzpFT4vk76vfIM7groBu40pvhGFimkmgkEfkG+d7E2A /ekKv1DZxSo+pwflFKByyFryPcsSW9UVPB1dpz1+wxQ3XkV/mgw7YNxXtGfamWby6sIn FcBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925206; x=1737530006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=enEYXwYCYpXtBd0/XTy30bZ8PlokduQNIpiMs89Aw/0=; b=BwfkL8YMVbKun8LtPMKldIPJ5pfsZ3BEeLqwYLYiRWhpNH55Q3b22WtxV+RFM5m2e8 gQ0CZaN3xLBES7kv2zVDDy65kONHhrweDbL8x1A1UZcigICwhdpMnpEVlFC+6koSUs/1 6oufadqxO/CfG4PIdNbeVtZtG260tSmGO6OjvkPMBiETOFROlPpbkfOy8QUgkLj1TAPS hk9NSYF19wqmNV41xu7IDifLq1Our73AlgE3bMdwYPXp2FvL/BKGCDKoahzOG3erSEn2 nxyycuh6yQXlqsHTWyfrokj9TrWajDAEqGgRY0BBYe42vZmXQX4heCDOtWsYPAt4vDuo /2zg== X-Forwarded-Encrypted: i=1; AJvYcCU+zV/mrqH6zRKemGf3TaKkyRA+WCIg2rlT9wVDBuSap+zpvbk8P7fiOCXj+ID87M41Zs53QrHl4ACVGMNs@vger.kernel.org, AJvYcCVe9xOj2jDbqmzhhXxKY5oMOuLRVJSGBtdbtWMaY0PcQc6qNjcVkGt64UYk4Wcx1TUYnnUQz5pHcKYP@vger.kernel.org X-Gm-Message-State: AOJu0YwSwWw2+rZZtkaGDkiDg7hOyydaPuzcJyvyOVzimErcgh3rxOxY kJacqhUw+eJppmthGalRKgszRkHnpP/+0PnyZCjNaN5QziV/buYSe+rPiw== X-Gm-Gg: ASbGnctftm1qh2ysHFhxvs4B1fHP+2XlBDMQdBaQ28yxeWeo14O8EJrMQywUKFnW4Ab xI/DVI3Qee+B2tdq3VoHUGDNiUWgrm/2ovMLQeCxqGIYeDZo5uD9QQF6JcH8+DK9HfDQJ5Dbd3k f2ojbamIawYxFzh/BxWtmZVr9vl2UyqrNC7x3FrFW7UvsmDxoJrBnEL+45lkCcjl7vi9f5DtAgq AOwIwTTP3dccFwscr4ouVx0ctIyiyR+39I2fnukVIqSBswd9l84/FZykim6HqE/ X-Google-Smtp-Source: AGHT+IFbP810wLAbnm3YetLTkB7YCbHpluB/UljnDfgpmNSWiel0H7FaglQjzOqGLVl8RVZD/2RKmA== X-Received: by 2002:a05:6102:3f15:b0:4b6:99c:dd8f with SMTP id ada2fe7eead31-4b669fae4c9mr1398954137.10.1736925206601; Tue, 14 Jan 2025 23:13:26 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f033ffsm5084366137.6.2025.01.14.23.13.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:13:25 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , "Len Brown" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , "Joshua Grisham" , "Derek J. Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Kurt Borja" , "Maximilian Luz" , "Lee, Chun-Yi" , "Shyam Sundar S K" , "Corentin Chary" , "Luke D. Jones" , "Lyndon Sanche" , "Ike Panhc" , "Henrique de Moraes Holschuh" , "Mark Pearson" , "Alexis Belmonte" , "Ai Chao" , "Gergo Koteles" , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH v3 18/19] ACPI: platform_profile: Add documentation Date: Wed, 15 Jan 2025 02:10:21 -0500 Message-ID: <20250115071022.4815-19-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115071022.4815-1-kuurtb@gmail.com> References: <20250115071022.4815-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add kerneldoc and sysfs class documentation. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- .../ABI/testing/sysfs-class-platform-profile | 44 +++++++++++++++++++ drivers/acpi/platform_profile.c | 33 ++++++++++++++ include/linux/platform_profile.h | 10 +++++ 3 files changed, 87 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-platform-profile diff --git a/Documentation/ABI/testing/sysfs-class-platform-profile b/Documentation/ABI/testing/sysfs-class-platform-profile new file mode 100644 index 000000000000..b5a3600080bc --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-platform-profile @@ -0,0 +1,44 @@ +What: /sys/class/platform-profile/platform-profile-X/name +Date: January 2025 +Description: Name of the class device given by the driver. + + RO + +What: /sys/class/platform-profile/platform-profile-X/choices +Date: January 2025 +Description: This file contains a space-separated list of profiles supported for this device. + + Drivers must use the following standard profile-names: + + ==================== ======================================== + low-power Low power consumption + cool Cooler operation + quiet Quieter operation + balanced Balance between low power consumption + and performance + balanced-performance Balance between performance and low + power consumption with a slight bias + towards performance + performance High performance operation + custom Driver defined custom profile + ==================== ======================================== + + RO + +What: /sys/class/platform-profile/platform-profile-X/profile +Date: January 2025 +Description: Reading this file gives the current selected profile for this + device. Writing this file with one of the strings from + platform_profile_choices changes the profile to the new value. + + This file can be monitored for changes by polling for POLLPRI, + POLLPRI will be signaled on any changes, independent of those + changes coming from a userspace write; or coming from another + source such as e.g. a hotkey triggered profile change handled + either directly by the embedded-controller or fully handled + inside the kernel. + + This file may also emit the string 'custom' to indicate + that the driver is using a driver defined custom profile. + + RW diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 8a1454e66cf1..4895f37dd549 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -425,6 +425,10 @@ static const struct attribute_group platform_profile_group = { .is_visible = profile_class_is_visible, }; +/** + * platform_profile_notify - Notify class device and legacy sysfs interface + * @dev: The class device + */ void platform_profile_notify(struct device *dev) { scoped_cond_guard(mutex_intr, return, &profile_lock) { @@ -434,6 +438,11 @@ void platform_profile_notify(struct device *dev) } EXPORT_SYMBOL_GPL(platform_profile_notify); +/** + * platform_profile_cycle - Cycles profiles available on all registered class devices + * + * Return: 0 on success, -errno on failure + */ int platform_profile_cycle(void) { enum platform_profile_option next = PLATFORM_PROFILE_LAST; @@ -477,6 +486,15 @@ int platform_profile_cycle(void) } EXPORT_SYMBOL_GPL(platform_profile_cycle); +/** + * platform_profile_register - Creates and registers a platform profile class device + * @dev: Parent device + * @name: Name of the class device + * @drvdata: Driver data that will be attached to the class device + * @ops: Platform profile's mandatory operations + * + * Return: pointer to the new class device on success, ERR_PTR on failure + */ struct device *platform_profile_register(struct device *dev, const char *name, void *drvdata, const struct platform_profile_ops *ops) @@ -546,6 +564,12 @@ struct device *platform_profile_register(struct device *dev, const char *name, } EXPORT_SYMBOL_GPL(platform_profile_register); +/** + * platform_profile_remove - Unregisters a platform profile class device + * @dev: Class device + * + * Return: 0 + */ int platform_profile_remove(struct device *dev) { struct platform_profile_handler *pprof = to_pprof_handler(dev); @@ -571,6 +595,15 @@ static void devm_platform_profile_release(struct device *dev, void *res) platform_profile_remove(*ppdev); } +/** + * devm_platform_profile_register - Device managed version of platform_profile_register + * @dev: Parent device + * @name: Name of the class device + * @drvdata: Driver data that will be attached to the class device + * @ops: Platform profile's mandatory operations + * + * Return: pointer to the new class device on success, ERR_PTR on failure + */ struct device *devm_platform_profile_register(struct device *dev, const char *name, void *drvdata, const struct platform_profile_ops *ops) diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index eea1daf85616..8ab5b0e8eb2c 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -28,6 +28,16 @@ enum platform_profile_option { PLATFORM_PROFILE_LAST, /*must always be last */ }; +/** + * struct platform_profile_ops - platform profile operations + * @probe: Callback to setup choices available to the new class device. These + * choices will only be enforced when setting a new profile, not when + * getting the current one. + * @profile_get: Callback that will be called when showing the current platform + * profile in sysfs. + * @profile_set: Callback that will be called when storing a new platform + * profile in sysfs. + */ struct platform_profile_ops { int (*probe)(void *drvdata, unsigned long *choices); int (*profile_get)(struct device *dev, enum platform_profile_option *profile);