From patchwork Wed Jan 15 07:10:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939943 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 3FB63224B06; Wed, 15 Jan 2025 07:11:22 +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=1736925084; cv=none; b=ot1eaAJWOqHtJoTyZnu0QkkTlutQU8BfTBpa0MTxSlhK+u5A+XmabKsEn7OeunEC59WH93wu7QZCFxJIONiEmC0QsZSbSNq8yNIwoBS0mn/AzRzOh23wR5vapWkYs60wWEmb7IOhvNBYbNY+I2NmdzwhwdjSqHQp/nJMmpYpylQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925084; c=relaxed/simple; bh=+v5slvC+9AbUnLiMkDSfD8wpfPCf9ur/EgttNrQHYa4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I+jwEy4Kl2F/E8/Plxl4NR9cS133dHqRPDxKf56oJuALcSujzvoPb5BYwdSv2Rcu4vzT0E8Nvg1QdUVJkBXdlDe+SKthCNlM/0PgXI6oxV8waT5gUxodkp/UUMF9avDkBNlfzJOeElnLgFSkR5mUIl6NS6KEkjIpGg5KQXa7efI= 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=gj8LGMNg; 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="gj8LGMNg" Received: by mail-ua1-f48.google.com with SMTP id a1e0cc1a2514c-85c559ed230so1471538241.0; Tue, 14 Jan 2025 23:11:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925080; x=1737529880; 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=T2VFZUj8BR8/0tTtvf2D7xc26cb5KXgzs6uQ+CX7Ed0=; b=gj8LGMNgsgEQ7G0TW0QoiwqagopaCRAKrHQ3UAgwmVdKRxv4ik+UWWd+gtmNIUaQz6 j9F459tYPbPZVIB0w5V/kpd9+X8lunCi9GYq3iFw3G7Gr40PrwG+pXjns7XU3gHYsZmk nrsmOTwQUbMeFDVxu4cvWZqwVrnuWSBaM1H5jT9ZPE01EE1Ei8vdcPlCFCKykbEXo8zm YHMz4kW+bcH0eoppArFJ23B/Lf+9U9SrMs2KxRGqbnVBBmbreaeXtzXxKDrjIqzlPBNp lhzD6DAFAonY/cwfmn2tNsRIRtD46oDrvxfZa8k5zVNntceSRZXesTE66Epl2KThsNT+ DLFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925080; x=1737529880; 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=T2VFZUj8BR8/0tTtvf2D7xc26cb5KXgzs6uQ+CX7Ed0=; b=hthFjQw81CcqqpWdWx51gfx0nFOQyF3M1Ff+ruMKVbS62bu+YCnYQ+m54zN+1n/rtT XRseACN3OXHOVy3ZPfeOfwki06mxfRprQd5HcQEfx74HI2BCTbgaADUKzWZ8tzvEt9Rd XE75g35VnkbF2X3VTMxEbfdoGoOPpJBRCWyqzp0Moh2SogM8lvThY835U5gwdExNTU4p qa8vM3elcolx6BQSsrGTahCy9sLvfUVGDIyJJbXHnBA2UFAB7di23Ty7Q8j889VAZ80E rz7nYksT01zu39RSe/1LycVHwGC1X3555HQGT2mFVt+kVjltDbLVikapxZvD/KjGHXBE Kl9A== X-Forwarded-Encrypted: i=1; AJvYcCWfrd1HQyB0KQvgeeLI/Bu8hxZSmJ4dE1dFQ0SFlpEr97IZ+kgiFtzclGQeYXuqQ121E/v2wTf778sm@vger.kernel.org, AJvYcCXVKcjRlHUjc9SUBlXdAdrmb4ljv9mTIl1mPFPOa2SXKMSoLhmfUFowIgVEi9h6iL7fL7z3+rTTL00wiCLs@vger.kernel.org X-Gm-Message-State: AOJu0YwRtEDUOJIWiA7BLkxk6W3pLF8K7sgaSneNZWAHtnstHmWklRDm AZO+g1vTYTa2NnQbOrbTr+pYtplu9i76VEHQBU2eb1ZCU0fjtfUE5hKX7Q== X-Gm-Gg: ASbGncvUU1FHB1lO2UotMQsLtUAvV+rFJV5z6Q03jyf9Mrdt3qPgrQJ4JBjox8TKNvC S5D0z1IFmW6i1X46+5ZDs49/ehZsUzf87H9pOhLhmay3LFXRGRDMkrxIdY6VfBLcKDAwQBpsnv9 nwqHnvao+kCNbmHZov2xf1Z93r9K0bKBwTufK+XKcvFdQEYwurc3rrKBqArkIeifqsEUlz6FlRV ssSHhYQz2lW+rVqYuWwLYrmT0o4TGwT6ZrNNqXIRfWSypJtzUH3iaat5L88z8/n X-Google-Smtp-Source: AGHT+IGAHdeJzu0b7PGqFZwqoj/mdG8XbC2G9kXdf3B0YmwuM/76DJKL2n58Tg4amQ2oQ+ncHyfbLQ== X-Received: by 2002:a05:6102:418f:b0:4af:e99e:b41b with SMTP id ada2fe7eead31-4b3d104ad80mr27127389137.19.1736925080577; Tue, 14 Jan 2025 23:11:20 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:11:19 -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 01/19] ACPI: platform_profile: Replace *class_dev member with class_dev Date: Wed, 15 Jan 2025 02:10:04 -0500 Message-ID: <20250115071022.4815-2-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 Instead of holding a reference to the class device, embed it the platform_profile_handler. This involves manually creating and registering the device and replacing dev_get_drvdata() with the newly created to_pprof_handler() macro. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 37 +++++++++++++++++--------------- include/linux/platform_profile.h | 3 ++- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 4c4200a0b1a6..15f24adc57d4 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -5,11 +5,12 @@ #include #include #include -#include #include #include #include +#define to_pprof_handler(d) (container_of(d, struct platform_profile_handler, class_dev)) + static DEFINE_MUTEX(profile_lock); static const char * const profile_names[] = { @@ -60,7 +61,7 @@ static int _store_class_profile(struct device *dev, void *data) int *bit = (int *)data; lockdep_assert_held(&profile_lock); - handler = dev_get_drvdata(dev); + handler = to_pprof_handler(dev); if (!test_bit(*bit, handler->choices)) return -EOPNOTSUPP; @@ -76,11 +77,11 @@ static int _store_class_profile(struct device *dev, void *data) */ static int _notify_class_profile(struct device *dev, void *data) { - struct platform_profile_handler *handler = dev_get_drvdata(dev); + struct platform_profile_handler *handler = to_pprof_handler(dev); lockdep_assert_held(&profile_lock); - sysfs_notify(&handler->class_dev->kobj, NULL, "profile"); - kobject_uevent(&handler->class_dev->kobj, KOBJ_CHANGE); + sysfs_notify(&handler->class_dev.kobj, NULL, "profile"); + kobject_uevent(&handler->class_dev.kobj, KOBJ_CHANGE); return 0; } @@ -100,7 +101,7 @@ static int get_class_profile(struct device *dev, int err; lockdep_assert_held(&profile_lock); - handler = dev_get_drvdata(dev); + handler = to_pprof_handler(dev); err = handler->profile_get(handler, &val); if (err) { pr_err("Failed to get profile for handler %s\n", handler->name); @@ -124,7 +125,7 @@ static int get_class_profile(struct device *dev, */ static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_profile_handler *handler = dev_get_drvdata(dev); + struct platform_profile_handler *handler = to_pprof_handler(dev); return sysfs_emit(buf, "%s\n", handler->name); } @@ -142,7 +143,7 @@ static ssize_t choices_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_profile_handler *handler = dev_get_drvdata(dev); + struct platform_profile_handler *handler = to_pprof_handler(dev); return _commmon_choices_show(handler->choices, buf); } @@ -229,7 +230,7 @@ static int _aggregate_choices(struct device *dev, void *data) unsigned long *aggregate = data; lockdep_assert_held(&profile_lock); - handler = dev_get_drvdata(dev); + handler = to_pprof_handler(dev); if (test_bit(PLATFORM_PROFILE_LAST, aggregate)) bitmap_copy(aggregate, handler->choices, PLATFORM_PROFILE_LAST); else @@ -410,7 +411,7 @@ static const struct attribute_group platform_profile_group = { void platform_profile_notify(struct platform_profile_handler *pprof) { scoped_cond_guard(mutex_intr, return, &profile_lock) { - _notify_class_profile(pprof->class_dev, NULL); + _notify_class_profile(&pprof->class_dev, NULL); } sysfs_notify(acpi_kobj, NULL, "platform_profile"); } @@ -476,11 +477,13 @@ int platform_profile_register(struct platform_profile_handler *pprof) pprof->minor = ida_alloc(&platform_profile_ida, GFP_KERNEL); if (pprof->minor < 0) return pprof->minor; - pprof->class_dev = device_create(&platform_profile_class, pprof->dev, - MKDEV(0, 0), pprof, "platform-profile-%d", - pprof->minor); - if (IS_ERR(pprof->class_dev)) { - err = PTR_ERR(pprof->class_dev); + + pprof->class_dev.class = &platform_profile_class; + pprof->class_dev.parent = pprof->dev; + dev_set_name(&pprof->class_dev, "platform-profile-%d", pprof->minor); + err = device_register(&pprof->class_dev); + if (err) { + put_device(&pprof->class_dev); goto cleanup_ida; } @@ -493,7 +496,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) return 0; cleanup_cur: - device_unregister(pprof->class_dev); + device_unregister(&pprof->class_dev); cleanup_ida: ida_free(&platform_profile_ida, pprof->minor); @@ -508,7 +511,7 @@ int platform_profile_remove(struct platform_profile_handler *pprof) guard(mutex)(&profile_lock); id = pprof->minor; - device_unregister(pprof->class_dev); + device_unregister(&pprof->class_dev); ida_free(&platform_profile_ida, id); sysfs_notify(acpi_kobj, NULL, "platform_profile"); diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index f1cd4b65e351..8a9b8754f9ac 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -9,6 +9,7 @@ #ifndef _PLATFORM_PROFILE_H_ #define _PLATFORM_PROFILE_H_ +#include #include /* @@ -30,7 +31,7 @@ enum platform_profile_option { struct platform_profile_handler { const char *name; struct device *dev; - struct device *class_dev; + struct device class_dev; int minor; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; int (*profile_get)(struct platform_profile_handler *pprof, 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: 13939944 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:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939945 Received: from mail-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) (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 EDF8622FDED; Wed, 15 Jan 2025 07:11:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925099; cv=none; b=bbpnvmlyzm3jIkV3y3UfsSp81b2fANS7TsFmHo0ZdG5v1nyPCBjVTY4GsQRmDaMr6WFP5AUEQ8LWKCTgSXrGmf3hZHXAcE73WABDaG0gawM5w68hiqtUtKKpMOVpEvW6PPOBxPZ8lQdNmuLvxC+TicCo/9tJl1mKkkp8i3qNcN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925099; c=relaxed/simple; bh=gOXlL17aOSASd10ISpV8PkaWVItcf647Ka5W/n5jsc0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B+NcQ7PV2aJGFkOTdJo+zro+MIkqqNwmddBbQizxKlPylsGpsWifN8JVK//rrUorLPauUOT72fhRUyioML6D4Vx9faZdzA0K+8b+nUac8P47Okrbf1hKN/3eAsfIT0gStUhZvdatpSHxTAqRAnb4W/jUNCucEFgtvk4q6sY/eWM= 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=Aqi0RWul; arc=none smtp.client-ip=209.85.217.49 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="Aqi0RWul" Received: by mail-vs1-f49.google.com with SMTP id ada2fe7eead31-4afe1009960so1851085137.0; Tue, 14 Jan 2025 23:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925095; x=1737529895; 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=ejg9OnZHIrMESt6UVkSctZ7K3JqammHXTcQk/w9/O40=; b=Aqi0RWulY944WyQQRGQC7sgKGUj7z7X73Qlav7c2u7sYwbGc21WNbe2fbDHqQKlW7w 1YKiDIRGtmjCO4S4/bXqvHP9ML2r86dwL9lnbyV+MGIPqqVfbTy9fA+QdRbNx6eJMG9Z bkN2OgUii8ZVyaeCQP2zXazWegY+913n/RkEY/3gckccX7xzpefgAfHqr3Ck2S2jVKzi C1JAshq6w5WA7xVlna39sDv4v1uCDY7Vb0qOMil+anezxG4yBCbG3gvRwrDXsDXK316B dRG0pIdbGRfPWm1OmVQd6/4SVqIS7+vuZEyd7pkbEV9M6XDlcv5vohmukv7hajAEL+x6 Wt3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925095; x=1737529895; 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=ejg9OnZHIrMESt6UVkSctZ7K3JqammHXTcQk/w9/O40=; b=XrZW+48395ZAISbg3nr4380YM8oKIZ30C3oYTqZGzuK+P9NSdVIkg71BrNEE95YPhW iV1c6loBMRZw29FV80J5C2ZcsdlTaua0T5MsMgYDr55V8n8FHQpawiCQIzriUw9IHHKN Tn+CR89LknKn6WegDKjN5eiZPUX/SvomOHl8vDMtj8vDnH9IwJIpUxmHhGRAt49Qqxeb YMvel5uEo//ginwa2eWqCqy93SPmMJiYAF+TrHqsYkwehH5lVYq7+RWqKVpFspLDvMsJ dRcynqSEBmnD+36EnaumKvii2jXpV97ox2BvvY9z9FO8285OYHQRqjN74Sk2F8bC6LN0 HQyg== X-Forwarded-Encrypted: i=1; AJvYcCUJQvvZBgmyOFXupLxGuEW8MhsHU34S44pHCPI7uu6Er6EEJ67zgt3zftuM24tUT11NvTfLwZmhQXDDDjaR@vger.kernel.org, AJvYcCWlKAkk+vmV3V1O9TigsgrkYYHuui5f8GXOMSfZiUqlfvci6vg7EFkavRksr2mG5U07ylvkX/QPVgfQ@vger.kernel.org X-Gm-Message-State: AOJu0Yxqwqx9jLeNDUqJsZtvtZFjcZez/xY+N4OwkAG+6ottdKp1E/Ln 8BbSlu3ign/RVOlQVhlsKpbQXmtbb7wUfEODsM3ybB+z/4fjej78AfAQBw== X-Gm-Gg: ASbGncuGQ27SM9e6+HN0dy44JzkN8gw1qZWEwB45trrPbCt2k9PvYY9JYNMzA16u8nl gHaAhevwsu+Z9wXZEvgAkyqYptEnBSMPjOA7yWwTUWL1Q2tozCnzEdh5m4ytPjvbnO8OqhFGvJD 9e0FpyuuT3nPVKoJf7lnABYsrJvdQUmUspyqSPITgcxMz+hcWeRHCNq6miYdnaqAdt66k9m2IUr 6wI7dR1wm2WKDAG5fnr2Sh2pi+IeJaIFwlb0DwKLb+exi2cu9wbBWny/HOcr4aY X-Google-Smtp-Source: AGHT+IGCCDax/HCFWsryGNItZqqx3So7zMJDrS21xgMMylzzROS/oYFYVkchytwZPl8J0F7Y9OYOYA== X-Received: by 2002:a05:6102:3750:b0:4b2:5d67:94c3 with SMTP id ada2fe7eead31-4b3d0fc4134mr21837483137.18.1736925095549; Tue, 14 Jan 2025 23:11:35 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:11:34 -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 03/19] ACPI: platform_profile: Remove platform_profile_handler from callbacks Date: Wed, 15 Jan 2025 02:10:06 -0500 Message-ID: <20250115071022.4815-4-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 Devices can now set drvdata to the class device, thus passing the platform_profile_handler to callbacks is unnecessary. Instead pass the class device. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 4 ++-- .../platform/surface/surface_platform_profile.c | 8 ++++---- drivers/platform/x86/acer-wmi.c | 4 ++-- drivers/platform/x86/amd/pmf/sps.c | 8 ++++---- drivers/platform/x86/asus-wmi.c | 8 ++++---- drivers/platform/x86/dell/alienware-wmi.c | 4 ++-- drivers/platform/x86/dell/dell-pc.c | 4 ++-- drivers/platform/x86/hp/hp-wmi.c | 14 +++++++------- drivers/platform/x86/ideapad-laptop.c | 8 ++++---- drivers/platform/x86/inspur_platform_profile.c | 8 ++++---- drivers/platform/x86/thinkpad_acpi.c | 4 ++-- include/linux/platform_profile.h | 6 ++---- 12 files changed, 39 insertions(+), 41 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 689541d2e66c..bd90aa4e8371 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(handler, *bit); + return handler->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(handler, &val); + err = handler->profile_get(dev, &val); if (err) { pr_err("Failed to get profile for handler %s\n", handler->name); return err; diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index edb9362003a4..26c1230e75df 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -154,14 +154,14 @@ static int convert_profile_to_ssam_fan(struct ssam_device *sdev, enum platform_p } } -static int ssam_platform_profile_get(struct platform_profile_handler *pprof, +static int ssam_platform_profile_get(struct device *dev, enum platform_profile_option *profile) { struct ssam_platform_profile_device *tpd; enum ssam_tmp_profile tp; int status; - tpd = dev_get_drvdata(&pprof->class_dev); + tpd = dev_get_drvdata(dev); status = ssam_tmp_profile_get(tpd->sdev, &tp); if (status) @@ -175,13 +175,13 @@ static int ssam_platform_profile_get(struct platform_profile_handler *pprof, return 0; } -static int ssam_platform_profile_set(struct platform_profile_handler *pprof, +static int ssam_platform_profile_set(struct device *dev, enum platform_profile_option profile) { struct ssam_platform_profile_device *tpd; int tp; - tpd = dev_get_drvdata(&pprof->class_dev); + tpd = dev_get_drvdata(dev); tp = convert_profile_to_ssam_tmp(tpd->sdev, profile); if (tp < 0) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 4594beb4b9d7..d609bd105db3 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1843,7 +1843,7 @@ static int acer_toggle_turbo(void) } static int -acer_predator_v4_platform_profile_get(struct platform_profile_handler *pprof, +acer_predator_v4_platform_profile_get(struct device *dev, enum platform_profile_option *profile) { u8 tp; @@ -1878,7 +1878,7 @@ acer_predator_v4_platform_profile_get(struct platform_profile_handler *pprof, } static int -acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof, +acer_predator_v4_platform_profile_set(struct device *dev, enum platform_profile_option profile) { int tp; diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 259a598acd3e..cf2e51f67787 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -282,10 +282,10 @@ bool is_pprof_balanced(struct amd_pmf_dev *pmf) return (pmf->current_profile == PLATFORM_PROFILE_BALANCED) ? true : false; } -static int amd_pmf_profile_get(struct platform_profile_handler *pprof, +static int amd_pmf_profile_get(struct device *dev, enum platform_profile_option *profile) { - struct amd_pmf_dev *pmf = dev_get_drvdata(&pprof->class_dev); + struct amd_pmf_dev *pmf = dev_get_drvdata(dev); *profile = pmf->current_profile; return 0; @@ -363,10 +363,10 @@ int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev) return 0; } -static int amd_pmf_profile_set(struct platform_profile_handler *pprof, +static int amd_pmf_profile_set(struct device *dev, enum platform_profile_option profile) { - struct amd_pmf_dev *pmf = dev_get_drvdata(&pprof->class_dev); + struct amd_pmf_dev *pmf = dev_get_drvdata(dev); int ret = 0; pmf->current_profile = profile; diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 0c68635a0aa3..9bed170abb92 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3800,13 +3800,13 @@ static ssize_t throttle_thermal_policy_store(struct device *dev, static DEVICE_ATTR_RW(throttle_thermal_policy); /* Platform profile ***********************************************************/ -static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof, +static int asus_wmi_platform_profile_get(struct device *dev, enum platform_profile_option *profile) { struct asus_wmi *asus; int tp; - asus = dev_get_drvdata(&pprof->class_dev); + asus = dev_get_drvdata(dev); tp = asus->throttle_thermal_policy_mode; switch (tp) { @@ -3826,13 +3826,13 @@ static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof, return 0; } -static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof, +static int asus_wmi_platform_profile_set(struct device *dev, enum platform_profile_option profile) { struct asus_wmi *asus; int tp; - asus = dev_get_drvdata(&pprof->class_dev); + asus = dev_get_drvdata(dev); switch (profile) { case PLATFORM_PROFILE_PERFORMANCE: diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index 28c39e25228e..b8131b803368 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -1026,7 +1026,7 @@ static int wmax_game_shift_status(u8 operation, u32 *out_data) return 0; } -static int thermal_profile_get(struct platform_profile_handler *pprof, +static int thermal_profile_get(struct device *dev, enum platform_profile_option *profile) { u32 out_data; @@ -1052,7 +1052,7 @@ static int thermal_profile_get(struct platform_profile_handler *pprof, return 0; } -static int thermal_profile_set(struct platform_profile_handler *pprof, +static int thermal_profile_set(struct device *dev, enum platform_profile_option profile) { if (quirks->gmode) { diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 1a0a721d706f..c86b05b5a1cb 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -185,7 +185,7 @@ static int thermal_set_mode(enum thermal_mode_bits state) return dell_send_request(&buffer, CLASS_INFO, SELECT_THERMAL_MANAGEMENT); } -static int thermal_platform_profile_set(struct platform_profile_handler *pprof, +static int thermal_platform_profile_set(struct device *dev, enum platform_profile_option profile) { switch (profile) { @@ -202,7 +202,7 @@ static int thermal_platform_profile_set(struct platform_profile_handler *pprof, } } -static int thermal_platform_profile_get(struct platform_profile_handler *pprof, +static int thermal_platform_profile_get(struct device *dev, enum platform_profile_option *profile) { int ret; diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 8e5e1422e024..b8e62dc9cecd 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1221,7 +1221,7 @@ static int platform_profile_omen_get_ec(enum platform_profile_option *profile) return 0; } -static int platform_profile_omen_get(struct platform_profile_handler *pprof, +static int platform_profile_omen_get(struct device *dev, enum platform_profile_option *profile) { /* @@ -1318,7 +1318,7 @@ static int platform_profile_omen_set_ec(enum platform_profile_option profile) return 0; } -static int platform_profile_omen_set(struct platform_profile_handler *pprof, +static int platform_profile_omen_set(struct device *dev, enum platform_profile_option profile) { int err; @@ -1345,7 +1345,7 @@ static int thermal_profile_set(int thermal_profile) sizeof(thermal_profile), 0); } -static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof, +static int hp_wmi_platform_profile_get(struct device *dev, enum platform_profile_option *profile) { int tp; @@ -1374,7 +1374,7 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof, return 0; } -static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof, +static int hp_wmi_platform_profile_set(struct device *dev, enum platform_profile_option profile) { int err, tp; @@ -1440,11 +1440,11 @@ static int platform_profile_victus_get_ec(enum platform_profile_option *profile) return 0; } -static int platform_profile_victus_get(struct platform_profile_handler *pprof, +static int platform_profile_victus_get(struct device *dev, enum platform_profile_option *profile) { /* Same behaviour as platform_profile_omen_get */ - return platform_profile_omen_get(pprof, profile); + return platform_profile_omen_get(dev, profile); } static int platform_profile_victus_set_ec(enum platform_profile_option profile) @@ -1472,7 +1472,7 @@ static int platform_profile_victus_set_ec(enum platform_profile_option profile) return 0; } -static int platform_profile_victus_set(struct platform_profile_handler *pprof, +static int platform_profile_victus_set(struct device *dev, enum platform_profile_option profile) { int err; diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index ed0d880a07a9..fc317f42bb82 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -933,10 +933,10 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe * dytc_profile_get: Function to register with platform_profile * handler. Returns current platform profile. */ -static int dytc_profile_get(struct platform_profile_handler *pprof, +static int dytc_profile_get(struct device *dev, enum platform_profile_option *profile) { - struct ideapad_dytc_priv *dytc = dev_get_drvdata(&pprof->class_dev); + struct ideapad_dytc_priv *dytc = dev_get_drvdata(dev); *profile = dytc->current_profile; return 0; @@ -986,10 +986,10 @@ static int dytc_cql_command(struct ideapad_private *priv, unsigned long cmd, * dytc_profile_set: Function to register with platform_profile * handler. Sets current platform profile. */ -static int dytc_profile_set(struct platform_profile_handler *pprof, +static int dytc_profile_set(struct device *dev, enum platform_profile_option profile) { - struct ideapad_dytc_priv *dytc = dev_get_drvdata(&pprof->class_dev); + struct ideapad_dytc_priv *dytc = dev_get_drvdata(dev); struct ideapad_private *priv = dytc->priv; unsigned long output; int err; diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 471fca50d1c9..47d2dbbf3392 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -84,10 +84,10 @@ static int inspur_wmi_perform_query(struct wmi_device *wdev, * 0x0: No Error * 0x1: Error */ -static int inspur_platform_profile_set(struct platform_profile_handler *pprof, +static int inspur_platform_profile_set(struct device *dev, enum platform_profile_option profile) { - struct inspur_wmi_priv *priv = dev_get_drvdata(&pprof->class_dev); + struct inspur_wmi_priv *priv = dev_get_drvdata(dev); u8 ret_code[4] = {0, 0, 0, 0}; int ret; @@ -131,10 +131,10 @@ static int inspur_platform_profile_set(struct platform_profile_handler *pprof, * 0x1: Performance Mode * 0x2: Power Saver Mode */ -static int inspur_platform_profile_get(struct platform_profile_handler *pprof, +static int inspur_platform_profile_get(struct device *dev, enum platform_profile_option *profile) { - struct inspur_wmi_priv *priv = dev_get_drvdata(&pprof->class_dev); + struct inspur_wmi_priv *priv = dev_get_drvdata(dev); u8 ret_code[4] = {0, 0, 0, 0}; int ret; diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index fe37c26891d8..47f87bb213a9 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10414,7 +10414,7 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe * dytc_profile_get: Function to register with platform_profile * handler. Returns current platform profile. */ -static int dytc_profile_get(struct platform_profile_handler *pprof, +static int dytc_profile_get(struct device *dev, enum platform_profile_option *profile) { *profile = dytc_current_profile; @@ -10489,7 +10489,7 @@ static int dytc_cql_command(int command, int *output) * dytc_profile_set: Function to register with platform_profile * handler. Sets current platform profile. */ -static int dytc_profile_set(struct platform_profile_handler *pprof, +static int dytc_profile_set(struct device *dev, enum platform_profile_option profile) { int perfmode; diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 1c8fdda51eaa..5296d886c243 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -34,10 +34,8 @@ struct platform_profile_handler { struct device class_dev; int minor; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; - int (*profile_get)(struct platform_profile_handler *pprof, - enum platform_profile_option *profile); - int (*profile_set)(struct platform_profile_handler *pprof, - enum platform_profile_option profile); + int (*profile_get)(struct device *dev, enum platform_profile_option *profile); + int (*profile_set)(struct device *dev, enum platform_profile_option profile); }; int platform_profile_register(struct platform_profile_handler *pprof, void *drvdata); 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: 13939946 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:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939947 Received: from mail-vs1-f46.google.com (mail-vs1-f46.google.com [209.85.217.46]) (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 B1678234D05; Wed, 15 Jan 2025 07:11:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925113; cv=none; b=blfOc5eZ+47Iq/be4nErdDd53zDCnw2avJn1xDK7Qgeesyh+D3eTDgmbvsLSDrbiC8GXwWZsWxcmMRpvCHBRdU6yWG7nPRGE83wXmLGm2Tgt5mfq6rKSWqT9m4b9ZoMEu9thGJJ+E/JhdrT1yTQzlsCVPe/DZkfjVzS0G1d30gU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925113; c=relaxed/simple; bh=I4dGQg4/mioqynhS1VaZWHDTdwnWXhAjF2EDr2pmRpA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MX2Uqa3lbcF2w8Gj/U3gcjXm1EfR1xAFH0Mp5+wAOSpr3JBhkn/xpXeJtauw1YHyTn9OZklLTGtD7QL+6ycgEBSz2+Y19m4bIp4KLHLetqmO63e6c8Ur7fK7vBNh3fo4/9XN5RcLGPSTn7+CQasStLVUZPauToT5mk/7SfOpa2s= 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=GCAGGfJh; arc=none smtp.client-ip=209.85.217.46 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="GCAGGfJh" Received: by mail-vs1-f46.google.com with SMTP id ada2fe7eead31-4afdfd3124dso1803539137.2; Tue, 14 Jan 2025 23:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925110; x=1737529910; 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=zWEcGrVkcb9JKYQeu9uxP3hL/sO05nt+ccZzlfeAzFQ=; b=GCAGGfJhka44ukQfGMcR5kJi9M5EirTDOtgO5XKSoBKRI/LpxKbxJDKDev4UNpe1lh zT7a8ywSuJbWYFW2mps+NWajSF8myQLTebr3jNRQuWuh8MSLHs8COszLiVwbo+lCO1ff IdEQht2kLYKXP4kueOuYQn2nMTz8FHl74Fo+aI+P1jyWFzrjcwN/E9TonbQUpnMrbMPd QpefQR3aGj+S0YhgymvpMP92fTRar3g4LFsjJ8G46Jncj5y3MvYpTZKInoHHrPUCLELe kQTS0IaVxQ5iHtPdS/HEIU2ovG/5u+WC34s+1cdR4CEAu+Q7XyFUSMPYfP5kxrPyqktd E+vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925110; x=1737529910; 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=zWEcGrVkcb9JKYQeu9uxP3hL/sO05nt+ccZzlfeAzFQ=; b=PIBO3Xd2wAD55YEsA/QZ8unyMdu1aHj8TILbWR8cBCOTiaYgGJSJ/1HmB6i464+XJm SmgTtZNPFF1AcsEO0S3OCupdCQz0DRNS9L7xUYeXkV8BqIQKav4Uo8y3WKGCGfF+3trk KdCsi9t5NMm3TDO8UF4Z3YarPIkXxtr31W+fSyMlKEO+3S6o/dAkEoeENUVA9goJV++d fpyxsauOeYUXxzo8Tko27kOA4kjPVhKu3vGnX/wQEOlHfTp50Xz50QHCh2zd/Is/4HEc PoeZ/Yaz3PulXBkbI1PF6wsdVBJjsDDpzLU0P+tn/ZHIL12CTVEOqHClLOruADJHq7XL 94mg== X-Forwarded-Encrypted: i=1; AJvYcCVuhh8ilvRxAj8QN+s9xxuSeQVZ+70U4dpje/4oIya8hs02MlZvVpzp5L8FCbYx+rqW+Z73bIQu7T2x@vger.kernel.org, AJvYcCXoizRaBOLIk6QZ5hmQizPnm4ixBugPndZtDExvy5TCndxpOjVi4+RruLU3yJ2JznW3OznjesBJj2stzbHu@vger.kernel.org X-Gm-Message-State: AOJu0Yzetuels64NXGa0Tfnf+i5uUk9u6QhA9L9tfbVX/y+6xHuoNUEe ewiK+MG4PCen0puxuZ3CGTUSEmoZvYajDhreM26Jh/cQ4eWtMYEuesc+Rw== X-Gm-Gg: ASbGncu73SHY2Rd6Xwq0/9uL1DP6yJmumFGTWW332h3gvp94BB9aXiGbweyIgUALtRm eC8RvYxyqi6/UpbXGqJWsM86zPHllRfKp+wPNrBbmT/3BYvEBV+TlymioS3lGp1qHDwQj4oHPGe U1FjALkrVcMKV0aoCWLlB63Ih2tcN+wWeKbdYymGBSH2KJ49jyGsWPSdGYNyB8sDGBItZybgqzN 4tCYuoKUfqzyqqGgDxAKXevK1OtCeZi+JVehHW5o4N1g5bzBy0J2UljYuQse9bS X-Google-Smtp-Source: AGHT+IGm+Z4w/bz1Uk4SC2g2k9U9zRShbSSNv5Gug8R4N30esAKRpFmGXqjFk6j1Fji+wGsujabcCg== X-Received: by 2002:a05:6102:dd2:b0:4b2:cca8:88d0 with SMTP id ada2fe7eead31-4b3d0ee4e60mr22417050137.1.1736925110247; Tue, 14 Jan 2025 23:11:50 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:11:49 -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 05/19] ACPI: platform_profile: Add `probe` to platform_profile_ops Date: Wed, 15 Jan 2025 02:10:08 -0500 Message-ID: <20250115071022.4815-6-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 a `probe` callback to platform_profile_ops, which lets drivers initialize the choices member manually. Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 15 ++++++++-- .../surface/surface_platform_profile.c | 16 ++++++---- drivers/platform/x86/acer-wmi.c | 24 ++++++++------- drivers/platform/x86/amd/pmf/sps.c | 15 ++++++---- drivers/platform/x86/asus-wmi.c | 16 ++++++---- drivers/platform/x86/dell/alienware-wmi.c | 24 +++++++++------ drivers/platform/x86/dell/dell-pc.c | 26 ++++++++++------- drivers/platform/x86/hp/hp-wmi.c | 29 +++++++++++++------ drivers/platform/x86/ideapad-laptop.c | 15 ++++++---- .../platform/x86/inspur_platform_profile.c | 14 ++++++--- drivers/platform/x86/thinkpad_acpi.c | 15 ++++++---- include/linux/platform_profile.h | 1 + 12 files changed, 139 insertions(+), 71 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 161a05d57b0f..120f8402facd 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -465,12 +465,23 @@ int platform_profile_register(struct platform_profile_handler *pprof, void *drvd int err; /* Sanity check the profile handler */ - if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || - !pprof->ops->profile_set || !pprof->ops->profile_get) { + if (!pprof || !pprof->ops->profile_set || !pprof->ops->profile_get || + !pprof->ops->probe) { pr_err("platform_profile: handler is invalid\n"); return -EINVAL; } + err = pprof->ops->probe(drvdata, pprof->choices); + if (err) { + dev_err(pprof->dev, "platform_profile probe failed\n"); + return err; + } + + if (bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST)) { + dev_err(pprof->dev, "Failed to register a platform_profile class device with empty choices\n"); + return -EINVAL; + } + guard(mutex)(&profile_lock); /* create class interface for individual handler */ diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 76967bfeeef8..48cfe9cb89c8 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -201,7 +201,18 @@ static int ssam_platform_profile_set(struct device *dev, return tp; } +static int ssam_platform_profile_probe(void *drvdata, unsigned long *choices) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + return 0; +} + static const struct platform_profile_ops ssam_platform_profile_ops = { + .probe = ssam_platform_profile_probe, .profile_get = ssam_platform_profile_get, .profile_set = ssam_platform_profile_set, }; @@ -223,11 +234,6 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) tpd->has_fan = device_property_read_bool(&sdev->dev, "has_fan"); - set_bit(PLATFORM_PROFILE_LOW_POWER, tpd->handler.choices); - set_bit(PLATFORM_PROFILE_BALANCED, tpd->handler.choices); - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices); - return platform_profile_register(&tpd->handler, tpd); } diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 91ae48adf6cf..6953e36dbfde 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1916,7 +1916,20 @@ acer_predator_v4_platform_profile_set(struct device *dev, return 0; } +static int +acer_predator_v4_platform_profile_probe(void *drvdata, unsigned long *choices) +{ + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_QUIET, choices); + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + + return 0; +} + static const struct platform_profile_ops acer_predator_v4_platform_profile_ops = { + .probe = acer_predator_v4_platform_profile_probe, .profile_get = acer_predator_v4_platform_profile_get, .profile_set = acer_predator_v4_platform_profile_set, }; @@ -1931,17 +1944,6 @@ static int acer_platform_profile_setup(struct platform_device *device) platform_profile_handler.ops = &acer_predator_v4_platform_profile_ops; - set_bit(PLATFORM_PROFILE_PERFORMANCE, - platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, - platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_BALANCED, - platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_QUIET, - platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_LOW_POWER, - platform_profile_handler.choices); - 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 6ae82ae86d22..e710405b581f 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -387,7 +387,17 @@ static int amd_pmf_profile_set(struct device *dev, return 0; } +static int amd_pmf_profile_probe(void *drvdata, unsigned long *choices) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + return 0; +} + static const struct platform_profile_ops amd_pmf_profile_ops = { + .probe = amd_pmf_profile_probe, .profile_get = amd_pmf_profile_get, .profile_set = amd_pmf_profile_set, }; @@ -414,11 +424,6 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) dev->pprof.dev = dev->dev; dev->pprof.ops = &amd_pmf_profile_ops; - /* Setup supported modes */ - set_bit(PLATFORM_PROFILE_LOW_POWER, dev->pprof.choices); - set_bit(PLATFORM_PROFILE_BALANCED, dev->pprof.choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, dev->pprof.choices); - /* Create platform_profile structure and register */ err = platform_profile_register(&dev->pprof, dev); if (err) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index d88860dd028b..3d77f7454953 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3852,7 +3852,17 @@ static int asus_wmi_platform_profile_set(struct device *dev, return throttle_thermal_policy_write(asus); } +static int asus_wmi_platform_profile_probe(void *drvdata, unsigned long *choices) +{ + set_bit(PLATFORM_PROFILE_QUIET, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + return 0; +} + static const struct platform_profile_ops asus_wmi_platform_profile_ops = { + .probe = asus_wmi_platform_profile_probe, .profile_get = asus_wmi_platform_profile_get, .profile_set = asus_wmi_platform_profile_set, }; @@ -3885,12 +3895,6 @@ static int platform_profile_setup(struct asus_wmi *asus) asus->platform_profile_handler.dev = dev; 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, - asus->platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, - asus->platform_profile_handler.choices); - err = platform_profile_register(&asus->platform_profile_handler, asus); if (err == -EEXIST) { pr_warn("%s, a platform_profile handler is already registered\n", __func__); diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index f7a854d40575..0146d2f93be6 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -1078,12 +1078,7 @@ 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) +static int thermal_profile_probe(void *drvdata, unsigned long *choices) { enum platform_profile_option profile; enum wmax_thermal_mode mode; @@ -1116,19 +1111,30 @@ static int create_thermal_profile(struct platform_device *platform_device) profile = wmax_mode_to_platform_profile[mode]; supported_thermal_profiles[profile] = out_data; - set_bit(profile, pp_handler.choices); + set_bit(profile, choices); } - if (bitmap_empty(pp_handler.choices, PLATFORM_PROFILE_LAST)) + if (bitmap_empty(choices, PLATFORM_PROFILE_LAST)) return -ENODEV; if (quirks->gmode) { supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] = WMAX_THERMAL_MODE_GMODE; - set_bit(PLATFORM_PROFILE_PERFORMANCE, pp_handler.choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); } + return 0; +} + +static const struct platform_profile_ops awcc_platform_profile_ops = { + .probe = thermal_profile_probe, + .profile_get = thermal_profile_get, + .profile_set = thermal_profile_set, +}; + +static int create_thermal_profile(struct platform_device *platform_device) +{ pp_handler.name = "alienware-wmi"; pp_handler.dev = &platform_device->dev; pp_handler.ops = &awcc_platform_profile_ops; diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 9010a231f209..32b3be0723f8 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -24,6 +24,7 @@ #include "dell-smbios.h" static struct platform_device *platform_device; +static int supported_modes; static const struct dmi_system_id dell_device_table[] __initconst = { { @@ -231,7 +232,22 @@ static int thermal_platform_profile_get(struct device *dev, return 0; } +static int thermal_platform_profile_probe(void *drvdata, unsigned long *choices) +{ + if (supported_modes & DELL_QUIET) + set_bit(PLATFORM_PROFILE_QUIET, choices); + if (supported_modes & DELL_COOL_BOTTOM) + set_bit(PLATFORM_PROFILE_COOL, choices); + if (supported_modes & DELL_BALANCED) + set_bit(PLATFORM_PROFILE_BALANCED, choices); + if (supported_modes & DELL_PERFORMANCE) + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + return 0; +} + static const struct platform_profile_ops dell_pc_platform_profile_ops = { + .probe = thermal_platform_profile_probe, .profile_get = thermal_platform_profile_get, .profile_set = thermal_platform_profile_set, }; @@ -239,7 +255,6 @@ static const struct platform_profile_ops dell_pc_platform_profile_ops = { static int thermal_init(void) { int ret; - int supported_modes; /* If thermal commands are not supported, exit without error */ if (!dell_smbios_class_is_supported(CLASS_INFO)) @@ -265,15 +280,6 @@ static int thermal_init(void) thermal_handler->dev = &platform_device->dev; thermal_handler->ops = &dell_pc_platform_profile_ops; - if (supported_modes & DELL_QUIET) - set_bit(PLATFORM_PROFILE_QUIET, thermal_handler->choices); - if (supported_modes & DELL_COOL_BOTTOM) - set_bit(PLATFORM_PROFILE_COOL, thermal_handler->choices); - if (supported_modes & DELL_BALANCED) - set_bit(PLATFORM_PROFILE_BALANCED, thermal_handler->choices); - if (supported_modes & DELL_PERFORMANCE) - set_bit(PLATFORM_PROFILE_PERFORMANCE, thermal_handler->choices); - /* Clean up if failed */ ret = platform_profile_register(thermal_handler, NULL); if (ret) diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 60328b35be74..75bcd8460e7c 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1488,6 +1488,23 @@ static int platform_profile_victus_set(struct device *dev, return 0; } +static int hp_wmi_platform_profile_probe(void *drvdata, unsigned long *choices) +{ + if (is_omen_thermal_profile()) { + set_bit(PLATFORM_PROFILE_COOL, choices); + } else if (is_victus_thermal_profile()) { + set_bit(PLATFORM_PROFILE_QUIET, choices); + } else { + set_bit(PLATFORM_PROFILE_QUIET, choices); + set_bit(PLATFORM_PROFILE_COOL, choices); + } + + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + return 0; +} + static int omen_powersource_event(struct notifier_block *nb, unsigned long value, void *data) @@ -1566,16 +1583,19 @@ static inline void omen_unregister_powersource_event_handler(void) } static const struct platform_profile_ops platform_profile_omen_ops = { + .probe = hp_wmi_platform_profile_probe, .profile_get = platform_profile_omen_get, .profile_set = platform_profile_omen_set, }; static const struct platform_profile_ops platform_profile_victus_ops = { + .probe = hp_wmi_platform_profile_probe, .profile_get = platform_profile_victus_get, .profile_set = platform_profile_victus_set, }; static const struct platform_profile_ops hp_wmi_platform_profile_ops = { + .probe = hp_wmi_platform_profile_probe, .profile_get = hp_wmi_platform_profile_get, .profile_set = hp_wmi_platform_profile_set, }; @@ -1598,8 +1618,6 @@ static int thermal_profile_setup(struct platform_device *device) return err; platform_profile_handler.ops = &platform_profile_omen_ops; - - set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); } else if (is_victus_thermal_profile()) { err = platform_profile_victus_get_ec(&active_platform_profile); if (err < 0) @@ -1614,8 +1632,6 @@ static int thermal_profile_setup(struct platform_device *device) return err; platform_profile_handler.ops = &platform_profile_victus_ops; - - set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices); } else { tp = thermal_profile_get(); @@ -1631,15 +1647,10 @@ static int thermal_profile_setup(struct platform_device *device) return err; 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); } platform_profile_handler.name = "hp-wmi"; platform_profile_handler.dev = &device->dev; - 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, NULL); if (err) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 96e99513b0b5..050919a28d2b 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1023,6 +1023,15 @@ static int dytc_profile_set(struct device *dev, return -EINTR; } +static int dytc_profile_probe(void *drvdata, unsigned long *choices) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + return 0; +} + static void dytc_profile_refresh(struct ideapad_private *priv) { enum platform_profile_option profile; @@ -1064,6 +1073,7 @@ static const struct dmi_system_id ideapad_dytc_v4_allow_table[] = { }; static const struct platform_profile_ops dytc_profile_ops = { + .probe = dytc_profile_probe, .profile_get = dytc_profile_get, .profile_set = dytc_profile_set, }; @@ -1112,11 +1122,6 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) priv->dytc->priv = priv; priv->dytc->pprof.ops = &dytc_profile_ops; - /* Setup supported modes */ - set_bit(PLATFORM_PROFILE_LOW_POWER, priv->dytc->pprof.choices); - set_bit(PLATFORM_PROFILE_BALANCED, priv->dytc->pprof.choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, priv->dytc->pprof.choices); - /* Create platform_profile structure and register */ err = platform_profile_register(&priv->dytc->pprof, &priv->dytc); if (err) diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index d0a8e4eebffa..06df3aae9a56 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -164,7 +164,17 @@ static int inspur_platform_profile_get(struct device *dev, return 0; } +static int inspur_platform_profile_probe(void *drvdata, unsigned long *choices) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + return 0; +} + static const struct platform_profile_ops inspur_platform_profile_ops = { + .probe = inspur_platform_profile_probe, .profile_get = inspur_platform_profile_get, .profile_set = inspur_platform_profile_set, }; @@ -184,10 +194,6 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) priv->handler.dev = &wdev->dev; priv->handler.ops = &inspur_platform_profile_ops; - set_bit(PLATFORM_PROFILE_LOW_POWER, priv->handler.choices); - set_bit(PLATFORM_PROFILE_BALANCED, priv->handler.choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, priv->handler.choices); - return platform_profile_register(&priv->handler, priv); } diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 9978fd36a3d1..5c250867678f 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10538,7 +10538,17 @@ static int dytc_profile_set(struct device *dev, return err; } +static int dytc_profile_probe(void *drvdata, unsigned long *choices) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + return 0; +} + static const struct platform_profile_ops dytc_profile_ops = { + .probe = dytc_profile_probe, .profile_get = dytc_profile_get, .profile_set = dytc_profile_set, }; @@ -10584,11 +10594,6 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) { int err, output; - /* Setup supported modes */ - set_bit(PLATFORM_PROFILE_LOW_POWER, dytc_profile.choices); - set_bit(PLATFORM_PROFILE_BALANCED, dytc_profile.choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, dytc_profile.choices); - err = dytc_command(DYTC_CMD_QUERY, &output); if (err) return err; diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 6013c05d7b86..5ad1ab7b75e4 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -31,6 +31,7 @@ enum platform_profile_option { 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); }; 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: 13939948 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:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939949 Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) (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 79AD522FE0C; Wed, 15 Jan 2025 07:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925129; cv=none; b=IcTwEv7NmlZMIDDtG0TMIZe35VNyWU/fQhHZHy7nSyUWj1UleL04efulYILfKNjYM32Jjb2oVY9MeuOw2eJYlzEh/OwvzRPk76eKyqpBX4m7r60LUhu2VRDRTx1Hi1epmnrzikIcVTZbXSgnZfH7IiSUMeiOjI+XLL9yXOC5ymM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925129; c=relaxed/simple; bh=o+cWbQeJi7S+1Jp2xBu0B5+ONovcyCIwNoIbPhsR5Y4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V81kNi4asx6DabTj237wEfmBpn/qwL9Qi8+fbZIKfecbJL498AMjpaZVRWDif6w9sD3bKsyg+WmLiNo+CDMi2caFeuXLBl8NWr45L55WSmcoYNJeiDjZmBp3MrcvFFTJ2JrvZ6B9BMHoNxhA8a4SvP81UKxihQQSJNlWor/25uE= 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=Hfe8zwNb; arc=none smtp.client-ip=209.85.221.178 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="Hfe8zwNb" Received: by mail-vk1-f178.google.com with SMTP id 71dfb90a1353d-5162571e761so2182476e0c.2; Tue, 14 Jan 2025 23:12:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925125; x=1737529925; 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=9cSvCCgizWFu2j5Pl22QTuGZqF7L3nJpbDZ64GXsSdA=; b=Hfe8zwNbnKrwxV77H1khuUUQT+gr6J0yATuvOPbJqKsziHMBciQ+JS+RIjihS+xWJo 7q03ecNXcNy3SVZurMBaEc4b4o6oud0O7fLD0P9kSazTzLxN1JMlEEeD5/1RFpgSmLTf gmDO4C4DuRqoq6lOjhyrKXcopag4b/ufuW7TJucEjZ/IEbswF0d0uAuyhh0y8UeP3lbL ei5YwOqRaMMwkmqU56AggYMZX0wXGao0LSPqxQrsykeydbPJII3UR6vMtr1rBk+jfW2I HnYbH54GO8J4IbpyRICmzQbDKt5XPusHoy+dB5pNwq3iGAolmOeCqGlmMOiaBQJdza/5 d2dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925125; x=1737529925; 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=9cSvCCgizWFu2j5Pl22QTuGZqF7L3nJpbDZ64GXsSdA=; b=TmEy5Y4T+yF7DY4VVOqIxkDORTUZBvivfAWx8FMtxP6NdgHdxaxntF5cvkdRTs/Rnp obl92MSr+2EZHbiRd3oY9zcaupRU2E5CaWCIAwaweQ6+4EvVi2N2OVpL07g8BN7kYpft 2om8uW3bKqdmtCwID3OBeicEWKdgh6KH0irrrrEx0+iHZ0tTET8mAOlWNBnEFK7cfFJP zSSmw5uPTe0xT/H65bmL6m6n+BqFlACMJTLhaWGkYGN4rGGyqzwcoeiCi7QdtpYooZrP jUK5FjslAI90y3465uzZPCZe8hhkfz/fgfVyable59kLUP2CCBrxAD9Lc17o0662u9sB uIkQ== X-Forwarded-Encrypted: i=1; AJvYcCVb2l9sCOFc5njuc1JFk4GLaTaGhnjoO8CLab0lt+dh/BQGGkcOMgH3fBeqNq8uhwxShLFTHuR/1dMq@vger.kernel.org, AJvYcCWCRyTk8qdQSsuWZxk0AHmMRxXS4G+JmTVblFwTu7ccPmRim8cF0UottWrBbnHnobLqRz8A1mgN1/dxKniY@vger.kernel.org X-Gm-Message-State: AOJu0Yyo5WIuCy1tRhxFDG9OxYuKaZAlQmex4xlXJWda3rg/pclOnsCx t7vzqgy1RHpdXcJYQjipQE9cnCVlprNTp3AaDwvTPT0jb/pUKRTuulYV0A== X-Gm-Gg: ASbGnctjE+Zw22/q65UsRwF+DfvYE80V6t39Po56QlWJBd4WExjZgy6/DWLMBn/o7BJ P5vFUuwfUZcI+zSw50Nk/ly5qnJGcm9DxqH6hVru3cgBoqmG7W9SRpbi4shnezGd/2hujSzim4a 9sIM8d2G1rd8hA2QxPwe5b69zcGQCYyFrRL0AL4pVmiNbHInM05Fp0P2hRuZMoT8xlI+fElS5Fj M3gbt28l+eX0iOVNaoRIThb1/Ot76j3Ff1QUJaSI5GQ2Y+ZPLEaN/jsOz8wt2O1 X-Google-Smtp-Source: AGHT+IFPJdoYHZgWswAnj6/xvBCwmSr+QkDgzOX/NdU25coHV57K/dShxqfS5/ad7fuBrcXF18+y9A== X-Received: by 2002:a05:6102:26c8:b0:4af:bb06:62d with SMTP id ada2fe7eead31-4b3d0d9fd51mr27697615137.11.1736925124906; Tue, 14 Jan 2025 23:12:04 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:12:04 -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 07/19] platform/x86: acer-wmi: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:10 -0500 Message-ID: <20250115071022.4815-8-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/acer-wmi.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 6953e36dbfde..39ec236b7cdb 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1944,7 +1944,7 @@ static int acer_platform_profile_setup(struct platform_device *device) platform_profile_handler.ops = &acer_predator_v4_platform_profile_ops; - err = platform_profile_register(&platform_profile_handler, NULL); + err = devm_platform_profile_register(&platform_profile_handler, NULL); if (err) return err; @@ -2591,8 +2591,6 @@ static int acer_platform_probe(struct platform_device *device) return 0; error_hwmon: - if (platform_profile_support) - platform_profile_remove(&platform_profile_handler); error_platform_profile: acer_rfkill_exit(); error_rfkill: @@ -2613,9 +2611,6 @@ static void acer_platform_remove(struct platform_device *device) acer_backlight_exit(); acer_rfkill_exit(); - - if (platform_profile_support) - platform_profile_remove(&platform_profile_handler); } #ifdef CONFIG_PM_SLEEP 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: 13939950 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:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939951 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (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 2A32C231C8E; Wed, 15 Jan 2025 07:12:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925142; cv=none; b=Knvuy34FJ8mYZz4Xqoy0lw2itVReFoffcKMnffkkmNnJO4y146n0w4hy4NN6FQafhrL8Vd6vBVO/XkAUFgLdhnYpw4VquTP+FiE16vtGX+i7WFp1st3dXKIlK9uxRT8gDOyrNllGwmbv82rhs+L9GaPJ+Le1LEb6bloTZHPrOgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925142; c=relaxed/simple; bh=B+PxdPDh048pQD/k3PgrUQCKOG60hGDd1vrFivW5ztE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EMcQFz44pPV6Om25r5mnmpcuffEfP3cDHijEj3VyiuqwippgS1iVQ6y50hsB4NM3Mh4b3n9Ft2qmw38E2RPBu4br4z7i68wRydkJtruGDvD2y3Gg7ezSi1zT0qRXOhq7nwZdDfgDP7guooL24vqHKaWlwKp7zA8hhU8THl1ePDw= 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=gyr5I/lH; arc=none smtp.client-ip=209.85.217.52 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="gyr5I/lH" Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-4afdf300d07so3692244137.3; Tue, 14 Jan 2025 23:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925140; x=1737529940; 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=VXJtZ4DEJ2TVGLd1PBzRyZIRNg5LLQs9jY/0CznM+L0=; b=gyr5I/lHT77ag4BV99wRAFzURWhq/IGuthcVVGw73WvJh4NEJnLJYUtNS3DjGiAoWe /s47phvihOQmaLv5FB5huXFlaXJwZX+QSAgEGxY3lSTFEY6s/1OibCrXHzwtQYXVEzpo wnk5AKV/59Ao47v2mOKz2nP8i6RQX+5o5pgYn/taMaIvurjpZQ0yf9R3Og7RNBtWa1NS vxl1WIMI8e99qZGaDyscE2lPQ2q9fxf/qYC3OAJ59mkJLnNvLanYj2XcfeNR4gXW3ABa gXq15WBRL026ZhAid/t9VVpRGN811EfOxdZNfiEtI6iR+zbhv9pGmzpjfjryITF3MevW DRug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925140; x=1737529940; 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=VXJtZ4DEJ2TVGLd1PBzRyZIRNg5LLQs9jY/0CznM+L0=; b=qDtr5SPcuIibbI7zH0qxwfLu1EeXKHp+cDi7Fu7C4TPzxfNnIQDl9VeqajuDqKpO8d r70lbAwnr06nFhSboM4/ne2j+xo1fnWDPHeRVRkhM+h54niiTPd5Tk+3wIHSVw56qxBo TV2DRbNS6bf+7JxKopCO02G5Bapkw1lmBLmtgJSjaKSHsdugj7Dmz9AX3y4XTV+3IC9y q8zMyKdqUajp7of3xiZvrhuwXL8kzAZJzrPfGC1dTXYBJbqE+Eczn70ACzqh/j22S0Xy yVDGW9gUojBMOErBZM7tRxVWYdYB2bhCRQAv/uxKxZuIn8h8cDczVlOdPGGR7aB7y5KQ xAwQ== X-Forwarded-Encrypted: i=1; AJvYcCW/677YP5yegfoE/fl3+dR8PFuMlLfuGOskxKODYYrAkfUmFTFCVbEBW1UTbYpvYjepgpLuQxJ7rvDl0Pgm@vger.kernel.org, AJvYcCWk/iau2lGVJ1OrYoKZLovXcDZL2lQHIc06UeOZ8BTlZVzObwZysjWj46OBfYnmOsDI2JNeMu2GTrRu@vger.kernel.org X-Gm-Message-State: AOJu0YwKagiY8HWYhIZEm0iNKH4TAGeZXwH4GQKin9RImXgq1NvQ7BtM 0j3N+vReo03TY+4Kiido5wEWBXe+O852iiVSHb8BKyAdVL0gFk0CylzQ6g== X-Gm-Gg: ASbGnctL4pYoCCgXfsoMVznsK+W1XkQw2Ff5KnR/DPtcdt01oT0cRFC1McEvy0ghLTj 7w5+5MJsXZj4zV+HEu0frtU9FJwXUJlpmtXwKnJHFeWMq9+WoqkJ6NPHN40nNYRf/xvvTkeNcoj 1Y7D99hMXlL6o3qv00PA1f0V7IjXk2zwiK0yX01PaoGNTao7UfgaSkqinQvN1P7fiB8yHY8rvd4 3C08EJHDlUfDTEDk/yRpcfvB24cMvbChY6zM301EZDlzynmMeKS0loJ+BXkRzAV X-Google-Smtp-Source: AGHT+IFX7hf91lbxOibrFIOrjzixs61Nl5Lhpyf5V3eGDskxCLoLgPym7EOm/71BWJs2UjUNJBcKFw== X-Received: by 2002:a05:6102:808b:b0:4b6:3e7e:ee48 with SMTP id ada2fe7eead31-4b63e7ef1c9mr12231487137.18.1736925139809; Tue, 14 Jan 2025 23:12:19 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:12:19 -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 09/19] platform/x86: asus-wmi: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:12 -0500 Message-ID: <20250115071022.4815-10-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/asus-wmi.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 3d77f7454953..f8437cff66df 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3895,12 +3895,12 @@ static int platform_profile_setup(struct asus_wmi *asus) asus->platform_profile_handler.dev = dev; asus->platform_profile_handler.ops = &asus_wmi_platform_profile_ops; - err = platform_profile_register(&asus->platform_profile_handler, asus); + err = devm_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; } else if (err) { - pr_err("%s, failed at platform_profile_register: %d\n", __func__, err); + pr_err("%s, failed at devm_platform_profile_register: %d\n", __func__, err); return err; } @@ -4859,8 +4859,6 @@ static int asus_wmi_add(struct platform_device *pdev) fail_sysfs: fail_custom_fan_curve: fail_platform_profile_setup: - if (asus->platform_profile_support) - platform_profile_remove(&asus->platform_profile_handler); fail_fan_boost_mode: fail_platform: kfree(asus); @@ -4886,9 +4884,6 @@ static void asus_wmi_remove(struct platform_device *device) throttle_thermal_policy_set_default(asus); asus_wmi_battery_exit(asus); - if (asus->platform_profile_support) - platform_profile_remove(&asus->platform_profile_handler); - kfree(asus); } 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: 13939952 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:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939953 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (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 3BFCC22FDF5; Wed, 15 Jan 2025 07:12:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925157; cv=none; b=TDyl4q5B3KHzbdzqrA+e8Q/WxNB7wOR90gAyv/5/gfemZxBwBA5AADXXinvP/f1Soi1m50P+jkCy2o3wscAZjD2KlfXYlZQmuhNtYtzkwazWN5tTpA1Ps0u8rQLt3oT6gKhiHHnJGRoSqDr91hHW32uHZDIzl09R2frtMW6q1ow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925157; c=relaxed/simple; bh=RYBV3WHqYGGLVMJtlf+XdZc5lVADyrz5mva+EyzjLU0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BOe41ChtmddT90IHWEOgupstye+faa703sMbdkoxLQ39qObStPMqQlKhpdWKquHxNExAMAYjzgJTAsL8LiHjKWm22kFtQ2r8iY9c0ufZO76i3XOmYNKcGMjK1U/UL61YhGWhdL9cr/odgCOdeTj7gxdaZWRGCeOrK3JoQ7wUi6E= 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=fi19p4q+; arc=none smtp.client-ip=209.85.217.52 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="fi19p4q+" Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-4afdf300d07so3692356137.3; Tue, 14 Jan 2025 23:12:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925155; x=1737529955; 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=BywPHAK5iwjfpxiwZUmDd/hXBkyns5UQD/vx5CTXKmc=; b=fi19p4q+/6CWDYGRL0hYV8dsg8RwHzBepuZ/nwg/Ct6kS0jByrcvZZNpiiQIw1Cqct /b5BqMJXR0ylBb1+O4XEy5lAf7+JQ68ktYtdkQXkwSRa9+0f8DpqudU2qw7FfD6zjabE rjXc/xmG97VQKVhsJDn3LsI31T4KCn8Q8uOWJpF+9NXceuRCfIfXlkwKrzHq+lzpQwx5 Lt1vlKtJB+2bthXvWT8aC+dGSsLzkPXk2Itr7ht4WOkuAlSKX6nRyExLQemDSaUt3nbr Mb9MjSRxYA5VRQ/1mpOhmNXQdGHooUSfozJ0k/AVvjcgSnh2PFRLAiKlHBoEzLGJ7m1X ol7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925155; x=1737529955; 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=BywPHAK5iwjfpxiwZUmDd/hXBkyns5UQD/vx5CTXKmc=; b=P0DYGiIF0PHgb8JIiCfQfC7m+41iYn6wVa5Y2rFGYJ4fD1TqkgDH1IDpbzI5viazOf j8EztyNabkZkm+SDrki74aXF2WUct0HNQ9Egad49UdErCssHxnMxjOPGxeQcKJwUSjlp dzUvA1YDYrNlz21Q9DjEpIFXyj3kgyzOXSRRunZWl6O7E+PK0/pdbamSWpuuxhJDuxUg UXsnB3u+XXsPnzlLllcuByGPxJ+6fetsf+t8COhYbgS+rA0ZprujCeTaF+dRQAfIFbdb 61Ta7LMvpZL14VZZ8LsiehJlSj6hJ2Jc80/CrW5lzFyse2dHfsZJ82NHbOQLe/7ow271 zGzQ== X-Forwarded-Encrypted: i=1; AJvYcCUp/5HogriskRWbDgHGGmM0cXVRfQawotyhCn/q1bixB10rkAlGbiL3+JcwjCNNwl3ZKBdSC/Woc5Wakb1E@vger.kernel.org, AJvYcCWH0yIXaM7vHzwR1VxO9TA2CENVGYiTh+SRMDVhhS78BIPPfF+5fgxmpjx5hhT5Du+IORwjdmmGuv4g@vger.kernel.org X-Gm-Message-State: AOJu0YwD0OOeOz1yQh/CIv8TwEE2twW21eiSPKspD+3qPytm2JqV3mah K7AWP8lM8sx3SCxXFCs0Qz5+rUUPoLeDAIdv7wqYoFuO3Wn2EsE92XvkrA== X-Gm-Gg: ASbGncsMUT6k47VX/CGaiXHE/8viQkKM6mUqstjVCTrYeoxPFeGbWNVLTcGebTUst/o kTdet6pD1iuDRLd/j7niicUnb5dh66RW4pBwctYpGtTOwFClozSXzO9sXE7WNqgToFYWLoIDBCE BlY9tbrBBHBn63XpL+UlEWj+bvIUpmig/rrUMMINlD8DEe3aYxPHtXEduXu8VIb+byILCr+Txh4 bRf6oNE8LysTUYKhRai3tRzxL4KotixT2w754dKASMoqs7bNWXX5sYBUc+YpVCq X-Google-Smtp-Source: AGHT+IFY/GoVlMclviETG+R1AFZXYR1yDAMEjS2fnmaE3MToUP/90i9XUgSxGcoBmngjiyE3ApWMMQ== X-Received: by 2002:a05:6102:b02:b0:4b1:1b07:f7c3 with SMTP id ada2fe7eead31-4b3d0e6376cmr25070480137.20.1736925154757; Tue, 14 Jan 2025 23:12:34 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:12:34 -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 11/19] platform/x86: ideapad-laptop: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:14 -0500 Message-ID: <20250115071022.4815-12-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/ideapad-laptop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 050919a28d2b..87c1e087770a 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1123,7 +1123,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) priv->dytc->pprof.ops = &dytc_profile_ops; /* Create platform_profile structure and register */ - err = platform_profile_register(&priv->dytc->pprof, &priv->dytc); + err = devm_platform_profile_register(&priv->dytc->pprof, &priv->dytc); if (err) goto pp_reg_failed; @@ -1145,7 +1145,6 @@ static void ideapad_dytc_profile_exit(struct ideapad_private *priv) if (!priv->dytc) return; - platform_profile_remove(&priv->dytc->pprof); mutex_destroy(&priv->dytc->mutex); kfree(priv->dytc); 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: 13939954 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:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939955 Received: from mail-vs1-f46.google.com (mail-vs1-f46.google.com [209.85.217.46]) (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 E534822F388; Wed, 15 Jan 2025 07:12:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925172; cv=none; b=bJbf0nyd7EQ+CE2T9Ka6xdtw3yNI9lRO6mQmNGd9/Jxrdd6zKlwD1a6mOAmKXp2fmGqCnZr+Ki7Fn/5o+lznAQChYEojhzWVcGsUHol1nHJGuIa8F2j5HkAoQwoGZZCAgmXhfIF9rtn5e03jPJSM6k0kvV21xrKIfafBqZ+0XP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925172; c=relaxed/simple; bh=jpIOJ2WQ3LP4s2VyPamcYNiT/HAo/fgENm0150i2hh0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aiVVkbtdZ2eiXBv5u/R0foE2W6VNrAbIAg6tJAZ47agHM+5MSN9B4zGtbzE7KMaMbyc+5UdWXDZ8E4SnyMBgxG1TZcp/FvC1hbXEuF4t5fkDBiVni5dpO8y0uqOok0aEykYpMOo9GsK5n+XzIpy6/rtHRst3qXC2AUoH2ql9pbk= 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=QaDUg+Lh; arc=none smtp.client-ip=209.85.217.46 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="QaDUg+Lh" Received: by mail-vs1-f46.google.com with SMTP id ada2fe7eead31-4b6398d477fso917413137.0; Tue, 14 Jan 2025 23:12:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925169; x=1737529969; 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=7Bslg8YPubVdyuYVrXhPddxIABzDcDevDQwcDkILavI=; b=QaDUg+LhAtrQS4dmueLLX93ANcBjnR0TEMhhVsUjtldwSgtJgUjH5mz9uwQ3ci1qyp ZvanmVUUIPE1iVv2IF7IsmZfX6Fxcc3aHLiOFgR1IdLUuHcHT7AmwwmHpTM3PJHMRgBg FO86H6ckm2i+HgwTAfNm52diCHBllfQHjK8MEjSDuOSe4EDpduJR9VouDPoWFc5C4m/A gr6KC2W71fWU6fqd14mosv/7FzzOc5hnpy3FfBs4M5H/b6VZPa01/l9HYwZXlzg/nJtk hn13B3BArf47Z0ADE0ikYc9sCrB03NfEH2k379Gp6EhFDdnuA6gWyO2JeOsI38lEIEZ4 ZuJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925169; x=1737529969; 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=7Bslg8YPubVdyuYVrXhPddxIABzDcDevDQwcDkILavI=; b=YoW+drtA7nTOTz/YD3shi/6J4mgoRcjTn8eZzHF7L8Zv9vNrVqlhdAzbjWWo9zwIuj RCreipVETsoiaEp+iZZuEQDOsoGJWYI2E9TAy8qcZkH2OmHOVwGHDQ6Y2GzrPEufyw7D eiJ7lFByJ0TG1o1M6c1GrjUNhJ5ElV5orapTpS18zb9KSdGJFctKG6aNx2M8KKjK8Aff 6lwtNwxYhQszLEACbF51xuTyd/PCbcpzTPC1X7DnP3LQ35lHQLg5loX1yyFlfsfhe2af LrbKblioKugt5pXTvOBhwqV62Ct7xH48bRm0g0fmaD2ZL4RxWJOXxbUl3Pf+MdAE2SI3 5uYw== X-Forwarded-Encrypted: i=1; AJvYcCXbJQzMZqRQ6PLMkSYKK+XE6LULYnT0s2ZqZIV43vKBl5gzMrU+Yx+kT8rs72iow4kPHxkcD5x1TToPbZzk@vger.kernel.org, AJvYcCXlnP1akiREqQDP5V4cuxQI7WhkVFJegZQvSITXbnnKE9xOT4dwa8S05Fcs3ULd7PBqHfpmhZFb/pkk@vger.kernel.org X-Gm-Message-State: AOJu0YzTkDzZWS44M2PdYxq/+HNvG6vK4wXydVXCvU5UBFEIw6a2ul55 oT6a0PQG3BAAaejKsA3DtnqEWCj2lgCQVrdxuTnANx+hKcp+vReRaq1Kkg== X-Gm-Gg: ASbGncthF8PIbGnPwoGZ6BOv7r3vA4eMt7Glx3D8+m9RJkjpyrHaIpFcz4NFtUhOipS An82AzmWX9Fcr7F68HzSeAt0jL8++WnyunOlzA+4dGPHGK9+JYCIODmFem42nAolfQhVxrsTwRl isiTi09MaGzyjgLPrLxXAF47BLNGFhCFtD8/6sQRWmvN+DGqZGYMXUXwrzpd+Dt8ydbV/tq1vh4 GS+UttZZlYCmaiHmTCoCQCx99STK9ykROBj2N6Hb6uRveHgpsDaoqlN57KnoJLH X-Google-Smtp-Source: AGHT+IHINVH7sPReywIOsggLGwidSB8frsJiyKoY9ksQdGcCIlrr0mlvQYT8NuHZJEy5eu0GCb3knA== X-Received: by 2002:a05:6102:80a2:b0:4b1:1caf:f61b with SMTP id ada2fe7eead31-4b3d104867bmr26191206137.18.1736925169357; Tue, 14 Jan 2025 23:12:49 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:12:48 -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 13/19] platform/x86: inspur_platform_profile: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 02:10:16 -0500 Message-ID: <20250115071022.4815-14-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. While at it, pass inspur_wmi_priv to the class device as drvdata and replace uses of container_of() with dev_get_drvdata(). Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/inspur_platform_profile.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 06df3aae9a56..e1631de6ad86 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -194,15 +194,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) priv->handler.dev = &wdev->dev; priv->handler.ops = &inspur_platform_profile_ops; - return platform_profile_register(&priv->handler, priv); -} - -static void inspur_wmi_remove(struct wmi_device *wdev) -{ - struct inspur_wmi_priv *priv; - - priv = dev_get_drvdata(&wdev->dev); - platform_profile_remove(&priv->handler); + return devm_platform_profile_register(&priv->handler, priv); } static const struct wmi_device_id inspur_wmi_id_table[] = { @@ -219,7 +211,6 @@ static struct wmi_driver inspur_wmi_driver = { }, .id_table = inspur_wmi_id_table, .probe = inspur_wmi_probe, - .remove = inspur_wmi_remove, .no_singleton = true, }; 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: 13939956 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:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939957 Received: from mail-vk1-f180.google.com (mail-vk1-f180.google.com [209.85.221.180]) (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 53221234CE7; Wed, 15 Jan 2025 07:13:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925188; cv=none; b=MaDMP6mkBx7zrZtQzbF53NtgQ2UmvlVOmEIQmEA75v0/brz28gxH+zlN9U8nXGJS+WF9auTpRpLAJ7D3ifK8YRt8OlEebeWWcT056wxOT9oxvBKNQXCt2omGiKPYmRaLejvnjwtFm7ezKTnW7US07v/oxXbfZU7aZ96h9Hrburc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925188; c=relaxed/simple; bh=oUgiIM4eBZS5JrQtSe6eSHxl6CCoDN8UTAtVQ3qCp5k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TnznjIC+EukGW+AsOtyfi/bJVST3kvoKeAWj6emS5TVdzx7LKzP6o7vNPfIuqIawwLgtpp+sC4To4kVLhg8IWxteRDyGTcjURKQ5C4eQy6BYh7rkoeunul5DUcQuRtIrDS1Q/QAs3aa2KafBuB0j70wGGWV0W2l1GrQe2cCeBCk= 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=NFAvq1vp; arc=none smtp.client-ip=209.85.221.180 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="NFAvq1vp" Received: by mail-vk1-f180.google.com with SMTP id 71dfb90a1353d-5187f0b893dso2229764e0c.3; Tue, 14 Jan 2025 23:13:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925185; x=1737529985; 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=ICKIA+CnJ0rKyaBoi1C3JqntZBHRctlAyF7OogW1eOc=; b=NFAvq1vp+WzQBO6HIZHMFJO2I8EOWadNabhzoicM7JuQbSKnfN1ch7smvDVu2VzHqq G0sZiwzCkL1ugSwvwLST/eYnU1bMG6duBE8WGbL9HU9fu+sd888c0jYsI6D/u1pKbFpd krXMQr87+92jEzej2WcPi2+F2MCYAhc/poIqkmHo9zTBq5ylOLij43fWRdwoIpnlQLli dhdOuA7uYTfTsYlFVwnSL66tQ12vpHJDTc/c7qpCJRgmUBHUXDygvXsFC14H88odwY+G Pt+8WZ9ldE06V9bBKtw48OsJHshg2rANwGcnLbpH4kz7Z+X5VX+jpy2XP92LMLTWAkR9 GgZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925185; x=1737529985; 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=ICKIA+CnJ0rKyaBoi1C3JqntZBHRctlAyF7OogW1eOc=; b=fREyGgB5OqpEzG8znxVvY5av+W2sLL031+BCds624oNb00Vaef9VdloXCbBVf3m1gH AVlGuzucqMAcwYOSQ4jfFfiaQpmamXZqIeTuKfTpJl3VSdTz5e6HUs45qVf2hamCxSuI u5US1Rouxm+fFbIkms4/TmtbyGhQqdSM5ikuKriZ7MD+YxoIHMPCSNl/vmg9xK8wJNba 3ekrjdGJ3+wmuSLwnp/W0/wYL29vUHCpMyvU+2Us5mnDB/QCDNSUnk6IX1MnRZ3HyL8o m0n21amxxRIlKTYGKh4SD8Ab3LAJRKPXh3U54BQ3C8oVoHhcEUBFeQdeQG4bPzCXHnhd CPag== X-Forwarded-Encrypted: i=1; AJvYcCVg7qVv4rVujosXJn01ofL+e5Anj7zKuu8LrLeeXVD4xHjy/qyv0kOyrgyF8DfmEA+1Kh+d4THLwvQa@vger.kernel.org, AJvYcCVy2IMljVOoWTwis/iwpuOv1wHGoSsi7FIHERVVJG/CiTnHGLH/wutL9fXMp78rBTEKQzvnhgB/2lsRYW0F@vger.kernel.org X-Gm-Message-State: AOJu0YxfTD5DPqobDvC6/ENO5SBZcbiDGRql0dvPGYuIYe5tIaRvdxlr K+Bb3GugQgdR/RIud0lHmBClr8rkucSyrZhuqpbVDqjG48wCXvYypFyhPg== X-Gm-Gg: ASbGncvS5+K93zfEcGvrT0zISAuW9QJR2NhDl7Lj8NBl1jOWi0QnQvlD7Bd9qjXv57/ tJyUwt4Gr2IjBfUqoQBKgSEMdS0LRhgQ4KW7MPw6zwTG5ceWoHls8WTcqNNAGvxehVAJx/j7p+l OabaIjRZDQ5++JiXQMDecb3gaZnPnJon3KWrD2d8JX78cmCDlQvYzRMpRqvDNFs+NSvzwMC9RU+ NxVzl7FZzYZGCYAq60eSRMe240/kqF6HsPdyG+pMXikVFOAd56ZXs0Yn5/NPvdp X-Google-Smtp-Source: AGHT+IFB98FERXAuK8vT36AbKOk0AtWALtMhD8Pu3Gyw7qPgrxYmtWWKsLwWa6L4aEIV011ihAs8TQ== X-Received: by 2002:a05:6102:2acb:b0:4b1:11c6:d3c6 with SMTP id ada2fe7eead31-4b3d0ee45a7mr22905711137.5.1736925184608; Tue, 14 Jan 2025 23:13:04 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:13:03 -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 15/19] ACPI: platform_profile: Remove platform_profile_handler from exported symbols Date: Wed, 15 Jan 2025 02:10:18 -0500 Message-ID: <20250115071022.4815-16-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 In order to protect the platform_profile_handler from API consumers, allocate it in platform_profile_register() and modify it's signature accordingly. Remove the platform_profile_handler from all consumer drivers and replace them with a pointer to the class device, which is now returned from platform_profile_register(). Replace *pprof with a pointer to the class device in the rest of exported symbols. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 98 ++++++++++++------- .../surface/surface_platform_profile.c | 11 +-- drivers/platform/x86/acer-wmi.c | 18 ++-- drivers/platform/x86/amd/pmf/pmf.h | 2 +- drivers/platform/x86/amd/pmf/sps.c | 17 ++-- drivers/platform/x86/asus-wmi.c | 20 ++-- drivers/platform/x86/dell/alienware-wmi.c | 10 +- drivers/platform/x86/dell/dell-pc.c | 22 ++--- drivers/platform/x86/hp/hp-wmi.c | 19 ++-- drivers/platform/x86/ideapad-laptop.c | 15 +-- .../platform/x86/inspur_platform_profile.c | 9 +- drivers/platform/x86/thinkpad_acpi.c | 14 +-- include/linux/platform_profile.h | 12 ++- 13 files changed, 132 insertions(+), 135 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 120f8402facd..a1dfa168f51f 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -212,9 +213,17 @@ static struct attribute *profile_attrs[] = { }; ATTRIBUTE_GROUPS(profile); +static void pprof_device_release(struct device *dev) +{ + struct platform_profile_handler *pprof = to_pprof_handler(dev); + + kfree(pprof); +} + static const struct class platform_profile_class = { .name = "platform-profile", .dev_groups = profile_groups, + .dev_release = pprof_device_release, }; /** @@ -408,10 +417,10 @@ static const struct attribute_group platform_profile_group = { .is_visible = profile_class_is_visible, }; -void platform_profile_notify(struct platform_profile_handler *pprof) +void platform_profile_notify(struct device *dev) { scoped_cond_guard(mutex_intr, return, &profile_lock) { - _notify_class_profile(&pprof->class_dev, NULL); + _notify_class_profile(dev, NULL); } sysfs_notify(acpi_kobj, NULL, "platform_profile"); } @@ -460,42 +469,54 @@ int platform_profile_cycle(void) } EXPORT_SYMBOL_GPL(platform_profile_cycle); -int platform_profile_register(struct platform_profile_handler *pprof, void *drvdata) +struct device *platform_profile_register(struct device *dev, const char *name, + void *drvdata, + const struct platform_profile_ops *ops) { + struct device *ppdev; + int minor; int err; - /* Sanity check the profile handler */ - if (!pprof || !pprof->ops->profile_set || !pprof->ops->profile_get || - !pprof->ops->probe) { - pr_err("platform_profile: handler is invalid\n"); - return -EINVAL; - } + /* Sanity check */ + if (WARN_ON_ONCE(!dev || !name || !ops || !ops->profile_get || + !ops->profile_set || !ops->probe)) + return ERR_PTR(-EINVAL); + + struct platform_profile_handler *pprof __free(kfree) = kzalloc( + sizeof(*pprof), GFP_KERNEL); + if (!pprof) + return ERR_PTR(-ENOMEM); - err = pprof->ops->probe(drvdata, pprof->choices); + err = ops->probe(drvdata, pprof->choices); if (err) { - dev_err(pprof->dev, "platform_profile probe failed\n"); - return err; + dev_err(dev, "platform_profile probe failed\n"); + return ERR_PTR(err); } if (bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST)) { - dev_err(pprof->dev, "Failed to register a platform_profile class device with empty choices\n"); - return -EINVAL; + dev_err(dev, "Failed to register platform_profile class device with empty choices\n"); + return ERR_PTR(-EINVAL); } guard(mutex)(&profile_lock); /* create class interface for individual handler */ - pprof->minor = ida_alloc(&platform_profile_ida, GFP_KERNEL); - if (pprof->minor < 0) - return pprof->minor; + minor = ida_alloc(&platform_profile_ida, GFP_KERNEL); + if (minor < 0) + return ERR_PTR(minor); + pprof->name = name; + pprof->ops = ops; + pprof->minor = minor; pprof->class_dev.class = &platform_profile_class; - pprof->class_dev.parent = pprof->dev; + pprof->class_dev.parent = 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); + /* device_register() takes ownership of ppdev */ + ppdev = &no_free_ptr(pprof)->class_dev; + err = device_register(ppdev); if (err) { - put_device(&pprof->class_dev); + put_device(ppdev); goto cleanup_ida; } @@ -505,20 +526,21 @@ int platform_profile_register(struct platform_profile_handler *pprof, void *drvd if (err) goto cleanup_cur; - return 0; + return ppdev; cleanup_cur: - device_unregister(&pprof->class_dev); + device_unregister(ppdev); cleanup_ida: - ida_free(&platform_profile_ida, pprof->minor); + ida_free(&platform_profile_ida, minor); - return err; + return ERR_PTR(err); } EXPORT_SYMBOL_GPL(platform_profile_register); -int platform_profile_remove(struct platform_profile_handler *pprof) +int platform_profile_remove(struct device *dev) { + struct platform_profile_handler *pprof = to_pprof_handler(dev); int id; guard(mutex)(&profile_lock); @@ -536,30 +558,32 @@ EXPORT_SYMBOL_GPL(platform_profile_remove); static void devm_platform_profile_release(struct device *dev, void *res) { - struct platform_profile_handler **pprof = res; + struct device **ppdev = res; - platform_profile_remove(*pprof); + platform_profile_remove(*ppdev); } -int devm_platform_profile_register(struct platform_profile_handler *pprof, void *drvdata) +struct device *devm_platform_profile_register(struct device *dev, const char *name, + void *drvdata, + const struct platform_profile_ops *ops) { - struct platform_profile_handler **dr; - int ret; + struct device *ppdev; + struct device **dr; dr = devres_alloc(devm_platform_profile_release, sizeof(*dr), GFP_KERNEL); if (!dr) - return -ENOMEM; + return ERR_PTR(-ENOMEM); - ret = platform_profile_register(pprof, drvdata); - if (ret) { + ppdev = platform_profile_register(dev, name, drvdata, ops); + if (IS_ERR(ppdev)) { devres_free(dr); - return ret; + return ppdev; } - *dr = pprof; - devres_add(pprof->dev, dr); + *dr = ppdev; + devres_add(dev, dr); - return 0; + return ppdev; } EXPORT_SYMBOL_GPL(devm_platform_profile_register); diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index bbdc873cb788..0e479e35e66e 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -40,7 +40,7 @@ struct ssam_tmp_profile_info { struct ssam_platform_profile_device { struct ssam_device *sdev; - struct platform_profile_handler handler; + struct device *ppdev; bool has_fan; }; @@ -228,13 +228,12 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) tpd->sdev = sdev; ssam_device_set_drvdata(sdev, tpd); - tpd->handler.name = "Surface Platform Profile"; - tpd->handler.dev = &sdev->dev; - tpd->handler.ops = &ssam_platform_profile_ops; - tpd->has_fan = device_property_read_bool(&sdev->dev, "has_fan"); - return devm_platform_profile_register(&tpd->handler, tpd); + tpd->ppdev = devm_platform_profile_register(&sdev->dev, "Surface Platform Profile", + tpd, &ssam_platform_profile_ops); + + return PTR_ERR_OR_ZERO(tpd->ppdev); } static const struct ssam_device_id ssam_platform_profile_match[] = { diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 39ec236b7cdb..3e39465b3783 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -758,7 +758,7 @@ static const struct dmi_system_id non_acer_quirks[] __initconst = { {} }; -static struct platform_profile_handler platform_profile_handler; +static struct device *platform_profile_device; static bool platform_profile_support; /* @@ -1937,16 +1937,10 @@ static const struct platform_profile_ops acer_predator_v4_platform_profile_ops = static int acer_platform_profile_setup(struct platform_device *device) { if (quirks->predator_v4) { - int err; - - platform_profile_handler.name = "acer-wmi"; - platform_profile_handler.dev = &device->dev; - platform_profile_handler.ops = - &acer_predator_v4_platform_profile_ops; - - err = devm_platform_profile_register(&platform_profile_handler, NULL); - if (err) - return err; + platform_profile_device = devm_platform_profile_register( + &device->dev, "acer-wmi", NULL, &acer_predator_v4_platform_profile_ops); + if (IS_ERR(platform_profile_device)) + return PTR_ERR(platform_profile_device); platform_profile_support = true; @@ -2033,7 +2027,7 @@ static int acer_thermal_profile_change(void) if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI) last_non_turbo_profile = tp; - platform_profile_notify(&platform_profile_handler); + platform_profile_notify(platform_profile_device); } return 0; diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index d99b3556205b..41b2b91b8fdc 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -338,7 +338,7 @@ struct amd_pmf_dev { struct mutex lock; /* protects the PMF interface */ u32 supported_func; enum platform_profile_option current_profile; - struct platform_profile_handler pprof; + struct device *ppdev; /* platform profile class device */ struct dentry *dbgfs_dir; int hb_interval; /* SBIOS heartbeat interval */ struct delayed_work heart_beat; diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 7c7ed2b9de01..e6cf0b22dac3 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -404,8 +404,6 @@ static const struct platform_profile_ops amd_pmf_profile_ops = { int amd_pmf_init_sps(struct amd_pmf_dev *dev) { - int err; - dev->current_profile = PLATFORM_PROFILE_BALANCED; if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) { @@ -420,15 +418,12 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) amd_pmf_set_sps_power_limits(dev); } - dev->pprof.name = "amd-pmf"; - dev->pprof.dev = dev->dev; - dev->pprof.ops = &amd_pmf_profile_ops; - /* Create platform_profile structure and register */ - 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); + dev->ppdev = devm_platform_profile_register(dev->dev, "amd-pmf", dev, + &amd_pmf_profile_ops); + if (IS_ERR(dev->ppdev)) + dev_err(dev->dev, "Failed to register SPS support, this is most likely an SBIOS bug: %ld\n", + PTR_ERR(dev->ppdev)); - return err; + return PTR_ERR_OR_ZERO(dev->ppdev); } diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index f8437cff66df..aea1c4d805bd 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -313,7 +313,7 @@ struct asus_wmi { bool mid_fan_curve_available; struct fan_curve_data custom_fan_curves[3]; - struct platform_profile_handler platform_profile_handler; + struct device *ppdev; bool platform_profile_support; // The RSOC controls the maximum charging percentage. @@ -3789,7 +3789,7 @@ static ssize_t throttle_thermal_policy_store(struct device *dev, * Ensure that platform_profile updates userspace with the change to ensure * that platform_profile and throttle_thermal_policy_mode are in sync. */ - platform_profile_notify(&asus->platform_profile_handler); + platform_profile_notify(asus->ppdev); return count; } @@ -3891,17 +3891,13 @@ static int platform_profile_setup(struct asus_wmi *asus) dev_info(dev, "Using throttle_thermal_policy for platform_profile support\n"); - asus->platform_profile_handler.name = "asus-wmi"; - asus->platform_profile_handler.dev = dev; - asus->platform_profile_handler.ops = &asus_wmi_platform_profile_ops; + asus->ppdev = devm_platform_profile_register(dev, "asus-wmi", asus, + &asus_wmi_platform_profile_ops); + if (IS_ERR(asus->ppdev)) { + pr_err("%s, failed at devm_platform_profile_register: %ld\n", + __func__, PTR_ERR(asus->ppdev)); - err = devm_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; - } else if (err) { - pr_err("%s, failed at devm_platform_profile_register: %d\n", __func__, err); - return err; + return PTR_ERR(asus->ppdev); } asus->platform_profile_support = true; diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index 0146d2f93be6..d3564e24c782 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -406,7 +406,6 @@ struct wmax_u32_args { static struct platform_device *platform_device; static struct color_platform colors[4]; -static struct platform_profile_handler pp_handler; static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; static u8 interface; @@ -1135,11 +1134,12 @@ static const struct platform_profile_ops awcc_platform_profile_ops = { static int create_thermal_profile(struct platform_device *platform_device) { - pp_handler.name = "alienware-wmi"; - pp_handler.dev = &platform_device->dev; - pp_handler.ops = &awcc_platform_profile_ops; + struct device *ppdev; - return devm_platform_profile_register(&pp_handler, NULL); + ppdev = devm_platform_profile_register(&platform_device->dev, "alienware-wmi", + NULL, &awcc_platform_profile_ops); + + return PTR_ERR_OR_ZERO(ppdev); } /* diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 2759bb608b1a..1874d4adfb8a 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -109,8 +109,6 @@ MODULE_DEVICE_TABLE(dmi, dell_device_table); #define DELL_ACC_SET_FIELD GENMASK(11, 8) #define DELL_THERMAL_SUPPORTED GENMASK(3, 0) -static struct platform_profile_handler *thermal_handler; - enum thermal_mode_bits { DELL_BALANCED = BIT(0), DELL_COOL_BOTTOM = BIT(1), @@ -254,6 +252,7 @@ static const struct platform_profile_ops dell_pc_platform_profile_ops = { static int thermal_init(void) { + struct device *ppdev; int ret; /* If thermal commands are not supported, exit without error */ @@ -271,26 +270,17 @@ static int thermal_init(void) if (IS_ERR(platform_device)) return PTR_ERR(platform_device); - thermal_handler = devm_kzalloc(&platform_device->dev, sizeof(*thermal_handler), GFP_KERNEL); - if (!thermal_handler) { - ret = -ENOMEM; - goto cleanup_platform_device; - } - thermal_handler->name = "dell-pc"; - thermal_handler->dev = &platform_device->dev; - thermal_handler->ops = &dell_pc_platform_profile_ops; - /* Clean up if failed */ - ret = devm_platform_profile_register(thermal_handler, NULL); - if (ret) + ppdev = devm_platform_profile_register(&platform_device->dev, "dell-pc", + NULL, &dell_pc_platform_profile_ops); + if (IS_ERR(ppdev)) { + ret = PTR_ERR(ppdev); goto cleanup_thermal_handler; + } return 0; cleanup_thermal_handler: - thermal_handler = NULL; - -cleanup_platform_device: platform_device_unregister(platform_device); return ret; diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 1304dfc65aab..435e3ef2e3e7 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -273,7 +273,7 @@ static DEFINE_MUTEX(active_platform_profile_lock); static struct input_dev *hp_wmi_input_dev; static struct input_dev *camera_shutter_input_dev; static struct platform_device *hp_wmi_platform_dev; -static struct platform_profile_handler platform_profile_handler; +static struct device *platform_profile_device; static struct notifier_block platform_power_source_nb; static enum platform_profile_option active_platform_profile; static bool platform_profile_support; @@ -1602,6 +1602,7 @@ static const struct platform_profile_ops hp_wmi_platform_profile_ops = { static int thermal_profile_setup(struct platform_device *device) { + const struct platform_profile_ops *ops; int err, tp; if (is_omen_thermal_profile()) { @@ -1617,7 +1618,7 @@ static int thermal_profile_setup(struct platform_device *device) if (err < 0) return err; - platform_profile_handler.ops = &platform_profile_omen_ops; + ops = &platform_profile_omen_ops; } else if (is_victus_thermal_profile()) { err = platform_profile_victus_get_ec(&active_platform_profile); if (err < 0) @@ -1631,7 +1632,7 @@ static int thermal_profile_setup(struct platform_device *device) if (err < 0) return err; - platform_profile_handler.ops = &platform_profile_victus_ops; + ops = &platform_profile_victus_ops; } else { tp = thermal_profile_get(); @@ -1646,15 +1647,13 @@ static int thermal_profile_setup(struct platform_device *device) if (err) return err; - platform_profile_handler.ops = &hp_wmi_platform_profile_ops; + ops = &hp_wmi_platform_profile_ops; } - platform_profile_handler.name = "hp-wmi"; - platform_profile_handler.dev = &device->dev; - - err = devm_platform_profile_register(&platform_profile_handler, NULL); - if (err) - return err; + platform_profile_device = devm_platform_profile_register(&device->dev, "hp-wmi", + NULL, ops); + if (IS_ERR(platform_profile_device)) + return PTR_ERR(platform_profile_device); platform_profile_support = true; diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 87c1e087770a..dfb5d4b8c046 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -142,7 +142,7 @@ enum { struct ideapad_dytc_priv { enum platform_profile_option current_profile; - struct platform_profile_handler pprof; + struct device *ppdev; /* platform profile device */ struct mutex mutex; /* protects the DYTC interface */ struct ideapad_private *priv; }; @@ -1050,7 +1050,7 @@ static void dytc_profile_refresh(struct ideapad_private *priv) if (profile != priv->dytc->current_profile) { priv->dytc->current_profile = profile; - platform_profile_notify(&priv->dytc->pprof); + platform_profile_notify(priv->dytc->ppdev); } } @@ -1117,15 +1117,16 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) mutex_init(&priv->dytc->mutex); - priv->dytc->pprof.name = "ideapad-laptop"; - priv->dytc->pprof.dev = &priv->platform_device->dev; priv->dytc->priv = priv; - priv->dytc->pprof.ops = &dytc_profile_ops; /* Create platform_profile structure and register */ - err = devm_platform_profile_register(&priv->dytc->pprof, &priv->dytc); - if (err) + priv->dytc->ppdev = devm_platform_profile_register(&priv->platform_device->dev, + "ideapad-laptop", &priv->dytc, + &dytc_profile_ops); + if (IS_ERR(priv->dytc->ppdev)) { + err = PTR_ERR(priv->dytc->ppdev); goto pp_reg_failed; + } /* Ensure initial values are correct */ dytc_profile_refresh(priv); diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index e1631de6ad86..e02f5a55a6c5 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -32,7 +32,7 @@ enum inspur_tmp_profile { struct inspur_wmi_priv { struct wmi_device *wdev; - struct platform_profile_handler handler; + struct device *ppdev; }; static int inspur_wmi_perform_query(struct wmi_device *wdev, @@ -190,11 +190,10 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) priv->wdev = wdev; dev_set_drvdata(&wdev->dev, priv); - priv->handler.name = "inspur-wmi"; - priv->handler.dev = &wdev->dev; - priv->handler.ops = &inspur_platform_profile_ops; + priv->ppdev = devm_platform_profile_register(&wdev->dev, "inspur-wmi", priv, + &inspur_platform_profile_ops); - return devm_platform_profile_register(&priv->handler, priv); + return PTR_ERR_OR_ZERO(priv->ppdev); } static const struct wmi_device_id inspur_wmi_id_table[] = { diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 54ff3e6b8b1a..d4a5524a59f2 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -962,6 +962,7 @@ static const struct proc_ops dispatch_proc_ops = { static struct platform_device *tpacpi_pdev; static struct platform_device *tpacpi_sensors_pdev; static struct device *tpacpi_hwmon; +static struct device *tpacpi_pprof; static struct input_dev *tpacpi_inputdev; static struct mutex tpacpi_inputdev_send_mutex; static LIST_HEAD(tpacpi_all_drivers); @@ -10553,11 +10554,6 @@ static const struct platform_profile_ops dytc_profile_ops = { .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; @@ -10586,7 +10582,7 @@ static void dytc_profile_refresh(void) err = convert_dytc_to_profile(funcmode, perfmode, &profile); if (!err && profile != dytc_current_profile) { dytc_current_profile = profile; - platform_profile_notify(&dytc_profile); + platform_profile_notify(tpacpi_pprof); } } @@ -10647,14 +10643,14 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) dbg_printk(TPACPI_DBG_INIT, "DYTC version %d: thermal mode available\n", dytc_version); - dytc_profile.dev = &tpacpi_pdev->dev; /* Create platform_profile structure and register */ - err = devm_platform_profile_register(&dytc_profile, NULL); + tpacpi_pprof = devm_platform_profile_register(&tpacpi_pdev->dev, "thinkpad-acpi", + NULL, &dytc_profile_ops); /* * If for some reason platform_profiles aren't enabled * don't quit terminally. */ - if (err) + if (IS_ERR(tpacpi_pprof)) return -ENODEV; /* Ensure initial values are correct */ diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 5ad1ab7b75e4..778d4c661c3c 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -45,10 +45,14 @@ struct platform_profile_handler { const struct platform_profile_ops *ops; }; -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, void *drvdata); +struct device *platform_profile_register(struct device *dev, const char *name, + void *drvdata, + const struct platform_profile_ops *ops); +int platform_profile_remove(struct device *dev); +struct device *devm_platform_profile_register(struct device *dev, const char *name, + void *drvdata, + const struct platform_profile_ops *ops); int platform_profile_cycle(void); -void platform_profile_notify(struct platform_profile_handler *pprof); +void platform_profile_notify(struct device *dev); #endif /*_PLATFORM_PROFILE_H_*/ 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: 13939958 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:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939959 Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) (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 EEB29236A97; Wed, 15 Jan 2025 07:13:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925202; cv=none; b=Bggi2mIZLOFPgkqkBOl76DdDUJuMSMiKoYZwqWEJ5NVoougyln5ka7E3vPXMkl5Q0lf6GSZSu2hzzoDAM+leJUi0Cx9LavhJwfsyrm5PgvzFxBmV3OGRHxElSPMG0Cs/nJ5xz47MtjIEreqaqqrOMi+vXKxpjpBXBZVCgjct80I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925202; c=relaxed/simple; bh=PbM/zcyY0K/5Nt9qYtl67Y8YYaYdgMBAFkv4ImIIanc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O1Gp1dC7v+u3Aru2jmlNxoVfxOCvgnRQVcixRqidDqq2B5/gbg09f5clIJwBp2ty+QjIl3li+CLnBY9ortUSId76oI32N4XqOrtf5JXft6nn45hYMH3n2vYtntcD0GQ52ZrzuDe04mu4yEUHxuXDb7cR86ElKPM5if4AbW5oDfk= 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=Z3YtoOyu; arc=none smtp.client-ip=209.85.222.50 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="Z3YtoOyu" Received: by mail-ua1-f50.google.com with SMTP id a1e0cc1a2514c-85c41442fdeso1504851241.1; Tue, 14 Jan 2025 23:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925200; x=1737530000; 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=lW3dBpZ0O7d7p58qhz3mJ7R6y6O5YEsEjimqZXlUW1o=; b=Z3YtoOyuAk0CbvtmlKgRTnES/hVLEXE76V+nXaf1VQL9v0bOc5VAdfmsk0TUb8iVt3 RA4Uw4ILhTlNAqpo5B65o5zVcyOinUY/XyZWePCzKqTfOfax29u4FhQoW7Pvt6tDxqjf kuCNT0UzGdhUTO2tQRndeWHnTZ22zWo9if+6Nk3EaZCgkGKj2xgmGtckAmX6yc9ejxw3 +qmGBouSRcLlpVGfhj2SmppXckhQUkLUe2SYwiQSnEopr/7kcBD51y+stS/7+VM01cJU 8ohP545VbLw27uMSHOqElyHrGrbsSsPX5GfW+Sd1/d3L3N7CvZnWYIjDzM9Sa36Ck0qw e54g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925200; x=1737530000; 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=lW3dBpZ0O7d7p58qhz3mJ7R6y6O5YEsEjimqZXlUW1o=; b=j5MiCXWsGD8WgHoG4wsVn2QhKDhX1JnWN7StkZKaa56D0JRcDupPSOj/mPq4pWPhoJ xj8MTwSRTx+37QfV2VdjfZ3cww+CYV1kForbkjeyfx+fKT+nfaun4kevYpYdigF0o4hc RN5I0NmHscTfVhfqIQ9QGpAAmd96cF53uRcVFeqy4VXzw80RjxaPHfJvpkpoakXmHEMz ezqMLW/WyBwNXt0qI+mBAUIpKojM0TR0qqTDBe+7LtCnKTXlzGnjgbkgvZkMHTrgHstV Kn4sL/PXSIti83hxNRhKSfdPeDmWScJ4g9LlXiRNnQ/4CGehk5uF1aK3X7tO/Ya+8ROr tNWA== X-Forwarded-Encrypted: i=1; AJvYcCV8WV4RfKHJJC/CJlGwclsNDCMtCy0ErH0zWuQcKefA+EVT9/1YzrvUHQExv0QcSQNbdH1LFdGSYEjP9+CL@vger.kernel.org, AJvYcCVwHf1dIdaXgddmlK3IABOgNDBqblKZ1kfqUhnFOXMTG1QsrCMf1VwKToxJhrhSXXvY2zCM9D1aI2wC@vger.kernel.org X-Gm-Message-State: AOJu0YxolizwwAK0EhozVXex5IaojBZHzfgqRFp9WGZJfwXFVmTNjgGe BMiZvycLW0QTTNNsAZpS5o1DLUlCIZOAkC8ZhYhb92A/Xcqc9mOKvf4Mmw== X-Gm-Gg: ASbGnctDbSwjC0/6siKUJs1VOzUWzHwBvuCRlJDs9h5+XtKjQuNnfR7+luwn+9ZLJ66 /A7Ey7IEIysXD1c90Xlm57f6mGgPedryjFZUKxThmGHy3C/o05yDnfaMjIxckzNRRXthINjoEQ7 eVwXJh2EzVqkqZIrYOsC/67oV4dGBhLoxth7yrxIPfZI1Vwc0whD/y6Km3+PiL0cn7QG/hvfIkc g5b5f9aMhqyu4V6893o1Ty0fLdLd1Y0b260WDAHjgwu1n2woMol0V5DAPgL+fMI X-Google-Smtp-Source: AGHT+IHpDKyoYatJeGEeuEKMH585YouUcTmDBZjt8YGHiwxRPXxJzIP0oEZ5PqmgvQ5af/7vI57vDg== X-Received: by 2002:a05:6102:dcf:b0:4b2:5c0a:92c0 with SMTP id ada2fe7eead31-4b3d0fc95bfmr24974842137.13.1736925199632; Tue, 14 Jan 2025 23:13:19 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:13:18 -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 17/19] ACPI: platform_profile: Clean platform_profile_handler Date: Wed, 15 Jan 2025 02:10:20 -0500 Message-ID: <20250115071022.4815-18-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 Remove parent device *dev from platform_profile_handler, as it's no longer accessed directly. Rename class_dev -> dev. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index f27005a267a1..8a1454e66cf1 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -10,14 +10,13 @@ #include #include -#define to_pprof_handler(d) (container_of(d, struct platform_profile_handler, class_dev)) +#define to_pprof_handler(d) (container_of(d, struct platform_profile_handler, dev)) static DEFINE_MUTEX(profile_lock); struct platform_profile_handler { const char *name; - struct device *dev; - struct device class_dev; + struct device dev; int minor; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; const struct platform_profile_ops *ops; @@ -90,8 +89,8 @@ static int _notify_class_profile(struct device *dev, void *data) struct platform_profile_handler *handler = to_pprof_handler(dev); lockdep_assert_held(&profile_lock); - sysfs_notify(&handler->class_dev.kobj, NULL, "profile"); - kobject_uevent(&handler->class_dev.kobj, KOBJ_CHANGE); + sysfs_notify(&handler->dev.kobj, NULL, "profile"); + kobject_uevent(&handler->dev.kobj, KOBJ_CHANGE); return 0; } @@ -517,12 +516,12 @@ struct device *platform_profile_register(struct device *dev, const char *name, pprof->name = name; pprof->ops = ops; pprof->minor = minor; - pprof->class_dev.class = &platform_profile_class; - pprof->class_dev.parent = dev; - dev_set_drvdata(&pprof->class_dev, drvdata); - dev_set_name(&pprof->class_dev, "platform-profile-%d", pprof->minor); + pprof->dev.class = &platform_profile_class; + pprof->dev.parent = dev; + dev_set_drvdata(&pprof->dev, drvdata); + dev_set_name(&pprof->dev, "platform-profile-%d", pprof->minor); /* device_register() takes ownership of ppdev */ - ppdev = &no_free_ptr(pprof)->class_dev; + ppdev = &no_free_ptr(pprof)->dev; err = device_register(ppdev); if (err) { put_device(ppdev); @@ -554,7 +553,7 @@ int platform_profile_remove(struct device *dev) guard(mutex)(&profile_lock); id = pprof->minor; - device_unregister(&pprof->class_dev); + device_unregister(&pprof->dev); ida_free(&platform_profile_ida, id); sysfs_notify(acpi_kobj, NULL, "platform_profile"); 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: 13939960 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); From patchwork Wed Jan 15 07:10:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13939961 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 B39C31DB14B; Wed, 15 Jan 2025 07:13:35 +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=1736925217; cv=none; b=AiF0Ce+KUvs/ZICaGwk9Qig/FstE+am4Z5qTlVg9BZuFF2rAuxhe9sQ5vd8DhC+Pu7DXgbAp/6wwPvvsGXTYHAWl0Uvs3SAIW5KHiWFoNGv6CgZ5528NMfQEkExbS9VuMzIGyGAvwXH4MZZVmo2Qjnaw2ePasLbzT1Er+BDyCVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736925217; c=relaxed/simple; bh=l1pUfPFG3Xb1+3APAS7P5Zi8aCJaa/Ok9u1y0Y5YRSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HIhBmoB0QG9R3Qv+c/F9hUwl6TBAfVk9g5XZXo+LItc5UqSJLOzGC78CW3laECjop+h9cvdqxWx/sT5ol9f5KuV6ZOpLZMREX9xc0duLDCoF8R/LysAQZ/VQOyDCZ2sroMNJJadweryppmJn9CFu7IN5UCS96V7dBdkjhq/lDTw= 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=iVk/YCv+; 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="iVk/YCv+" Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-4b10dd44c8bso2014094137.3; Tue, 14 Jan 2025 23:13:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736925214; x=1737530014; 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=wghjY7wf+gvPQnVgT5iXRWKzHWDJQc8xdIKtAAVEgQU=; b=iVk/YCv+P9ZUYFul9sDDh2zPqd4MpyEPgUe4BiOs0wP56vzNPlDwnmQQnuF1zCxqZL czrC5wGW6OdNQjZr6s9TTO7quQMEhkV/TIZWM/mn+Zt9d6klq5uyHB5LfAj+NxYewuPP GcM2yUU64qQ3Lsj7q9g9AhpwP+7dclM8dkqBsEx18/BsfzXA7EgQSf2ZmLLohfSKyboV I4z+2JUdVh0ialYVOnATuG77zbcpsJFvOVYCDNP3ha25aJF0g/6mKRF9y3eizuGVCvDl JN+1fEAbNCUHoMir+vP5VvUBTeNmcIjkv4cnKnGYRw6RXEyFxZz83jvXTbAiqQNcZyMn 84IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736925214; x=1737530014; 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=wghjY7wf+gvPQnVgT5iXRWKzHWDJQc8xdIKtAAVEgQU=; b=Ysz0BRCtrT080XYhOiHaEDYkRxYWAGI+07jHx9qZl3z8/lmOz+oLkzyB/NTpyBhCSs Lz3KZCkVK0QSkG3zWj03TlnLiR+gK92o2lFSAqYcd2aEgLBV/9Q8Fc5fY+k+eOj4znTl XC3b1daL2zjvsy7zGukVeE8TAkaY80HRU/kpC4pOjrsQ0TiFZCon+dZNpynmM1YlW+1y dy6KVHBHnWuny32wDem1F9Ccs4SQ3FpWaGNRvrxy9lxmzcz6inbcMeCeKu+Zpkp6Sa3i yc+w2M1km1oodOWcWROx124Hzb2WBmhnuZtOUXy7wlC5YAW8E5P4zNe6OU0C+oK5MZ5w E7Nw== X-Forwarded-Encrypted: i=1; AJvYcCUOBdpoIfE7AID9o6uN8vLrUO3Bpfn0ZJuRXSRWzlhuRfO5aHe9GskHZZD5ORs3XLbopdoStm3jgI9J@vger.kernel.org, AJvYcCWGddRGZGVvA1VWpG2GKfZ1fPO7F7j73y9bbGNHwOk+YTGH5O0pdnGhsubhxc2qjqVz1OUE8q2PgIWMRdV5@vger.kernel.org X-Gm-Message-State: AOJu0YwHW06G6CcmVrirW9nDwupb2aBTBItBbQL+kSKCzWU9ReWqAw1O YLY3hoz5no7hN40ZbeL7u7QcTaGruMUQg8Hxe/dIpz675sBgz5OtjaZ4cw== X-Gm-Gg: ASbGncsX/x0J/8gswY/FUbwRDASeSck+1jdR8Yn1bvMVbRJICtRcQx+7/bhqITCAYUs 2ifszOq64FNZkxT9jrtCHT4U28370j5OnqME+hnbKP6ITAYByelmQH8T+++fJtzSE3M4UU9Ldhc tjY59vTlr3ekxc9SqR/vzIETjN/lU5Vd6ZosbjQJLa9L4ypDLd24EA+XzcbqTDT00t6BiLadzY9 Y4bGfg15cA0bMLgpMwq7aWFaFn4l/kG6cRXr8srLFjGdd5+AtSP3EFa7nQ9FOMF X-Google-Smtp-Source: AGHT+IFGQ+2O2ACrPoA7Ik2FtD+4pzlrvBqDu/TUpD4WCXQxjtHvfQQeqd/CwC1dH64Ww8rXSzdeNw== X-Received: by 2002:a05:6102:3e1e:b0:4b4:6988:b140 with SMTP id ada2fe7eead31-4b635e22704mr12594697137.23.1736925214076; Tue, 14 Jan 2025 23:13:34 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:13:33 -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 19/19] ACPI: platform_profile: Add a prefix to log messages Date: Wed, 15 Jan 2025 02:10:22 -0500 Message-ID: <20250115071022.4815-20-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 Declare a pr_fmt prefix. Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 4895f37dd549..c9e46b6e27da 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -2,6 +2,8 @@ /* Platform profile sysfs interface */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include