From patchwork Thu Jan 16 00:27:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 857968 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (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 797D9134AC; Thu, 16 Jan 2025 00:27:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987267; cv=none; b=i2pGkms7FISqRyZHng78OyLM99+clMer+TSh+3sh7ukB/fTOiii6RpA7d+b9eQL5+olvU1tVxLkJHBnjLU9UriGzbox9vToUK46hb3F0eRVvdTv3Mwj55n3/RXIVom4Xcav0Lzw//bLrc7dJSDz77HNX2a1XxJHSlxvmfzZbOis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987267; c=relaxed/simple; bh=DGLD0kmL73nmcq12KV8lTWtz0LccRaUYOUpBkwBP5tQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SFBwezHE2ljNN5lW/iyV3pOspYkYWs1pzVLYq/a/ORe8/GVZ0OmJzmyz6yNMG526XVU7K88MU0/TzEtHyYvl8L9jI8///yEUtdI5xD749TUJA+jLjcOPz6+IMpF2NAkCxacRK97uno5uYZdmV8mpCP8jXl92+mdQXwdZmLdGghM= 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=PTgsE5hQ; arc=none smtp.client-ip=209.85.219.176 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="PTgsE5hQ" Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-e3c8ae3a3b2so556917276.0; Wed, 15 Jan 2025 16:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987264; x=1737592064; 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=VlFsdCufRBrILboyfB+KwlzmsEr01MCTNdW5OfiDX/8=; b=PTgsE5hQJG+MEUTRHszyjf9UIK6gjYcPyK0qW5c8tPADrCXXblgmf2WWCj+tq1y82K ICOMpd73s8Zg44fzVL80ej58LAtGyGCtzB35t+Z3403mDltBNgZg6k1TefLtuurQJB4i KMaTuYOBVnjrmRbs4ilGu1E7DUmFJPJdttGBPD+ai7cMlmLHLcIS0IlEA0jCh86mQTIw u3Kh9cdak9sn04TLkyRcBVfbN2olllM0EEHKihqTjnQOe2YgUGs6i2VdCEze3zzU7U1s zFjk//40JvdzAiv3mWgTmxQI8staDc+KiUUqZH+VYtvXORsYTVCShQP+BSWFHCJvoRDi P5qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987264; x=1737592064; 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=VlFsdCufRBrILboyfB+KwlzmsEr01MCTNdW5OfiDX/8=; b=imJuNQvURHITuIMf3p/PvSCggXwOI400e0I/oEK7kXEcTCaVFxLIxkMFs25XLwYGUm c+nkQKF0Qffq57UQ+cssE4+F1jISLhDks2VIUXU8D91Aj+u8uy+PgOwspXET54xrBnGn EZEg5uX9xPcGvMP6gcpwxG365dHbD3e1WIGsrx582xcg3KKqGdSsSHCTxomsxiE4c475 B914kMgYvqbUD/gHvmdcXZMKiUmQL+sCHYhWaXvBPzpFFL0vLwrpC9d4on4qEjEY1zca JXxt2lxyoD1selgOOsxGcAWDorFt95kkLrHf7DbATfKQ3DXMe7oxWziz/Xt8tHVGo96X NZBA== X-Forwarded-Encrypted: i=1; AJvYcCWA/b3YxKEOcrQtBox/nwfo0gESkhWHgoq0vaFg/ctPsH30SHpUn/RJMXNNIAtxwweXSNeE6NB9tcCE@vger.kernel.org, AJvYcCXnx+IoGGM/iSStmFrKg54XQujdS7bsmZ81p496hvzGrYkqk9UoH3c0kecOj26quPpwrnHNeNMrcPR/RXmR@vger.kernel.org X-Gm-Message-State: AOJu0YzsodR6u7UMm0mT7rhyDERP7bKDpkEymFSQ+Y5JT6MdQzHvJ6ac YmTHzOVYHiM3KoI6yWB0Icr+boQkwdZpZiwpY3ie2tyPD5nDYVuHWP6vSA== X-Gm-Gg: ASbGncuQoQdoPYlxKNdAdaLg8ecA7UYfRdB0e74k+F9yv759OT5beR5keh6CDspmwJE /jJICRvl0V/g1U5DuMSdTX5pgkmYpdfJ5ukt4R+5FDl5hpjzQjHTHwJqU3tIVzEpA71NrIhhg64 +97uABThMJM8p2Bfm6UsV5AaULalcDXdPODatVfJNM9mt1NQ4+kxQD9MErMKmG5b8PXkMPDKqka Z9kVLfn1+a0xYN5QqNrUE6MNvLBJmfyKeUStm1o3kYHaZMm5KORng3GEcKoM8Kz X-Google-Smtp-Source: AGHT+IEbgVKjVbVgHlavzUMdayVgdtOy6e2M9nlksJdMpmo0Ym+3AKwWsF0x15YYMN6xSHoSlc+Wog== X-Received: by 2002:a05:690c:4b92:b0:6f6:c8d0:c057 with SMTP id 00721157ae682-6f6c8d0c1b9mr62027047b3.35.1736987263980; Wed, 15 Jan 2025 16:27:43 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:27:43 -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 v4 01/19] ACPI: platform_profile: Replace *class_dev member with class_dev Date: Wed, 15 Jan 2025 19:27:03 -0500 Message-ID: <20250116002721.75592-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 858294 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (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 4EC03208AD; Thu, 16 Jan 2025 00:27:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987271; cv=none; b=KOrJ1R0sFVsWijzaXoEvJUxAlYnXpgujXPrRh0mKPmOYhwDNOAwF6q0+zR4b6e9IdMcVYIFCK8wut+gifLrAS81JD2ZXibHJ50lWkrkuIoNDo5rqlCePXgrgEi0LFrFEKWpqjjG6l/3f8VPGgmi5coGPw2MiInP55Ye+wIOl6ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987271; c=relaxed/simple; bh=F+HcE/0p+CKbsDcVTWR2OX7VCGoTadDXZpeSIydZ3y0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DJ6vcnkBjCYyzqFa8Slt9ZHYlfGt4N6LIf1LV8mMhRa70ehJuxfhOw5S3lVEhkHDskZ58kBce5lJlh7VcolaD3oSDYdy22gD7XBYINoSi/tF4sTE+Bv5ZO9FKkPIeXvZqY7kfJ/tLGla7+6Htic0W3r48pfwzi68tW3U4OLRXlg= 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=M8fc9/Op; arc=none smtp.client-ip=209.85.219.170 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="M8fc9/Op" Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-e4419a47887so617756276.0; Wed, 15 Jan 2025 16:27:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987268; x=1737592068; 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=i6wH2VMUqHiPLE+uONX9vuz+cOLoy/9tEInPoy3izOU=; b=M8fc9/OpAzZuSIgVNjBNon3vKY6JpLni//2+L29q/do6M664Y/yGShlT1Dq4rszArN 2/2dxZkeAgk7mW5yQM3Toqa7rdog5RGPhMIQ+3P1FB8CzgsnrLTe0e/kyVcBYvc2X8uU qz6wtaKDaZmvh0UKYqfOA7Gr2abD71FpmdnOFGmNO95NA9oT93eRt747i/CVCVmw/u1G j9uFWWOrp/GMvnkO0eonP/jhLHEPPtDYRZWYfteDsrHFc+lFjoY94SEffuZhRC0WFedn QeuHZyBToYR3HGRRDaBIgGDillzJe1A1+CnKQd/hvaPpZWuClg4I4ro5RWe5/U8YkoPV XewQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987268; x=1737592068; 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=i6wH2VMUqHiPLE+uONX9vuz+cOLoy/9tEInPoy3izOU=; b=umcno7y7JKO/n6/lxetTRp4XqVfA5rwlFuDZ9oeAHwm43n0ZsMl5y9k/dFQPhfjJoO BJmnFCh9Yfy+kA/Pr8G4qQeMnZH0VK+jhIQ2zijb7gfPN7IR5yMovTKMSGfPD8OKgAbM TCnAyRfd9KyxKf73LULfZAtnoRNIpaW8bDGFKbpbsurt4Dk38sQCtpZw/pe9pHuzAM0g B+A+DFSoOzV5mx0TG3T44iOeCRmH2Ud9BtwCe2/YsRzodQZmR+LrPuw1UsPdA2h5g9hB FRqeb01aQaufbGaPo+H3jKOqXPBQKyS5ExJsuveF76X1bI6caKEqQsBFMwobK688x4uj MXvA== X-Forwarded-Encrypted: i=1; AJvYcCV4DxpB+S4J0WpCpm2i1rFB8WNeG0vieDE+u/z2IXDMxvqDdF2YosMsGFgBb3tNxWx1UN6GM5tuLan/@vger.kernel.org, AJvYcCViIfoz+F7XxkGZxAZNfYhHSQnt7xkqCJsPDGtyZlmui/y6WFn9SEtbvS+M1RxUPq9EcZdlSI8W/PlYYuM/@vger.kernel.org X-Gm-Message-State: AOJu0Yx5PbhmjmCgPIq18ArMXoxvTT+yeMycNfnOEZBMTk20wgIeYDFT Kw2O8g2wSlEgB8ArlXr26Zy0V2p49UXykXueSHuMtfWYTlZ7PZwI72KB6g== X-Gm-Gg: ASbGncvSdqav9ZhGpegXtAbCcKCOcnN4w2Tf6/U9Pmuyf+zDiZyBKyNzUkxb3gNdCe5 A8TbONMUezLn2Ps4BR+S8TqP7qqpOPELlyRMF+ga57CfGS3HIIyR7P83l5fDsIo083OAwCBAnT2 d01LOt7LIMCODI6fsnWpno0IeYzIjnfZzZFGEML3SQmU+I/8vktAX/7/OSCQRpr5djjtYVWa2sQ cv+VhF8NgYjF2vn5V7yuLTyNdFqT77xx3mf8Sg8j0Hud4JebYMkaEzP/E4DvMF6 X-Google-Smtp-Source: AGHT+IETg/BwY+aZAFd3WmHt1zEfaced2n/Pz3ys7wrt3luRNZmZKBQ/vQpKaaV1dr417rxAoNCLcg== X-Received: by 2002:a05:690c:d96:b0:6ef:a4bc:8b9f with SMTP id 00721157ae682-6f531236c89mr266209527b3.19.1736987267722; Wed, 15 Jan 2025 16:27:47 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:27:47 -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 v4 02/19] ACPI: platform_profile: Let drivers set drvdata to the class device Date: Wed, 15 Jan 2025 19:27:04 -0500 Message-ID: <20250116002721.75592-3-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 acf610d59168..1aedf0ef4189 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -2073,7 +2073,7 @@ static int acer_platform_profile_setup(struct platform_device *device) ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO; } - 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 6c674de60ec0..f91099792cb9 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 d7f577e0d146..154c417a438c 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 d99573e7a983..8be3f4e5366d 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10641,7 +10641,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 Thu Jan 16 00:27: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: 857967 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (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 53B2FA957; Thu, 16 Jan 2025 00:27:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987274; cv=none; b=qavoCxFcxeCikhRfiMStS7k6lbAk29JMRipMaPbZZrvGemZdNcmOobbiJr3DvQY1MlKmuPf50XFPaJLAX4Hg+q9IAQnawWx4/EGJGiekImzeR6HTfYSephkZu7yjMEbTZUxtAtFiw+ddxo8+XMgZUOmscINF/OjrlJ57dNjYd+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987274; c=relaxed/simple; bh=3kdDOFZWWufGw3RSkFoQVe5z+IUQJa2ihjOhqsLeZ38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XoEx2d9zS/5EoUxfdRdcnRiuPC4Rhwp1vDBXcZFCdLnZD1xYwFGcDG5Z68w8psncloWwEoIA2xHxrDZYcFHIk9eS9m5VIyyLHux1eRfSas7NK0+Kp8SfIGoBXWgOp5ir54/VR+eTTioOkplJsCkR1CMnn4lJ76gOYmnXF0zDF8U= 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=NTO8tQMB; arc=none smtp.client-ip=209.85.219.170 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="NTO8tQMB" Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-e53a5ff2233so720070276.3; Wed, 15 Jan 2025 16:27:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987271; x=1737592071; 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=HDI29vG4CBZHcoqjRpqC2IPTRaOT+SQ30E9UCtEjb4E=; b=NTO8tQMBtxsQ+MPpBBn8H2Q6ltM4n5X2cVW34ux7ZPXe5SEATPQnsFjzVqUQCII2JG BpjQpSjHvLAvenA1rpgoKzPAPUeM0lvIEcAla74bwHk9qIQKFWc6+FGdKFl8eXX+ejVb 8LaIlRmduTINDLzS8M2QI7TmUvopddSInwdHZOWHpW1m7RLKFFg248nnF09jrUM/o2Bn NxbFBXLigqaAgDbhtpMg3+KmOBz1bR7KiKZ6HgYb8eJ4rUfa1BubYCBeoXVe2fl+y0jg w7Vc0+U5d5F9gzxN4rzBAxszsHXaqkIDWZ7KC3g6Z0LsZKcmFsDPSkeDSWXIq3lfY9WD 71mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987271; x=1737592071; 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=HDI29vG4CBZHcoqjRpqC2IPTRaOT+SQ30E9UCtEjb4E=; b=QrFQKE6LNSvpbLS87dsEaFNlKRJVkPbDqaNvM5hon3mOvGp/5prFeZQEIS8yDoWQkW /e7SgLmYPQiLz1wW2TZQRGz1/BOY96CCP19F7UIUVvC0C8Xk6vyIs0JsNac46AugH8j0 mnKkDWCw0IP2u0d384rqpASL5VOppDA+sHE7ET9dGhsuIAu5G7hXnh0o0oG6i7lPq4SC +8wWasbWInNXlx/9HhGOj2Id4+R6R/OBN7GfmUBfOf8GHyt6qUrooTz6NIUHFS/j17lO G863eEObgua4UY3unPlspliYgwWrswC1xRbrlBhdZR1acHcpYzDUN2m+hxVeet9XUzQD Dj/w== X-Forwarded-Encrypted: i=1; AJvYcCUkaTRayiK543qYIoC9tdez/cSCq/mTCtdM669BgrOfMKbfs6r7O5ReTyxLa+mibz4OTKNTQiPO7lNiwKUG@vger.kernel.org, AJvYcCXdb6KR/Ct6ihqprqLxlaRzMyOwqtyI5cnRewq2ZAAWfrXBprkE1pHC4uj09RiK11apONUhIONdBGZx@vger.kernel.org X-Gm-Message-State: AOJu0Ywvc6N7KmlgxPZPJG85V3gSVA15rpbgTpNOeMSHH3CKdOrCTFvb u/zr4VvvPT0gZ47z2U9T+e3c7+5ex1xymBSCtz8o1Mt/CDGET0kQfZdJFw== X-Gm-Gg: ASbGncsVHZxGSvpHYMUCtOI7O/RRp+GXscBi7NBZqcMKhbf4Ux/0lKbxS+tLCOHkFWf 79Rfwj20w4Wpg6MBm8YxN9mW+neo6b9zVcEI82lxBvYblACkE+N7kDw09wxiYjzuGpG23TLKGZ5 pzl/iRXePUUcD7y09RNB6bAKGVeTThDckVwUPJkF+4m0gfaCYjq4aS5hvGJsPNdKCjL8yS5jDa3 5HbJF3IWpZbpKxgBIVGKNGkMytPt9BfWPz5obk7dNMhHG3lkgVonNLw8wk3pILW X-Google-Smtp-Source: AGHT+IG9vaoz8DYuqwJ6j0c8tgR+ZVeLx2RiNfM/PTEzwScw70iTMG5exgOpaMsjR9HXFbN+/S3Wtw== X-Received: by 2002:a05:690c:6a81:b0:6ef:5013:bfd9 with SMTP id 00721157ae682-6f531224addmr281455977b3.10.1736987271000; Wed, 15 Jan 2025 16:27:51 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:27:50 -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 v4 03/19] ACPI: platform_profile: Remove platform_profile_handler from callbacks Date: Wed, 15 Jan 2025 19:27:05 -0500 Message-ID: <20250116002721.75592-4-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Reviewed-by: Maximilian Luz --- 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 1aedf0ef4189..c68c0d744a69 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1950,7 +1950,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; @@ -1984,7 +1984,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 err, 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 f91099792cb9..6b8b30551d36 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 154c417a438c..0346f8e88bf8 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 8be3f4e5366d..0abe22228fdb 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10415,7 +10415,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; @@ -10490,7 +10490,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 Thu Jan 16 00:27: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: 858293 Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (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 0B8252C859; Thu, 16 Jan 2025 00:27:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987278; cv=none; b=u3b8sPFPCBQb7OFB0zuWpGwWU+BeG30UGrW6lFmRTgyGX023hKOPr3cN3y8L/tw2/FCAfBaoRR+w6f7Smtgd2x9l+TuMkjlt314NyIxyvGvu4UsnYiyHTW/nn2HsbosBs5871+SxKel08Nvb5cMw1/WcLxk8WE9p4QFuR+67k7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987278; c=relaxed/simple; bh=Pev443RJrWuidmaXv0GXyB/iMTAludiQlwQOeS7lEXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ScAavm21PEvLpsAkhCE+c6JDsRq3P5a2yXaZ3jiIfy5VLyCqoiFEajK+wkYhm9Jh9Bll+oblw28MQ09ZaZX7oNNy8s5pjMWrFarUJ2KtodDGOsbPy37UltK4kLA9v9IVGSGfIvDkdJb65HyTuMg3IwyId00Te1sE63IEst+xFDc= 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=AGikgaLY; arc=none smtp.client-ip=209.85.219.173 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="AGikgaLY" Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-e46ebe19368so626923276.0; Wed, 15 Jan 2025 16:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987275; x=1737592075; 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=PBlndZsF2CWvhd+gmQFJf+dps8PTdoNsXloRCpz8OmQ=; b=AGikgaLYt888rkC56OF4qFBb/ogJQEQHasg5chJLmIkgrztxfqXwoTxP1hQaq+p9ic lspjgoPh8nUG1mlAdPuLtFfH5BrhfLhm6K2l2ODR3VylfUDAJgDL4aiG5m7UuwoPagMW iTUmFp57hyQEQ93HMcf0Ptux1wje8HrJkZvpiyaWDCyXJ6VmfuM663v2pQvxQldTBSLN 6JqT7iGJrrFcoD0HhL4PcjwF4kLcqDY8bu6iBRqxpXUhEYpHl5nPRrkhqZ6iOtvVx/9w zE9BZJaF6E96I3VvMmWfDcQ7AICktksBma6q47db4jlxxarnzWVd7njHiR54ar4Y3bsY +6aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987275; x=1737592075; 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=PBlndZsF2CWvhd+gmQFJf+dps8PTdoNsXloRCpz8OmQ=; b=Z6ZZs96DmHlLjRH6EwPIQVmWMGb8UROh6tOhfS4zH+ZmFkHtOq7xTzGK0nNd0Ie0mX /xIx4935w8KQqjtpfbW7LnAG2LfDxITcTzqLs8DQbM4Ft20dw18LI2Iorz8+BQsKUGrH OGuwhLNtQWUga2pnsWW9uYMg0X5UXGcS/ID0K/Kehli7oqt2WBO55fVNgrQ3iaKNEr8L djsdN81Pn9RTLLdjCmoVENiV31Fp7nN3ZZCbXNQ3h3/onO8NnIWJSv7jccUB6pwAIYW5 7RnREqImhiuYTgcWAHRTQ3IEhEODdEwU63oVsI2ieWYiQ4wyWHF4vgjs8FmOqwwb9zPZ azvw== X-Forwarded-Encrypted: i=1; AJvYcCVA7Vc5BJ+f8VU/kG2u7/pJNqn9O7nbmvCiBpLQKku4L05wa4SO0SM8AfQyvBRhFgd3Do4lzBwu068l2NnW@vger.kernel.org, AJvYcCXo7yPbFYNsHsZncJE9bN9TgQTRNEYUdLGP2fZFUy4XLCAatpck3tBHgL0/1F8VsVX3aiDBSasgy2F5@vger.kernel.org X-Gm-Message-State: AOJu0YwBBZ7wjq519nkDbU0B326ZCmKMQOxwvA73H5rBFTh4zTsEkICq iU2HPZfDXfvSO9lUqYPWEUwcwitB9xXse8qW1nuGcjanyeQh3H670OtFXw== X-Gm-Gg: ASbGncv6pHNiwtEJWCmkyymoolLz+Xc59hciSUs+0m710KRUqFBPti63V0x8bWO2VyU wGECDuW/mZqpe3Jxk9+vlIashCp3rmYv2DbHStm/5toPXrkxNlxw2NExaZJc8qxsdTWwVDVM4pu tkKXdz8sELONrOwawTVHgJGGb0iGxCnGnyvb6IQbii1vURFnV12ApXYJ8ezFY97bND4zgLhoho7 Mjtejl8a9LR2ku13zwkHjfeSGd7aw4ojVqinO4aSGdI8vpgYz3PwGBbVoowZZS2 X-Google-Smtp-Source: AGHT+IFFBpHo/cpd2UWnuE4SdC0l2vx31DI7PBy8TxEOt98gV0hnjVwnVQ//IRR0KAgS2N8zpL6Fpw== X-Received: by 2002:a05:690c:9a8f:b0:6f4:4280:2433 with SMTP id 00721157ae682-6f531203177mr242397697b3.9.1736987274743; Wed, 15 Jan 2025 16:27:54 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:27:54 -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 v4 04/19] ACPI: platform_profile: Add `ops` member to handlers Date: Wed, 15 Jan 2025 19:27:06 -0500 Message-ID: <20250116002721.75592-5-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 c68c0d744a69..63e6bd1fe339 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -2019,6 +2019,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) { @@ -2027,10 +2032,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; err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES, (u8 *)&supported_profiles); 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 6b8b30551d36..992956c89d38 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 0346f8e88bf8..b8359b177a0f 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 0abe22228fdb..9e26f5670fc7 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10539,12 +10539,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 Thu Jan 16 00:27: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: 857966 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (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 AFB6C3F9FB; Thu, 16 Jan 2025 00:27:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987282; cv=none; b=i2nF/ha8+4v0u12Dyji6pN1VBZbPr8zYCA3W+hATswszRf2mdW0lc2j8qZCdgVplyT5jrFmsmTvjpG7vwHOVfF0e3+bpeJtyWq89e+1WizH1akRkGNXhCgdjuIWkxgKrHQRNbMYEysTxJ05pLEse4ydKk3ZTmqX5jeYYYpHXpnk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987282; c=relaxed/simple; bh=iE3N2ksfRMs4Es8ACXPbNZbQMOriUIrtlhn0+9UeoHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=llnFB8YdAReMgjsWRJ+y5lzrTMlRGTXRyjQy5SXzGEQ7S7H9tYpU/68R7LhNQGqH2NITkm1X782tGdpt5fvVAud3BV5PmDNSNvTt64+aHFUPA7GWseTy7V5+CzjCoD53Pki6Yduc3vS8H3euTGgntDd2/Pg8uBB2cQX9jLW63Qw= 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=BPQP7EkS; arc=none smtp.client-ip=209.85.219.179 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="BPQP7EkS" Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-e3a0acba5feso531433276.2; Wed, 15 Jan 2025 16:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987278; x=1737592078; 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=pSLOPh6k78erNKS43gH5D7zw00ZieCRwCaLe/FNZ+qM=; b=BPQP7EkS6TIiRRquVJD8taQpxWHXusys1lW/QFNXd2uY4y0LoiE93j/RGYd5yhuDxN l3u1bmjVK61mkd4+U8lvU3QSlZGVP/m0sd8bMo7OxtnbnbeNUuOuamF1cDdHL4GNC/QF T+/rcz4mqdqErY4fFHaVIhuLROMtwANsh/JJ2DoyHQgyS9ARF07rRJmTc3/n55d7Mk+g cRFTpzVLI/Vh8wkIEb9mV9TcjsykBVK/upSWDP0QE2NwtwAl2Jvd4LEmot4dHK1YJWMP JedfZtQHdemGBPfJkFNn3a1QmOpkBbrkwA/Mw196ZbVrmUCQzOK/IxrIqj+qg6FGXEYX nKQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987278; x=1737592078; 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=pSLOPh6k78erNKS43gH5D7zw00ZieCRwCaLe/FNZ+qM=; b=kVmDi/U05J1WkNhmPRVwvZp4AsFkl1JcZBI/2SNkZDYog3EOHK+aRgv6FgRxxGtnNR XRDmQq/5mqduqUczG85fqj/JFnwegc5OXF+rcQo3gEKmTjQu6U5aVFTPpVCFOTKyJQDQ vU2AZdPAJMCpIlVfGa3Znjx6wqrYFnhS0MG3urfNwtkG9T7jR8V2CjGrwL9HTuxWFfZD +i0W6Lg/WAOmbnZeFLYkDhCaes3Pw5Lw62QejXcSU7l3c2wPA1qqn5+OH74UKI+ecmCh D76d1dtTVK1L3GV42+tHtOC1ejazYZWx0NfMVqpSg8pStlb/Iym99fIDO81SsMlsFTtY Uj2g== X-Forwarded-Encrypted: i=1; AJvYcCVuLN2EJ+mUSxcXC/4s7uH/Nzwko+j5JXPMy68AmKZafPOzDiSpCC+4yLCN61+aeKpyfaWQD2y7TElb@vger.kernel.org, AJvYcCW0KL9hoiHRqC55JksYNfK1bfgY/UJeLtfT9jTag0mMkU5+IKU9jonk+wg9jFFNNNqxj2ceRSbA1m7gmit+@vger.kernel.org X-Gm-Message-State: AOJu0YxVD+db6LVguwGbJQ9EdBSfXG6ymjDWFI8IJOBQhn9oR511MMi1 Tr8iPM97zFEaysDM3wbFsaH2+pO0dnlvgtwYpuNkthzl7mDcDVwQnCP+Ow== X-Gm-Gg: ASbGncvELFtIizOM21/77nZALkSfaoOd+k0KfIUqcx3g9uAv43TAqW7XDFVOUqJzo0X lNpIsC2bMbVJQM3kE/3DVk8Lz9hOAvKqpV/BP0Noc9wAT2IwymANI2Kxx1uKdq6GlLiIElWd1ai Xugf1i/KBHcsbr2puWu9zx5I1/r7uirmH+BhbXNUtFEXapvgq77uNfXE3ujNacqEc+LBFVNR3Ra orqWqCjHvbbQu1uGseb4qysQRb3o4MG7CGSUP8iqb3r4imC5iBQZAG+wlG6K1kl X-Google-Smtp-Source: AGHT+IFIoDXEH31LNfZWVcnk8OshU8BiPsAwabS9yPIsuTm+FZXBflf4Nh5CL/pxF7s6KXRS8kBYkg== X-Received: by 2002:a05:690c:b04:b0:6f6:cdfd:7e2c with SMTP id 00721157ae682-6f6cdfd8107mr37249277b3.15.1736987278239; Wed, 15 Jan 2025 16:27:58 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:27:57 -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 v4 05/19] ACPI: platform_profile: Add `probe` to platform_profile_ops Date: Wed, 15 Jan 2025 19:27:07 -0500 Message-ID: <20250116002721.75592-6-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja Reviewed-by: Maximilian Luz --- drivers/acpi/platform_profile.c | 15 +++- .../surface/surface_platform_profile.c | 16 ++-- drivers/platform/x86/acer-wmi.c | 88 ++++++++++--------- 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, 172 insertions(+), 102 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 63e6bd1fe339..4d62a61cb241 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -2019,7 +2019,53 @@ acer_predator_v4_platform_profile_set(struct device *dev, return 0; } +static int +acer_predator_v4_platform_profile_probe(void *drvdata, unsigned long *choices) +{ + unsigned long supported_profiles; + int err; + + err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES, + (u8 *)&supported_profiles); + if (err) + return err; + + /* Iterate through supported profiles in order of increasing performance */ + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_ECO, &supported_profiles)) { + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + acer_predator_v4_max_perf = + ACER_PREDATOR_V4_THERMAL_PROFILE_ECO; + } + + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET, &supported_profiles)) { + set_bit(PLATFORM_PROFILE_QUIET, choices); + acer_predator_v4_max_perf = + ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET; + } + + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED, &supported_profiles)) { + set_bit(PLATFORM_PROFILE_BALANCED, choices); + acer_predator_v4_max_perf = + ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED; + } + + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE, &supported_profiles)) { + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices); + acer_predator_v4_max_perf = + ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE; + } + + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO, &supported_profiles)) { + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + acer_predator_v4_max_perf = + ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO; + } + + 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, }; @@ -2027,7 +2073,6 @@ 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) { - unsigned long supported_profiles; int err; platform_profile_handler.name = "acer-wmi"; @@ -2035,47 +2080,6 @@ static int acer_platform_profile_setup(struct platform_device *device) platform_profile_handler.ops = &acer_predator_v4_platform_profile_ops; - err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES, - (u8 *)&supported_profiles); - if (err) - return err; - - /* Iterate through supported profiles in order of increasing performance */ - if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_ECO, &supported_profiles)) { - set_bit(PLATFORM_PROFILE_LOW_POWER, - platform_profile_handler.choices); - acer_predator_v4_max_perf = - ACER_PREDATOR_V4_THERMAL_PROFILE_ECO; - } - - if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET, &supported_profiles)) { - set_bit(PLATFORM_PROFILE_QUIET, - platform_profile_handler.choices); - acer_predator_v4_max_perf = - ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET; - } - - if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED, &supported_profiles)) { - set_bit(PLATFORM_PROFILE_BALANCED, - platform_profile_handler.choices); - acer_predator_v4_max_perf = - ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED; - } - - if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE, &supported_profiles)) { - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, - platform_profile_handler.choices); - acer_predator_v4_max_perf = - ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE; - } - - if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO, &supported_profiles)) { - set_bit(PLATFORM_PROFILE_PERFORMANCE, - platform_profile_handler.choices); - acer_predator_v4_max_perf = - ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO; - } - 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 992956c89d38..e775ec7371ce 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 b8359b177a0f..e7209863e7dc 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 9e26f5670fc7..62b2ddfe7c0a 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10539,7 +10539,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, }; @@ -10585,11 +10595,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 Thu Jan 16 00:27: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: 858292 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.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 ED6324D8C8; Thu, 16 Jan 2025 00:28:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987284; cv=none; b=CFFBLdFjus4e1ZwNiFWJm+Q27BbK+d65FH/i/c6w6AnyHZCPf1lvqqhXNXQv7oLJMP4aLAr1yP9A52/v1Hb3V8iuV4MizJOa597hn4SkiqXJFZCB0wRApuTcacjNuH4TNrsm8HCl1+kubHEfO51bEMnbTgDlE6k70lZLovgsrZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987284; c=relaxed/simple; bh=5lHhJZMdlBxC7EJ1nt3bE/lkNoHL2EQeG34ow55ZKgo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lS5wYTpJMsNrBTX+ULO/5CJ6IZMzvuP5y5i4ft0O15Dr80OEWMpWsj3eznIofylKwbCA2ekyQO7XZdxUn8lCpehJMD75UbZaeb92/Wghla+c4ORMbxOvTGsc9OOGqxoeJ5XzG3hGQZQ9sIxddaRWn5QAukyek6oNJ8HrfPx5Nso= 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=XNFwCqQD; arc=none smtp.client-ip=209.85.219.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="XNFwCqQD" Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-e573136107bso663798276.3; Wed, 15 Jan 2025 16:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987282; x=1737592082; 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=UYIr3Ci5kGUoWCBBMwBtv7J4eqGAZWzjWsOsN0G37O8=; b=XNFwCqQDEGJ789rQWoBNTakVv46wUp9bnPLqtFpCblNkAuFYlJ339pyvdM52giPFfr A6D70fWwLeaHsUS4t9fsKShtU8u8xLOCrxqrmQItEj7lSDlXX6VZqmjzAMKbgQ6lTl/L YvfOe+/ihToOBFCDSbAdwbd9VTp186iNY05YhibxnwLSh1f33bOzfX5BY68UEqKYWKJS bcmxqb8WAqUTP2AfTootfDANh6XeI4/G9UPvVwo79myRmlMs0+f+fJgiphTTqGpnAPUm EK+exSkxZplLD5okz8sVo85+jMeFc971VryR/NBzS58nrUUswxby60wga+idTxSt82q6 YGMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987282; x=1737592082; 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=UYIr3Ci5kGUoWCBBMwBtv7J4eqGAZWzjWsOsN0G37O8=; b=DWTZzxxoO0b3f3W3LGWU7jKEGOTaTyS3Me7negxz0y/aMyLW5IS6ODSXwdCm4GpLzD 7j9v/+zXT6z4j1J/T5LrRyZj9sOWsumNmBaxEutOH7VWo8tf3S9dmrWqaEvW0NcRn+4h LCRYbHSMuHxxIKHc9BMBdjjt9wKG56/B+Bg8gx8L2R/AiH7bnvZpHrMpZb/wlxIao/Il QzXLYMWDzhj1Y/A2444s2hGCTLQw9exaGVE7IU84Br72Tj3TteHz41/LvsrgTwK1eUrW 6D4B7tx6UiIeUJo+NirQODCDmOMpwGkGToFbl2MoNEWM0lMRbdXvNqq/5y2KDBNQ5hut BrJA== X-Forwarded-Encrypted: i=1; AJvYcCU4k9Vk+Je4ZCXpHDSkbHiz9j7gEz/tLsIHywqa1usZarLb13ESkIlMV4QzOkJfTnTZ4XcrseA5O3WS@vger.kernel.org, AJvYcCVZlj/3RwXiZzplKM6vc0rtiUkROMpvcArfidEfHbf+B8rULqA3XWrSbf/EtI9bWqCkA+RCp6E96Lh8uIJd@vger.kernel.org X-Gm-Message-State: AOJu0Yz2/Rqtv7/ioWxCtguy1oWTdwjGNOCorvRRbJEtT8Ag8sYWXf9d c9r97/lCpvVpSAweDIM48M79rXAzQB/9Hj+vbR0ve1wwu8dYcURMjv6REw== X-Gm-Gg: ASbGncvlVZf9vDO/id0hHJHSaocgGERkx6jzdt8GLYChdQXsX5a8T+uWGxJ7R5XDfFy 6ptIw3ahI6pU9MirX+LioaIGleSzuXvTg2vyhN3tZzoFu4XCGRdGq+IjEWTsQ90TI3fCVh39Gpu LOSnyt/q8JP0WNjDDtH3i5lfaP48KJ8nAYohXNOnudoHmHPcEbVYBkEVZdu62bAYeEmKHn30Fsg QBebL1spPGhoPzlhCL2DCAnU5rN+GnhqExjX8wEct448HaKQY6EsWgWM0FLxEv2 X-Google-Smtp-Source: AGHT+IGzsCHvMUN24+b/RXlYC53lzjiiB1XZyyH/iKmpJgZD2HJphppTzDAqE4OYMTEyPdK1ecYT/A== X-Received: by 2002:a05:690c:9688:b0:6f5:4304:fb8 with SMTP id 00721157ae682-6f5430412bfmr254089517b3.18.1736987281574; Wed, 15 Jan 2025 16:28:01 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:01 -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 v4 06/19] platform/surface: surface_platform_profile: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:08 -0500 Message-ID: <20250116002721.75592-7-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 857965 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) (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 3B5B770839; Thu, 16 Jan 2025 00:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987287; cv=none; b=XKwJNjzyhIgt2GLYki+d1EG04adPAEU6xC+AuWD0RbWqiBhyIPnhXMXRAow7gVUm0ACG9/GMF/t3RtD9Vk/T1gfqlpUqFj+Nb6BXAqDxuaea+LF3kVtAtoV+Fm5eNSzuh3TCgGdZSQbpfwhRhfhLLwTwi+Gi7W44Nufb0PCWfms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987287; c=relaxed/simple; bh=sguZygPLbyJOctvX0uUgwRDSSW9Koge7hOKBBLBwBnI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RltgM12ePtEo2MlPUfXGwZLcGNmJ3NKOH0RdwDAjtlwdOnPWclEQZf69FZIA7NmG25CYh0AdVmzB+TqvHZqHBCwcbpJ8JqyvxnZkrhBB3cJ0LyXONu/7GgPsiKX+fvwGOPL35Bg+wW1FhygfIc5eu0IG7whhVrejyXpu/av+hf8= 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=AOJAQkxl; arc=none smtp.client-ip=209.85.219.169 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="AOJAQkxl" Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-e53537d8feeso629327276.0; Wed, 15 Jan 2025 16:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987285; x=1737592085; 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=oKkoYd0q2q/OHzDbyA/33XiyMuA6S/vNHJ2GgcskFpQ=; b=AOJAQkxlyV5/whCPB88uc+mD9X3gZfmo8D5EIDzRNgEZOfiq/YrgKcJfd2mdF5VTAi AVRCYxTiQ3vRHeW6TpLEhpViQey3r9laMIsRlHERpkSztewU88pqKtquHCietplFg0RF pJeEyRYmqZghuM7bCNUpKXgbqeNCNJ9iE+dDRIgNC+QmQiIWgN+1MXLRrEpZhl3TNSk5 gBV+PZBX3lvm/qTMKRiijTZfV6GCFlH7AFPIGxa7x5wVYnRj7ns1FQALUm2llYBY9Svq U3pawWIdsot8GszC1vUWhhw2OlcfyPnJCIdCYflTGVvos24+GDjLtABjlu+60YUHOXOg q4vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987285; x=1737592085; 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=oKkoYd0q2q/OHzDbyA/33XiyMuA6S/vNHJ2GgcskFpQ=; b=KTtqOBBgARie9EAmNrMOuSbf43hMitSY5u/ZnIJpHlR0PCRCNPVIwGGs3ps7s8pDsb syv7umAVRAwDHJKkpjz8mvErVvLI9QCU6BcLC42nDGCyR0lP5n1aKyL1X9pA4fM4QjWg H+SoLvjGGCj+GNaR8ij9C1tUBefLkrO3KxFNqinu0KSCy69h7kzSzrvjr7Xc3uKnP9n/ oSTeyVLIwW/XK8FlVgPJthevtwQi88Ywctol/znUvUioC6YYDxhqeHDOHgO9lmETkKvq pzyXxaLQkWR0N28hpCqmdG5n+JzaWJ5IluRuISnjx0VvUEbopQ1uyPP/R1q4M8vGBd+h smWg== X-Forwarded-Encrypted: i=1; AJvYcCWE6wXyXycfFQqp1rSQySsWYqvQDCvXX84dfLu7hMlKU63+P+5OsM5qQLTQcFibPRPlpdUhRi/UgxmmJlZ+@vger.kernel.org, AJvYcCWQyxj8yH26GiNgKip9QJM4Wh84jW87hCPcT6oah8/d4BSwlzsBO3HBJ8vtmS4dsMgVwE/1GjAdjXYd@vger.kernel.org X-Gm-Message-State: AOJu0Yz4J6diPNB+tFFnjykpFYAT/phN5dykSWP9WMmZtfDWEZZHXGvC DuQuKTDKC1nbGr85aCu2N1LuuWpuNPtHu3d/ZAjdPQPW6AooKHzMOIwusA== X-Gm-Gg: ASbGnctIv/O8phIfbHVty4r561Dpc4srF1s1GZhUq8h63gWxoQM14+KBp7TMfcgnlN4 acjnLCocKXus1/W7JfarCk5V7hkLMF5QoKhJuISD2CFHbhePYXmkymdXhzsvfTd3Yv8osW6kbnC BUSwmmk1OhmdkqIsWJnq6Ue1lDPEi6WLcoc9HJUYrcIsbu6njl45yPH0Tx8rUXB1Pu5Lnbzdz+w 1U0Sox5kOLaxe2nttSwmFpREwQObVohYLAss9+Fd8DAUPacQBLaw376+gqwN9O1 X-Google-Smtp-Source: AGHT+IHgBf+VBtY99Jhaip5v7Ep3qqpeuYxcQ6hzPYWCUH4wwhKw3eAWL3yuxyek0XKBQL59sf6FNQ== X-Received: by 2002:a05:690c:23c6:b0:6ef:7312:d05e with SMTP id 00721157ae682-6f5312398f0mr277603527b3.19.1736987284950; Wed, 15 Jan 2025 16:28:04 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28: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 v4 07/19] platform/x86: acer-wmi: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:09 -0500 Message-ID: <20250116002721.75592-8-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 4d62a61cb241..d201ca0e01d6 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -2080,7 +2080,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; @@ -2684,8 +2684,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: @@ -2706,9 +2704,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 Thu Jan 16 00:27: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: 858291 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 0EEBA86338; Thu, 16 Jan 2025 00:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987291; cv=none; b=d5ZsZYYuLxnecuhKN0H/FFOLmrrvYqlowSfclADiVfxTB9hnHK1ghKI4ld4xovQaYKOl61MwgLXaDAYiKUe+PezzlC1j3diSlD3hD5XBWK0EgrJG3y2ZdLu5+SYI1AMTRDE2M7nbsT8Cg8GtTmoLgctLTS6MineSMILn7nMQACQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987291; c=relaxed/simple; bh=ynLLD1hp1tS0pguRvY3r/dOdcInyalJ4WAMj2kYk6Zw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aRqg0HtCo3saa5bhcTuX8fHmjoN6r/EOdy7Ccpso6E0gXEPvtAG4KOl3hJ51vk8fpbwfwvEC9Ety3RNe7G4NgCNpB9Ca1AiJWMoCtoDr79mUydKlwkEJucqZ74o1i0PMyVwZRPvm2vd3yW1XmHGTtV/upGpc7PXMomYMk617okw= 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=cINRcIIA; arc=none smtp.client-ip=209.85.219.177 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="cINRcIIA" Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e53a5ff2233so720318276.3; Wed, 15 Jan 2025 16:28:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987288; x=1737592088; 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=Yh2IZ/+LRbJ3kOAnhYpwYwboDtnaDw9GF5Rr1PiGf6A=; b=cINRcIIAtzCfdpuXD8Jv6Be1+pcw1NFYA+tn5LdI8NC/GQ4+12dW0ofujvge+7w7H3 9OQyviNpnlvfCVOopZVUECl+OY95Tw07mKKNaHfIkNUslqd4i8L5gDgGHOr6MI1tn4OQ 5gBCpIjTKi+6hPRbA3aYxXHufHR4AlXgtGvCIkBTTWa5xepHtTgGPMi+TOG7eLPuY5iI PwYkaEZ2OWwMPOcc4tKNciSU8//mUf/ADCXVJGuX8el23U/mw9tn3b+6EOfKb21iKB3k 15oNE5WEMOHQ3qm9Y6hRD7/3dOK4x2kAkYjK1AXc6QZoVER5LVsnncfK85IdFA1H+py9 +kcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987288; x=1737592088; 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=Yh2IZ/+LRbJ3kOAnhYpwYwboDtnaDw9GF5Rr1PiGf6A=; b=L4uVgDOXhLCRDVgGQY+lIjvSDTwA9tKielMXxIYe0aWNsqng0ZS+Bh8dtFePh9dXMm YY3weVp3RMShvNsfUWxbxeW5i38ua92NNIT9vWlNJ7OE1bpeP5qpuhuAOm5ek5q6pKAn JDVoTr33H23wv+rTSFBmDaQjwuH+ccTBLBYlxjR4Voo/xRspFawKWH4TrcA4Imq9aRVI /xb+aP8AyQjela7dlOGUT9t+6QVtUSvo8rlVBMaRU/ApGZ7/BnTeMiwJSV0LvecUv59b cTlifJbyWnr+IJeBj3NQF9S67DZLIyzv72EPcItmJ9QoIL610/czBO1+LByJyk8V8MID jdqA== X-Forwarded-Encrypted: i=1; AJvYcCUVyBCu48xRSSfJ5/BKlYU5QA40Csqu+mDahJczNnvVD7jajMp3kU6PN7ORypYdbNwLHwkRIoyxlM8E@vger.kernel.org, AJvYcCXv+LXIkohuAyMl8h2+2KXQ+cPBFiEv1igiS3lKN1xjcPbGiwN9B6aV/zlTh2WK4dwQ6gWezOAl90CUUTRd@vger.kernel.org X-Gm-Message-State: AOJu0Yy2grq7NvpXTospVFykRltESg7Zs36RTddQv/OKFDTefTa9SmWk vrog6R58ox96HzyaPN9WqOJegvfhILOWFWWCIAYR24y8Ph7VBhx7jLZOjg== X-Gm-Gg: ASbGncuY75m+9nBOgdkFAfkgQOqTE0Xw96RmWVRdiXG1CPuQ8IuFH/xc3UY5PlB8IX/ f3zq1OK7lLGqk26hfR0qKvCqqp70hOOvn3lgoYdGKmWxp7oCcSzm39/DQhZONmVFRnxW1usio4x QKOph1vbZj6KgmbbZELdBw/aO7Xmqs4gFT0du7w8Nv50MfqLEoFwDFXcuB2J7mYXdtWNZwHti/P SBPiFtyZ7q2eLTjikyx5AdqpxEEsYPPPaTWNgq+widGTv4dYgbIsBr+ICd4EFRP X-Google-Smtp-Source: AGHT+IGRIstU5oDeyumbVSqS1RR8+YLBpPlforsUvKu+zQH5iPy6xyRGkO4FzJjb66k2ZJqXXQkxPw== X-Received: by 2002:a05:690c:ec4:b0:6ef:64e8:c704 with SMTP id 00721157ae682-6f53130e83bmr263573397b3.36.1736987288579; Wed, 15 Jan 2025 16:28:08 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:08 -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 v4 08/19] platform/x86: amd: pmf: sps: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:10 -0500 Message-ID: <20250116002721.75592-9-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 857964 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (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 7741F13635B; Thu, 16 Jan 2025 00:28:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987295; cv=none; b=FJwezJd7f+bEwHzjoBx0WdW+aZsfwPTFuq0dAyCu2i6Ayqd5YtId9ifYrGxRu5IumEX5heimFgNreUDgevkrlzi43oLgWgSNb3gNw1Xl98I3IdbjJVZXz6Q0maIZvhI5zVWfmeACfTJ0VWGR/rObs9OThOZ3NUbG+Cc27wfq84I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987295; c=relaxed/simple; bh=JfmFlGKxXkJnyQgsY5mWDMnSLwBEOmQsizMRgW1LcWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uT3Pi/cVKUMQE1ilRYiefx/Oy1sjI+jwuGzxPVDyAv5g0o/WIblE83etfMJijDa3u4abLXht8sp2nE4QZ4ON4gCPcpIYlatxblUNM1PGnp6OyGa5GU/5VRLYiPOT05+MzsLuV9UsZ9OQ9GUHi+0g9nTGFMVaBVdXbXWwUnTn4co= 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=YnY17bpd; arc=none smtp.client-ip=209.85.219.182 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="YnY17bpd" Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-e54bd61e793so723203276.2; Wed, 15 Jan 2025 16:28:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987292; x=1737592092; 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=JuLkcK3Ctj1sqTsmObJPyaZYWZ4by3q++1JQzw3spu8=; b=YnY17bpd4at+P8DQb7ijDZSLSKOzyIsXueUE118obH5IYJfU7fVLf/7vNGJhPQhVj4 orla1zKZnqeRW7gzJ+GeZBjIO39DnsRy4dJe540+Z1PWkXsIhUZAUudxBP8m5o2qxYn0 MejStOO+cqCuGwE2dvCENyE1FgL/KKrPWv802pZ+5X3zy43nLaI3OgelkDV6AExfolkn uNmcNTf70glYgB8np7edB6jFo9psKw7tu8Qje5GdqXzJrvzrrlhNiKNUx+j/HYBybH7E vat2dKXlvne443o/3t2U1brHr+foI1oEw6qfvGVn67RefeGnx5oSym4zQXir5dTXwM1n Asjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987292; x=1737592092; 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=JuLkcK3Ctj1sqTsmObJPyaZYWZ4by3q++1JQzw3spu8=; b=DIML5x/BJjwJujUnPhJZ4jg2t415rSQzb4+fQIqTixkbKKqGViZRS1qQ+vECSxMN+y II7xu4AZoG5aistZ9w6/XHPk7CWhhDAjfMnqSn7y15/5vyo1KAvSJzqgdD0iClMMd1QJ eXAp2MSHfyBaxUHrMsFjbRaQZVUS3oBRpSkP/gQZ+f+jP5kfX5P7ShM6/Ihms6ED78zg eeAFSYqhMngbjvnef3BeN4mPfNOu5bTJnrIHVuQU3Tk2WvSTLKBmmoD0n87KDDgYB3Fs KYo+H5SC8Ar9N8N0Q+qEEEJexclHPV7Y46vWygd4X5i1ODbEN4X6UJyLXatf9h/7Ykt6 JlFw== X-Forwarded-Encrypted: i=1; AJvYcCVgVF7ugLFdOz11zDj1kBWD0rApHkr8JfbcfAqN82vWyaDUvnzfJYq5YFVDHXZIroo62C4VK+TVdssuSxlF@vger.kernel.org, AJvYcCXt7wAamVno1sz4JDcz+6oKg6UUGaLin4vr0/Djq3tQloOQSsb3VfIe+Lck888hjWiX3o0w4XyyK7yi@vger.kernel.org X-Gm-Message-State: AOJu0Yy09sAgMcIER8XgcVugQY6Tp+gYbn3JZ5Cu3gn+28c+MlXbVFs4 h9uY27QE+PrRLpM+jmQ+DvS/tD7L+IjSRQFEhEIWFBtTFO7yvPCfQCSzrA== X-Gm-Gg: ASbGncv0HmsU+/fRPDOLjMpXEuJWBKLGvzJM9v6n6CM8s6lpMET+ZYfPp92yRcpMCN7 Hd4NkqfstN24Bfy+AY0yNRbUX9cBFA1HQR4Q+YEmIIiT5DdTx+yL0fKHFAIN1n3NOR2yjzBtP9C xljGvw6Jx03AExYPGejgkUN8C5WZ7gKZVXe2sl9p4rTz2aQJuU5eNH6R28Sl0zn0ogOU5cpH5p4 1pn/cw/y6YJLyswYoS04HVLkxYnPkTWJkzaoY4UqRUMZVkxGn3TAT8UrZepYAS7 X-Google-Smtp-Source: AGHT+IFytx1Y6z/zCJyAP/uO9OWAKT3dJoayh3lZfJ6bnsay/1lCs4+d2N3PnLaOi0X9hPas6zu05A== X-Received: by 2002:a05:690c:387:b0:6f2:9704:405c with SMTP id 00721157ae682-6f531224982mr287535497b3.15.1736987292109; Wed, 15 Jan 2025 16:28:12 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28: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 v4 09/19] platform/x86: asus-wmi: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:11 -0500 Message-ID: <20250116002721.75592-10-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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. Also replace pr_err with dev_err in case of error and make the error message more user-friendly. Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/asus-wmi.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index e775ec7371ce..dc713a5d8042 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3895,12 +3895,9 @@ 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); - 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); + err = devm_platform_profile_register(&asus->platform_profile_handler, asus); + if (err) { + dev_err(dev, "Failed to register a platform_profile class device"); return err; } @@ -4859,8 +4856,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 +4881,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 Thu Jan 16 00:27: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: 858290 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.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 E4C0928399; Thu, 16 Jan 2025 00:28:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987298; cv=none; b=JdwO1LP1Ztoa5mfnC24kF6SphSV+5R1g21NatZIQsYjqNImWTgseIKlYZXczUvsZ844youwsnA6w6hNG/c9g+uQH3+MYv6FpVFI1T+LyepWGMTLu/QwlqvrTuBC7LBUFPK7mwr2E8MFAseunWpzuRGG95gE60fAYV90m62F6Fdk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987298; c=relaxed/simple; bh=vgIFGuCQtCQrejPkdjQybQSCxQrM64ITP35HJbOz4qQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CubHNfP6ej0fCYBFW18qyRGuGmU8B8usQlDgbeJOzn95zRxiR+v/dLNujcVZYdKyIKWEWJ6VaH50jJsF9F2ASa1CQhGOaXyBntW/gHO/xv23Ej7ktaEgXaW4EtPKHDYkl7yTGbkQIl+YDgfdiOAVwcvea1WBy7J1RqKBVl2qxQA= 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=WRRmzFop; arc=none smtp.client-ip=209.85.219.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="WRRmzFop" Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-e3a0acba5feso531646276.2; Wed, 15 Jan 2025 16:28:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987295; x=1737592095; 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=jn915JjHMCZzW4nymCIdvo1TCvMDkS6xX+9xPAKXL5I=; b=WRRmzFophY35ZHuaITkI7AcRB3SOgFt49nE93rWCTUt/odVwuAlLYhRLGO0BA7QIlM x9ZzaLINSae1848diUIkNXYqqGg5F2CjgElaN5q70nvGKg1LpyPpYYxuGGLGGiA2GrtN txgDLWN/u357z7zERSGFUDLNrAwP3Qt0DtxeO60b+U8CmPR/de33d/BuuKcbrONneNKe bvAXQa5d+OO9rmsQLkYVyCDmTINLIjlo5XmYVXfQsJoUOntVWAS6I5rzRsKzhJ1tlFCv vGTm+ZOE9oBvhbjGgWmjmdFcH0PTo45yRUoaUSagC+hIDD9Fifl1vgy5XSGgZbBbLOhn PJYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987295; x=1737592095; 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=jn915JjHMCZzW4nymCIdvo1TCvMDkS6xX+9xPAKXL5I=; b=IHRpHxwzKmOW7X5zAGexRiHrqLLb0I/4m6V9ElGwwKamSRh52LQVN7/HPiypomuP2j 6Bgjgzbr7gHKkzwvzfSAKplb48etVX+XKKbnW9UByavGdCfj4yTFxiWrtOc2ach+x288 xP2vzopmkkoH+KcR2+4kBQlg3eeb0JqHvgp7NAb7bdi8ywjqRWoyFVwDsNRRmTm2fgIm 4loEuHpKWKb1Ebmoa0Jxx2aiq1qZWFbWCoiT3V7GxPgxXJT6gFmNjqumzz11yjU/m6nX EY4vDVg7R1myC91igcvEwkwGrx71MGcE5RwAl2kB0L2KZFif59Zg1mPDshv940n06o71 VIQQ== X-Forwarded-Encrypted: i=1; AJvYcCVMlIEeDA4dj6pziBQhp/6fNByEGKnD8jd24vNhYbpHvdcIXXsFiRc2L/T+fJM5SF90iqNA/SNc1vug@vger.kernel.org, AJvYcCXG9C01OssyMZ78OY/9phDqaTW+qlwLgHlv9Q8O5jMUNvpbZCeRciE8W82si+lyIj70qVVmOIrTHePp9jbH@vger.kernel.org X-Gm-Message-State: AOJu0YwxeP5MZjoBRCju1HU6Ohi1xs7Pa0LJhkIJhmzeXmohFXL2F/I3 I8mw83FFO7oyWfZptVJ1z15N4wPsw8BgnUCq6dxs/Iqnu9ztxXtu2l5t6Q== X-Gm-Gg: ASbGncsZqk3m115Rcm7agEBwmpF8GXj6cGU32im2FuGPHpbepBUXkgzHfkHh0e6zAmo k7YBTc5Ncc7JGuf56bdzUL5CKUU4Hj/fiLtOVkXvIP12sWizcTcjuKmXINnKaiJDx88pudm+Bmd VWiHlxJEd2pNhsSC52P4oMjhJuIOmfWDLkdbzKy+5wpO57ceIKKOp3HrLj+My0eyXhBpanCejZU aYioipKue/E2vdigjJhI2wN+NgkRvOWuSGBQuC1j76t16EQ1REwVAMhqrUk31nu X-Google-Smtp-Source: AGHT+IHGI2CCldxbaXTDdFrDsQFHmhyBCK3y7oK+RDzKpF8lSEtUCmFtmKcCZIkoyRUwz5T17OoGcw== X-Received: by 2002:a05:690c:f0c:b0:6ec:b74d:a013 with SMTP id 00721157ae682-6f531245e89mr267306797b3.19.1736987295607; Wed, 15 Jan 2025 16:28:15 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:15 -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 v4 10/19] platform/x86: dell-pc: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:12 -0500 Message-ID: <20250116002721.75592-11-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 857963 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 135FF148838; Thu, 16 Jan 2025 00:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987302; cv=none; b=Lb3PEJYOansIQW/yG9vvQXVA2ojOQ9xTeTPLnW6A4fR63I6fVyB9tVoLQrWOgKEMJoYQ/023+cCj/iV/253Z6/886U0TE5/WLAIY6Km09PtI8uy2NZtFCz4RAyJCxHZaHsrYNweMrTWSjvoImawdOZ3nZrFqYqPMR1CcrpjCEeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987302; c=relaxed/simple; bh=oCmDv5Wbdfc0zQfiwQu5GgJMWPLheGCp3njACHeDYE4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UGHXUnR9FIeK47L3qLvTj4rn4vMg09OSNBA5Q7AlxJBxRhUGgHBmcTrCB7DE8FqhgSNny2buNw47yVpqwLgZ28Id+4yvtFw3g0YcWnSwfIMrPlAzIBXT+jB5iVMnmna3aZCUos2Rt3Bflu4RqHkyDYNcNJ2uYXvGRfPgx1adOoY= 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=esG1dWQo; arc=none smtp.client-ip=209.85.219.174 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="esG1dWQo" Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e4a6b978283so2727341276.0; Wed, 15 Jan 2025 16:28:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987299; x=1737592099; 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=y97wOLhlP8Ii1C+c5Dq1Ud9TpCVhWUQBWdqdzRT3wXw=; b=esG1dWQo0ESD8mFSP3P+t2WiASZYLRNS3QuW/PQE0zwnfMJLqeKuLsGLY/AgIyR6Fw BoE0PgnuPCLAU3UEtOI9YXmdKzKA9ujlbidM3DpuDtoT4NV10EdJAq37AP4j1btPfUlq P9Q3KriGN0xF/G0aE/9q8COVaotkXurc45T8xCTikwz7LkMknQXRWNF6r9UhOklrpA/n npyERyxYIyNblg/SrtInWTip/kK34YA8eVsApCta8uoOO5Gt4vsOutpmTT9eTB7bWcpQ I7E46W1WwXlkB4HTLhwbJVlyYayxW3ZBKEINurZ7OQlOxvAF4zdX44Jp1NFichxCXeiY wxLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987299; x=1737592099; 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=y97wOLhlP8Ii1C+c5Dq1Ud9TpCVhWUQBWdqdzRT3wXw=; b=VsbUP/dhRD5MiAZefac7YqshQqhI9Ku4MsDjrn2oNFHwQb3TzA87TZ2D84D66eaiJV bwXMGSWmyrqyzQ1On+dU+iF/f5FUb2i9N8PQWlWBC/Bpyfj9pUv+PRPXZfU7QOO4BnxK lOI/KrKbjfOrVyxuJkL3/pgxjzvc96iRfvSrCPIAV/a6G37Wca8atZF933ciKO+8QyHP mr4Z4JltOucdJvEG05kYwcfpQwb8N8i9zFFT4UrcbWRf1EBGjkiKIOiwX1p8g5V8D/9Q IZkJQ3RBdWm2mMRoltDBCo1d4p5qLu4RVy83Y0a3WFqecFwXxLCsM++iOc+fVZDQ3nje m8Fw== X-Forwarded-Encrypted: i=1; AJvYcCWocpAv6RE9zrxj1SKINdOCzRTKkNYjeK7TP86O/vZ0GpQvTCrsVNfDpJxAENQ0AJdlCj0ycn6heoNJ+OkU@vger.kernel.org, AJvYcCX8OLNNFfnPXSCyeuC+oeyqzHnASSZcxZP1ElDaRoC/DgnJkMpF3rs78bItlfxCgLXMe1M2E+NmhkYe@vger.kernel.org X-Gm-Message-State: AOJu0YzYQn5LtTEwsHNqxANzzDV9Miba5eUKh23JqiMhh18Y0iAxhJQ9 CVs1U5AFOPm3g3ZZ9hRRoQk4RD9xamfddVlJ6vep5ADcBwqZC6RToEwURg== X-Gm-Gg: ASbGncshZBkJN++G7lYUr5r+2fYlhwXgCe7oPKzEa80XTegJVC/Lvrs85PpOrTvFExX QZTh0+spBmZchWu/CowT+iHRhwCLrM0wT2FHHbNfZl92olhOgIsAmItdE5A6QrB+VaXbGQ8pbIJ ohpdTbCkEnnnPSZGnEq6O+Ud5VhQK6K5jv7KseKu7ex0Q4FZOs+eUw6lbjneXiSGGGei2WsSqbG mBowjoJSWEgI2l45huJx98ylv4BxfPJ8zfRAS2AwQsSKKEpf0LySNJwt1bU1esf X-Google-Smtp-Source: AGHT+IHPM9Ckc4LBHOUOdqSWN9DBwGcIsR8myxqVnjSJ1aOKgJwoX3DjYjKwf7BdSomz0oDTH9sxoQ== X-Received: by 2002:a05:690c:9c02:b0:6e2:41fa:9d4 with SMTP id 00721157ae682-6f6c9b5df5emr46481737b3.15.1736987298824; Wed, 15 Jan 2025 16:28:18 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28: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 v4 11/19] platform/x86: ideapad-laptop: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:13 -0500 Message-ID: <20250116002721.75592-12-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 858289 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (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 199E014B959; Thu, 16 Jan 2025 00:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987305; cv=none; b=OlgXDAO5/BXMsccpN7ptJ8bYRqKQGNEKBu5bgA45VS3YKmDiZ8eTmedLlH7oMv1kXG3I8mfdIveSHe3X+yo97eALlXQBWOnZNJUwogwi9TAuy2JRCUJSf2aUm+zQGOR0tApqk/YxPyj7hu0pwj+KT+0Mmouci94k5NquV1TngEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987305; c=relaxed/simple; bh=r3+zajkWnSc6nIQzFdNZHPcXlS4SrX9xPynZuolMFTM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qeX/bBuGp8NqyuhQRjVz21kjIjr5pTWAh6o9VQoF11RmlnE54YxIJhEkD5BlA9DR/c2g8b8YpqbO0C4zhr/LR0gSg/cNtLPi556Cw+zeauLJiD/aLV2l2/lgcIt6KaRt3dnhFXG4smLYe2hcOrFw5e0BUTVbMl1mbmHaXtVGMu8= 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=JC3X7LDj; arc=none smtp.client-ip=209.85.219.182 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="JC3X7LDj" Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-e398484b60bso625272276.1; Wed, 15 Jan 2025 16:28:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987302; x=1737592102; 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=5Tg50cvLi+S3OFbqsFm+fhLnAbqIbAXDy5oAujEJcOY=; b=JC3X7LDjtvvatR4ACxDrPEfzr96WRW5n6rlvAss3+IAPtKs9s2h5bk8lK//sBpuinl kk7/j5kPqAk5ba1w46h9eZKU4rr9/eQmS38uK9fJ0NrUbN6RhyMIEQsqAiKFU2OCRH4H rixCoVXxpkQf6cNlcd3oodtONH84yo08+4dCaxFy3BnFB590+PdGi9nIx3v5sUdQStSm 7xhDG/bxzVri9uLxTyk5wulsfxT0y8tZzWiUK9VDMlMgQrq9a0/d7HClrjyi1bb4bUxl HJxQF7V5I11l2VsdZB926Z0bELAJkD0KXYZ3IA9bqIZajaf+CiTqfFVh1bMP9DOpYt0U zdkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987302; x=1737592102; 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=5Tg50cvLi+S3OFbqsFm+fhLnAbqIbAXDy5oAujEJcOY=; b=ThlyFPNO9dUACsjYOCola5K/bPqksLZARW2/CityZBq9vTjVV1gq8Fzx/nT8c5E+hj dpLPOllTohsC5ZHR0MA7uiUiATIeT1Ed68y1glSjAUkGD6U4xfi05EO5aQ9kqWG+Rw0j PEpKFR5Y8Tej/a0B09NliWkhsID0CxU5KD2ZsOitaMGdwNeD7jLFcZkAYCQh4eQPxSuZ ynRX2haZlUeHZN1HuHMx4sUHt8i0kYINJyjpOjpkCGFlux/vghXworozj6mI6tgXWvrS Sm+M2y+uxgf0diwTyXff/J9M5QnHLnSVh9TRTEq+14ymg2a81Pq3EXCW5f9uuvI5aIWi Q0rw== X-Forwarded-Encrypted: i=1; AJvYcCV65QiG9a4zZ/nEFZpsFj2mFcs8ZKYApq/+JzTZ4KG7cDZ6ZKrGga24iwxjZdfguAOyzCm1FSZt+7bgxtXl@vger.kernel.org, AJvYcCXotFBVU+mJcQIMDp011vhyxMbILfTmSPv4dkldkeo2IL2b2RVLn0Ibldh0Js1gewP/z2LhyMoWYqHE@vger.kernel.org X-Gm-Message-State: AOJu0YxKMUM8vQbB0lc77skTtwbyeZQcJcHdWeyIWGEVS78eKtFMZg/V Zd2Q41Oj/aRGbb5vkLjXAii1UR3p1PyJMe/2+xmqHCFpTjw6CnrloAf84w== X-Gm-Gg: ASbGncvKGOVFyUW2ofId6TBxikEK4UiScIvfOJdLNDg77NuVAC8t/hxdIUuIU5gH8Wm KheFaEDcSOya6eY+g4ihxqmM2VsCMDNTMD3Wvd+cnrd7WgkQYJFdxq84Y2RKw0gaVp9UCOccDX+ BwXuoVTajd0pJ8byGp8BKi0PFJdTJkdwoFt2Gcz+tVUgy0aUWGyq7F8ziDlcayD9IDpCNPF4YS5 tKm0xiX2/99lOZl6ZLMZ4sn1k6YwMcu4Jygdl99iMiCin1WNAKSeac1+IYKaxV6 X-Google-Smtp-Source: AGHT+IG5HXgLTkUXHqgqIOlEtoVxGPc2XjuHVBGEOGtd/oBYeVu+NHxK5MnrvlL6lImWo2zfcksX1g== X-Received: by 2002:a05:690c:9b0c:b0:6ef:4a57:fc89 with SMTP id 00721157ae682-6f53125e6e5mr262496917b3.19.1736987302571; Wed, 15 Jan 2025 16:28:22 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:22 -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 v4 12/19] platform/x86: hp-wmi: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:14 -0500 Message-ID: <20250116002721.75592-13-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 857962 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (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 0037114B959; Thu, 16 Jan 2025 00:28:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987310; cv=none; b=FvGPHFFDaC0wyTOuZk+YIhqVQhi39SSjBNTl57MDqSrLuEyPzG6hJaI9Y/LsURFXgoHROYRQ4WR2bo4mt54Rw64XdP/udzvXaalaXguYV85M5F2uo1YA/L5yX60r7o4u3Oq/yAtapYq+YCFaZl+e4z9WxykvRLzpt2STkKuUeCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987310; c=relaxed/simple; bh=TuqkTUywP0clh8XEH44dh5+/J0kdOPivjgDX6bUOK3w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XlisbTQRMBlmnIom4Zql0DQ69Ur80eMU/nyBVDIdqyz7H4thSZxjKUxm9Z6gkJAeTTOw/X46Nqj1zUVafHMUERhk2ZytHtdeeDfAnMWiQ0uXu8breLtgq8K90TFS3fYRTblLVFrJaenLYkE/4czp6ER9rWASxxfFEEe+nUcEUFg= 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=aO76NYyK; arc=none smtp.client-ip=209.85.219.181 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="aO76NYyK" Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-e5773c5901aso2588858276.1; Wed, 15 Jan 2025 16:28:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987306; x=1737592106; 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=tH21uZjKaqDAzuZeRzdoCYUXWCsDaoqo3oPQNE/9v1M=; b=aO76NYyKM6nHoGGKdo6OUg4FtRk8r/Aztfa2A3q4t5v6LTlbqHhWhXzcgKVAYXCVwW R9D1GxDdEM7qDB3xtz+0YRO3GsCf6sP8y+1q8nbNATeOuKJ6iT6qC3uwhQdBh832D0Bk aV1WpuJITf8xss1+nwZB8cjyz6y8W2vI4L1pK2Pc+jmbqJIzeuLN9+P8y22CvUNOa0QU ijVgfVKwh60BCUq5iGc7Pt+xa3lYE62fy6yUQbuWgmsNuOGfsruW9CN4JRXo95nbmhaJ qCtUcrl+DshYmvp3rhjnYu/hDnXHkuADxryknC10oEGR0jueyk2ZcUoh+L15LEEnXIiI jL7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987306; x=1737592106; 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=tH21uZjKaqDAzuZeRzdoCYUXWCsDaoqo3oPQNE/9v1M=; b=bMFy3aSPLQdbZlNJ0d9YyCKiYyZlqygMkeucvz31Y/ocI5/2pjWH79OppKu3wyVVpC NNnuYXzCdU3WKt2TE/t2zOylsqSIiOfll05xOGE9BW46mll3KbueE1g0ZOBMVcrBialO fFcnW0bPTzHS6E09xRNg0s74I9Fcv0UC3cFzlY2J9LUdpkaBNKqgeTk89DfvEAfGsH/5 mjBPKJ6xrAcVTofZ9E7s2c4qZRwUDkIE856WBSwcgRoDtcBtwIXVd3bnJNvwPJzS30Lw kPmzusKuI+GLzP+AkqmgZsi5tBr8GKTrSXkXW1uk+D8DW4MrPL52EY0uNYarnn3WSP7t ErBQ== X-Forwarded-Encrypted: i=1; AJvYcCW8/fZ/Zlv1GdO7G5cXZq5tZ4aaTzzsVDtbW56IY57QFA1CrYn/yb3SMVo1RmYEwERbDWkrC/KmoG4IDVbU@vger.kernel.org, AJvYcCXoq230NM06XsEW7w7i6bAry1YNweqQdlPqJj3N0igQ+ER2fYUDqJeln8ftRU9RJlqLhsawcECbRWED@vger.kernel.org X-Gm-Message-State: AOJu0Yxvn4hpHRddxgQF9+aDC3Px7VKzGFk1QWUXR380sjuwEQYN8jQ7 ZFBALNhxbEyu999FlWQaoQtNZDXo/10kDwSyCZuOJu6GbdjOW4UGbVKSXg== X-Gm-Gg: ASbGncs0i2/afgSDdyk4l6Fqfp7qLhbfGtwTyXTPMBeE4x8OwzBGVSiHChsetKOvtgh DGg7xnSXtQshmYCabtfaEpxdBu3xd6WVUItZucGEKTSv5VBE6plQVhTU6YUoobAVWZP9S1228I2 NxLsTimUOwNmfPXVV4m6xpOKE24xDyWaD/MdVXNrpQ68RjfM2HuBZ5k5XkMsKigwthetPtmSe3l rFnlxT5aI82PqtefdSW4WNmi73Yab7zfIfgoUB5i7bgizzuXYsK/Gqya8K3q88H X-Google-Smtp-Source: AGHT+IH2I5tV6mgNgQcixCjG+koy1ChbFHil6bYsGZfPPvoZmIvSUH+xNP28yO5U/MyEFwLSXonV0A== X-Received: by 2002:a05:690c:6b83:b0:6dd:b8ff:c29c with SMTP id 00721157ae682-6f6c9b409b4mr43521037b3.17.1736987305730; Wed, 15 Jan 2025 16:28:25 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28: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 v4 13/19] platform/x86: inspur_platform_profile: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:15 -0500 Message-ID: <20250116002721.75592-14-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 858288 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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 3DA0736AF5; Thu, 16 Jan 2025 00:28:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987311; cv=none; b=YCnMjvhF2v4wbFB4i44NNb/ype3JU9xB3fzUOcGJEm2OQnyY2Amon9upATlmlAcNvJBc2P4P7dNmiFo21iSZu7jTCFBfk+bD08mevWVvZpZakzneaHJ7bckO8aEhTqfo0168X+p4yftm36eZw06xl2VLo4MaSH28wSFod1FGOSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987311; c=relaxed/simple; bh=KEQvIYmq0cIHVoujULOvRQU8fvdS43CqT1HPP2rwjYc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tl9RE5RWb713LjuV/+Ef1aoFaGHVkbfDP+Umcxr0b6AcbL2UgugLKyzJgz72YnUKBXFUigvGXg2uILaMUpIUG2BkR5sYmVxriQTlZsBAIbnTzUW8ggo0UV+XXA1yQS4pdkeykFxUI4mQLm8LPMX2yPqIEUA0+7+WLhyWwrP9Ukk= 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=ZA74KEIW; arc=none smtp.client-ip=209.85.219.175 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="ZA74KEIW" Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-e46ebe19489so548907276.2; Wed, 15 Jan 2025 16:28:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987309; x=1737592109; 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=0RP7ern37rbsyz4TGATiD0LG/PTcy+anmVzb3IZLQZ8=; b=ZA74KEIWE01KdSEEXVloDzV+HUTFyu8l++qHrSm0fNKpJUp7B1i6GUx0Cl1ANoxR2X p9dAD2sqd4ClVaMMQv8N8dTX5sNTDmYcexPCz59xzUWAtLB8ovMcwmBgFX97tb4VPZQK 7AxtUjoDMBjVGkLGEToZehIH+0iyn1/XKBRP4+mQNpyYg9rt8U7m7j7WIFFVty3t+326 Q1uX3WP8zD3N5ZVLoXPeW0K2cTY9c6unRO+0nqFN5Axb7nGBEjU6oz19HeQ08OYxWbgY LjeH1mMEZqNXLnOeXC9pcmS9LxJltr8E8MalQgT6vUvKCtU4lWDHn7QIn45E4sj0tDFO Q5Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987309; x=1737592109; 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=0RP7ern37rbsyz4TGATiD0LG/PTcy+anmVzb3IZLQZ8=; b=iXKYpeJGGnlpJ3jg0OGTQnqWs2qkKdfflEoklsql3O+HJFCKTG+98xJL+XTIj1H5PN S875zwJd0N5GXJFSNcSR5Ut8BUN9O9hrNKFZ55NQi/gmyJFyeAnsPtSWhAOUYzZ4nOm/ MejVTPbJZnXG01ITmCSg1JDANWE4Wim9yI6wQDJ7luKAWWsjjW/UXic2eHM3c0SDoGkO ILVo+JCjufzY/WLoPnJuB10qO9Kmaca/HL/2NsEpt8k9+fb/WMHAOG+/rrFLpB1Y8Jmp K4ltZ0BRjUYMTFb4IPtn6C/jaRGi2X6Rp64Dj4Wb9etb6R7MzrVuCWwTuah4CmddTJeo 993g== X-Forwarded-Encrypted: i=1; AJvYcCUGkphJ5lumXyLmKWktMnrhWrDGHFhteSiK7dHARJmeFYmY368+H7XNirhbsePAtfJvi2q/ZhLfHxsO@vger.kernel.org, AJvYcCWaQrxTQkHD/U2BgFJshTQ14DckFBsOKXVxbi1pD/MuVbdoNdoE1eSqLXGm4CuXLw0o1bPnJa04ALUwYBAz@vger.kernel.org X-Gm-Message-State: AOJu0YyfayokQEfz3O9ctnOdXclDzeJbxObzJ1qSk89rAZ6u84Jjee32 zGIAacUfcjayRHOkzn90ijaZPNtyyNydxW7zGAOePFtylKXjkljtHZf3kw== X-Gm-Gg: ASbGncvO1oT1WFGvPvBuf+qux0BKn/eJS6m/yuggiZksItR10lOlmlhkq48wXi89ZmH ioSY51QDyDmapm9PMYJNrqwYqPK07NP4J0qEbrbOHCFwoM0vWon+KGC+9c/uqU8yiB3Qwf6dEmP N5C4VOpVZyZGPoKSgmcPEnn0DSUgDgd9vO8A7rwINARxG2oF2+tHZa+/oQWs4/aYyXXsJmwNgRq CUmLx97/G1cDFiKjRWSJyCLe6jWYR5nZ5a/zoRQyPysCHFzv4vBqGDRt464lUXI X-Google-Smtp-Source: AGHT+IFxEAa5i/RxugjSShvFTYEJLnEaU4SYF6nyvkFZO1eQcrtgEHLpG8u5x1pd5Vueh5k5pVbhOg== X-Received: by 2002:a05:690c:7346:b0:6f4:222f:3b77 with SMTP id 00721157ae682-6f531224ec9mr272789187b3.1.1736987308893; Wed, 15 Jan 2025 16:28:28 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:28 -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 v4 14/19] platform/x86: thinkpad_acpi: Use devm_platform_profile_register() Date: Wed, 15 Jan 2025 19:27:16 -0500 Message-ID: <20250116002721.75592-15-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 62b2ddfe7c0a..c9226e8dc713 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10650,7 +10650,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. @@ -10668,14 +10668,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 Thu Jan 16 00:27: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: 857961 Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (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 4F3F8C13B; Thu, 16 Jan 2025 00:28:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987317; cv=none; b=oeKo7/Rcl44kQZY7vinrF++Qss9QvZae+gKLPrKF98RV5RwHmh67RIDyhS75q4C5pnBGB9M2qLnt03h5AaRZxmkeA90U4yW9Pu1gytDtEaZPTXMcYqStIGK6CBGualTsyRNzV5CUKtoGnuw7PCgDzysgDrG9rmGeUWvRGIXJ+7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987317; c=relaxed/simple; bh=OUR0iKJdwpQdxdyd/cQxybWzuiG4gbd18qE2eLKXiyI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f/08yuu1bFFNQpdryeG3n5sAq6Hl4wsn0ZIZsTgk42/xlZM2SI6msIAOA0nqxn7rNy5zJlFhBOzbJlIVQtbmQ+MwBPfiLtquKLKA9mLxwwyBcvNXmum0SHaOcY3K5r311aTXGn9yOjTxQMrUCyQWMKssjk2loWLvleHVlyPd/IU= 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=P9lIH25I; arc=none smtp.client-ip=209.85.219.173 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="P9lIH25I" Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-e3978c00a5aso631966276.1; Wed, 15 Jan 2025 16:28:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987313; x=1737592113; 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=j/uV2vDmt1+M+eBB1jNd58c+AQa0YeH6za8sIeNtXfM=; b=P9lIH25Inu2Zc1D9KIgaABqGlZnpaD/M4qhfSd5+58f4iN1Y1xXX5VRkA4vVHsNhnW QfDVkd6K6h9eWNvGJedUd8m9Mjv0uB3ztsOHuLFR92zmpwgUy0at1kP3z7uHE5DHFEU1 gbD90zKFvVvVnwaUxWF20QvPabpSi+ulq8RDbNM0RD+Gjz3ebP615XSndOIv8FLeS/t/ ziolx/gXoonoXoprw9iE/rl4bXFRWWWcVg0loya+BmUJBzKBuUUwJZOkZl3n8bL4TQSh NRO3x3g388fLFWjAKxzoUtXYSFFAPaz/1qWxyDqBFP8jzH8LGyT2WYdQuJbnitRLwKlJ Sy0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987313; x=1737592113; 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=j/uV2vDmt1+M+eBB1jNd58c+AQa0YeH6za8sIeNtXfM=; b=o7XV+Jlx/lGYs3kSZpZnKPAlQ2nL74bZV4I0E/gAkZ3tk1R0DZifqDAYyR4u8QEbJT W/swpTXF+xhNJQao8Bbe8AVMatwZKrq/C6/mwMZqUUNoo/lMzG+lJRKvCdZYtYFFBUOD 3qtZA2H8KtGZA1Dnyj5RC/SCiFYGEw0box9gzDM877bT/Wit641FnJSZdLXEmvYk9+2N IpstQrObo1nGbVunC1V2j+CKhc07i0+6jVYtuuhpjUc2cdFR8ygwOGS0klTh+vz7flV6 ZC7z7DSCq7EB6FgG3xn80PLCGgT5lbFXXGDVJeWw61g3Fh8wIRyRYusLCILKlrue1bsH mQMQ== X-Forwarded-Encrypted: i=1; AJvYcCXJuGANxSwJrxfBX+xdt6GDu1PBULwPsPwAQhVtOz+rNnlRHD+FigPe0NjabWvi8tAp/uTYX1st0iON@vger.kernel.org, AJvYcCXodNEpewXEfZNOCjlOqTmb1a4/E5QN5j5e6RXVTz22f+23+APSTYpXPGDvTotizXa9paVdJBKHT84NitRa@vger.kernel.org X-Gm-Message-State: AOJu0YxB0MmMneSZyuZG0Y6iEs4o1I2twzSaeqMbgypfvUWJ0x9GkU6T nWMVufV5AeFSrXH4MrvvoV0JAn9kZWT8sChgsPvvWVQ4sFL7Wz/WQYoPCQ== X-Gm-Gg: ASbGncvq1V2DNj8Ipju6geN4+HkU++BXq6xe4qskEoUrmeaPLgyotcLjkQuG20z4YzJ hKO78sKadDWRxdqyE39KHj6z3FRLgQiSWL1fsYzbeJ4f0W1aKTSjl+h7PEDH/aaTacz2dgxmcxR Doi9ALAFkpr+WmYgfiJs5iku+sJ1hUYdDUdq21/biE8o13kfqc52oCHilRlqIX6+aBumNh8xy/c gwtB/GMpjd8/jG23cw8HQ1gKoMfv1QIgXiu0HWkb9aHsijpeWFLSj7TbjUd2wpq X-Google-Smtp-Source: AGHT+IFCWUh8mRfe0JhSUhR2ITGzesgFLFmHJxs853NobGzkxE9dwRAoPQ9KHgUsxnXcsd3IzHaOGA== X-Received: by 2002:a05:690c:9983:b0:6ee:a89e:af3b with SMTP id 00721157ae682-6f5311e609dmr243643257b3.9.1736987312614; Wed, 15 Jan 2025 16:28:32 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:31 -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 v4 15/19] ACPI: platform_profile: Remove platform_profile_handler from exported symbols Date: Wed, 15 Jan 2025 19:27:17 -0500 Message-ID: <20250116002721.75592-16-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Reviewed-by: Maximilian Luz --- 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 | 15 ++- 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, 130 insertions(+), 132 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 d201ca0e01d6..ae2a7c93ab72 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -784,7 +784,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; /* @@ -2073,16 +2073,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; @@ -2125,7 +2119,7 @@ static int acer_thermal_profile_change(void) if (current_tp != acer_predator_v4_max_perf) last_non_turbo_profile = current_tp; - platform_profile_notify(&platform_profile_handler); + platform_profile_notify(platform_profile_device); } } 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 dc713a5d8042..9a485f777591 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,14 +3891,11 @@ 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; - - err = devm_platform_profile_register(&asus->platform_profile_handler, asus); - if (err) { + asus->ppdev = devm_platform_profile_register(dev, "asus-wmi", asus, + &asus_wmi_platform_profile_ops); + if (IS_ERR(asus->ppdev)) { dev_err(dev, "Failed to register a platform_profile class device"); - 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 e7209863e7dc..63cf016bc912 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 c9226e8dc713..56c57cb45a76 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); @@ -10554,11 +10555,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; @@ -10587,7 +10583,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); } } @@ -10648,14 +10644,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 Thu Jan 16 00:27: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: 858287 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (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 06E45125B9; Thu, 16 Jan 2025 00:28:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987318; cv=none; b=pypArcUXb2P6q0oyW/PfHmDjpe94CWMI0vh4/FAb6u6jY7eHx1uRE9nWHRssLlJ+3BZBTYB7dwC/O10I07VDm+ZObmlXdbuTIR++Daalelw5/ObeadIBDC3ZslCQGCfZIXuWxVz09DHgajmM2V+cJXw5UsI47+VV9FWDvDwq9LY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987318; c=relaxed/simple; bh=+66kqFpqhzN/s4ymNKJxWJYi8U7LK+BMCLwY6OMttgk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EAYh8LaI4I9MaT00SNDUhLPLv5RLsVYTxAQPaI+5Cx2/J3rli1YU2Iu50ql/uBnr/fz7t6EZ17R9C9XkcLnF5mzFRufg7VF569IGslZcnT2YSTOJKYt/o/EQQTeMBvXIn4RKpLRnIQiqH3vUOiE+YENPTkhG7PY5kVHMdkIDOGg= 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=XcL3c4kG; arc=none smtp.client-ip=209.85.219.171 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="XcL3c4kG" Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-e53a91756e5so723303276.1; Wed, 15 Jan 2025 16:28:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987316; x=1737592116; 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=YRk8UrGC//ApPTeGyX4nKWjjwhb50pfUBdhCMtK9xUc=; b=XcL3c4kGYE0oXMdY1FS4RiACT76supJfPvsFLtdzakegitCMznH88qO90Y5mMYxSS/ 40uhw+3W9jUmhHEkAn8jBh685KiYC1rkxEJieebHmaRIbj1qbHhxBYIfLQOeMcVkye6y Bq9zqfdAQodT1zGHTr6U6vmhBpogmfu87eGx8QHEbOZLvwRZmaTu0sVKcWNn8wg+iaKF dqARXEfZcrFJBU1ZdX8YGw0stmWnTrjTFAailWPu7hhCF3za9+vS78X5u6L3Z6bsu5Xx g6K1BxXRtpAcoEWAPXoRWXXdbgFdkX3XV8vfujO8wF4uYi28vM8VDLhy869HW86LPoM9 Ap8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987316; x=1737592116; 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=YRk8UrGC//ApPTeGyX4nKWjjwhb50pfUBdhCMtK9xUc=; b=SF9VA6vgJgHPG+hkUAFk294bpSPWmAwr76rIJB6LS+DsxjDOWQuA2AKEWYksgqWVkX nkF64wolYyLs0kUQlkpd1sv9RL0pGzayoyBFB5JY5zP+2AsnIcGOlIBEV8Spas8aoAPE jDWzHAAYQsdWQs63J/by7FOnp4m0mCoItcPS1OdEE/BiasIdf87F5R0WcnhfuPaI8tjY 2x5HOuVuM1geRUx4/JtYaKdGayd91SbNGxcDF6e8ZIeTFz/xxm91b3/J4u2RYAUxpkUs R73z1Nk3nM9YbH2YsCYdulb96ivv/OT4PijEX45eg5vAlNZ+Xxt2gprH8Adi8F4PSoIZ 7ZBQ== X-Forwarded-Encrypted: i=1; AJvYcCUWbEXgkVhVr3kKm1HilFguOpTNgpnLEBWXs0aBy2Vm6IiYX5DcgKGnE8TGDNWlQmF2SRDNZQQT7zfX@vger.kernel.org, AJvYcCXLH22gCjXkd1xN3/Hadzaw+4+XLfyv2eKsSPwmqxO4yi34ozTUp0k1ueG8d427Buj5JscAQMR0IE2M0gp1@vger.kernel.org X-Gm-Message-State: AOJu0Yx9wonhW5R8V1Q3ZsfbxIdZ/vSbxYOc54Iim7uY7et5txwoUeoR eDD++zAtsa5l+bLN1OQumoJe+3ftIeWfs7hfaalNcwD/RsfQt6wsX1Q/jg== X-Gm-Gg: ASbGncu1yHPr1ouhrYe79V3lLoy3T+OWGndqzHhRB7Kusblsu6wGZkhFrhCLYMSSWxW gPk9OS30pqjyscNB5rBUhXRKbu9pW9+b7Qy5EE2bCcDYqe+nuALrR3pCtbeZnSoytl8Cpsru0ir rZ6NwKHKWljc40TsDY5UExximbdZzluSGNCub5NFLLrraRuiYQXykAcdwo04OO1jr2cXDfshEAq 4UmB7B+JotFTkaosDAjqVOaFAsSxBH91X40LlrWSuMAJMvLCTOO9qUCIWghtpwo X-Google-Smtp-Source: AGHT+IFB+GCdkVxES2VCitBds6dMudZWunGB0HpJM9yyZDv09SNlFEYBf8sf4EG8BIr+4rh1PnSGyg== X-Received: by 2002:a05:690c:6b02:b0:6e5:9cb7:853c with SMTP id 00721157ae682-6f5312a2e9cmr290416457b3.31.1736987315753; Wed, 15 Jan 2025 16:28:35 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:35 -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 v4 16/19] ACPI: platform_profile: Move platform_profile_handler Date: Wed, 15 Jan 2025 19:27:18 -0500 Message-ID: <20250116002721.75592-17-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 857960 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 51D3216DED2; Thu, 16 Jan 2025 00:28:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987321; cv=none; b=dABSks18e8ChFC6jBt775RRTj2euqIgRBcNtIlaZLhfXuQXhGdiE4FnIrpOK2glplkHLqXtycqWdM12oCO0BmrcitA6Xyl8epjgIKRD1yDpo8MzFzef46NoEhKYJ8/m5429I5giSRrbe4Ce/njFNXwtsHo4IXhkID+qz93ogNoU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987321; c=relaxed/simple; bh=c7WV89U2MFpgTdLlwzo2lJbFtY/Q/Ya4Y4LAGRPh6fQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bhytsJiQBhJoMA41lOhWIERi1j4BPYHMI4aGfFwW6/DzlBpxKBn8I5ZhA6tjg8NDYtNMcHlvrwSlY3kHVxDtoZDSxEsayrWEKNWriiylkqXIcTh1yD8DON7uZnndABvczl46PMePC6vIzB9RSVXjsK8d/4tFYQUh4uiJ5fjhGIE= 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=S9/LKaHO; arc=none smtp.client-ip=209.85.219.177 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="S9/LKaHO" Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e5773c5901aso2589026276.1; Wed, 15 Jan 2025 16:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987319; x=1737592119; 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=wXguU2fUVOVkIHUYVkPvywDE9Ssyzuu+IyFpXxSYJ3M=; b=S9/LKaHOIiJUZQ6XIrvwWzsNWhJlTPo6EI40Se7H82+FJrDMohvjrcw1lQabKugHUD Bl576W0dzrzw7jtvvCH/+GYvFzdTZ2Y8v+p+SFNbMJzJ62DRRh2aYFXISnpCDh494Hrn 6gbDJwkua8yhI5wIrpJz8eSBVl2OXiVwUg9toL7SytnrT8XuryJblLH1yFSgYVgFYV2w CNFXBegcp8vL1qeUTinG+pSdcyqhzFMtr+2LmKAI14S1/HKQ3rTrXnMiqUdzeAhZ4Hd3 sMEgrp3149D8hXHDoQcdSmDYLYPt7IzVyGQsxOjNoReAavIZszBEjc4yO1Sl7v6W33KX EjGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987319; x=1737592119; 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=wXguU2fUVOVkIHUYVkPvywDE9Ssyzuu+IyFpXxSYJ3M=; b=vGYcipFmYJDMDFJh7M01L7B9nNb4xeKW9EWV0QUV5CA5zIo6KaMvyAb29qvvphz6MY wLPY0lsxtHa8yuicPc8ucLV/VReqO72AuwYORe90DbBL5ivwaRX6EL7MH3WPt2/h1pm6 fU3//EVNgHSAtvD6WhWWfUuGJVU0y/DY/q9Je9utCeC049bCPCuFyYsHQN9R8tzr6YKd DLgwQuOFVDkN/dYJo+9hi0m4w6/gBxWLZPhkMeg9U3tEDZ/G6XFWzlI3xXN9nLcM0fWm flOK5YLGYpvnqwq7iY3xmi3KQRiM/ZqGj7/Lxzy44HWMekpSFTRMTC4vSAuBMsqDCdXe v52w== X-Forwarded-Encrypted: i=1; AJvYcCVsACaG/4hDxJ40uckuf5vo1GNwh0TfrOzyk4i0xXv8h7c0Nk2ydtMjrguulSlSzR051a4kvZ5Oy33R@vger.kernel.org, AJvYcCXXeoh8DCJIQ+dta1+Wmw03YKWcnMy5/ysYfWt+bj/nwozmNtiWRI0eqdOrA+TkXhLSBfAMfqPkUz2LfeSB@vger.kernel.org X-Gm-Message-State: AOJu0YyqBU+ss6uMpJuVjPhWSDSqtJjMpBso9Y6a67SkKZEl4/ymud0y cw3FMiJ9ZyhXq+zGPvZIuuryohJVSJ/N/Ka6H8BQogP4A9xqVlHTR+S4cQ== X-Gm-Gg: ASbGnctTcIB2rRnllSLBIuE2yYdjuyh4JVYd8PiYdTI7trEHNJOurLnM2+xz7o+GQ7Y rgv/G7ygWFohd288wX0sCc1MXNmOlVSMhPQqKZapcFuhhAGo0ReB/kZ+ig9/9jMm/D19/2bWvJC q3X0I9psSzkiDOCAO/DqRueww7ti6CK/SQzurkffk4ek20tzlvpOFRSX0kGdW5wRqHhj0ULq6kK few5NQo94diYr4f2uLwVm/mdEyNjdeYwMSpjqQT1YlArYBG/R1WuPnRUZ7ZSRMf X-Google-Smtp-Source: AGHT+IEGB2pWdkEriTpziMDEYcLoWSBr5x4o4A+jOtKgsvzN6lUK2pJa/tgarYK8DqJag54CL46pvA== X-Received: by 2002:a05:690c:4b09:b0:6ee:6a2a:a517 with SMTP id 00721157ae682-6f6c9b5490cmr47162887b3.18.1736987318984; Wed, 15 Jan 2025 16:28:38 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:38 -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 v4 17/19] ACPI: platform_profile: Clean platform_profile_handler Date: Wed, 15 Jan 2025 19:27:19 -0500 Message-ID: <20250116002721.75592-18-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 858286 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.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 8C09C18BBBB; Thu, 16 Jan 2025 00:28:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987327; cv=none; b=MCKTdvLKgLkSAB3ljjne6i3/wgVEH3uIODEvXn37HxxXJxg6eGIV16NLbnWEOAYKRas4Udi++tZSrET4hQhSmgWAuCAme1ItyyKNNhgZbSXLwTJaPqitTqPYalWtnb8u44jK273KZeTpb/ez/nliFyh40UeVarHvsIl98YPKqaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987327; c=relaxed/simple; bh=tvFFc9jqSfi146uWkP2FXKO3n1Nu/sE1ZirXOELT5ZA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=puK2vlZElc5HyKFjRJHVV91ajYT/eQylwFT5/GgMbt3Iw43b5yYp9n5R3PwXPqPMCAqqtAof+kNBNdSXiGDHlAsiQNtwh9GZI4J/05sdY1v9dp3bpGGnHpIRmoqX2VWS5hmg3zFpmpTtq6kf3N0M3j1QnFJlvcBJvk7ftQPHN/s= 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=nh3vWglK; arc=none smtp.client-ip=209.85.219.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="nh3vWglK" Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-e4a6b978283so2727692276.0; Wed, 15 Jan 2025 16:28:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987322; x=1737592122; 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=nJvRoioi4+8IEM/VbOOhuABFD8jxGM+2C0L+Rta5w6U=; b=nh3vWglKVx+yzYtbLWSXHcnysUSjpl4U8YcCbkeqUU/ZnlTjQib83LCw6goBzLQzdi jaVSXhwB6CB6M0qMkqXoirjFX+FWjyvC7sqRCEb8ERNN5O6yHsIVn6XnBZ3JHkPXYTGH gODwNUmsDCBC7sIRq8A6nQzi/0c8YTJXvfYjCAmWpOMbQNlX3dzC8WsHc2+PbZJ0GdJJ rJmWtCZawQiiDqhIwwJOApCTFeL1to6DQ8pd1iyZajXVtjNasZr11yIMvmfHhXiVhhB3 WMxsQCiDAArlnG582F8wAtbHls2zk3CMdeCfcXVuJ6Xo9EZHBJKJ8/w58r5oYGu+5nDa ZVQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987322; x=1737592122; 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=nJvRoioi4+8IEM/VbOOhuABFD8jxGM+2C0L+Rta5w6U=; b=nXmY0j5e360PxN+unZ7NYOoX7Txd4G4w9hT6Sca3tEG3nOAvKomqssR1YGDFy0TeTE YjFiat9CHsrnQnnwhiUgpjasQsiyMXXuPbCFsuhaIsX998flxahYjjYqwGmgSBnpgbbX HvI7h9OrN22+QhFa865UDPwvQsZV7ux5t3j/Qe8W4qLWp5ycns0aOveqQHY/JSe/B6to zWmJmbcHwgZntSj148BVDx7kiUaM3jUi+V2YFutX8UcuUZuCK60SwDnM9AraZW6Th9yf flB9k3kMfQua4tKPDaWJ6JLF+TeEFSYuCW57wCDo3pNcft7O+Yj1Tq+D2IpRCxqmZ7MY XLOg== X-Forwarded-Encrypted: i=1; AJvYcCUiY4gQ4DN5BXJwNGFDrvKDGt/2vsqHgi2f28EgYkbMn+ZKXLI8r/Fnr/2WozD6mOMmRvbUlzi7AP69@vger.kernel.org, AJvYcCUsoRkPRvsNuE8PJfHRDRJEDw7G7Y61f/XHOZmN+U051wb+bNk09nnRqRV21ZU3H1AwNwr8Cey9XId7p21g@vger.kernel.org X-Gm-Message-State: AOJu0YxIbmCTIHo9VD6FKTDnyOvT0xZCsH6SYTfhr/KpTu9Dc11SW4w4 TiPuQ+dq1xIDWVD4L8VnDut1cS9gCHJp8PZSMpQXY6XfeOHF5CqLFQ4Xjw== X-Gm-Gg: ASbGncvifqiEv88k3MD4ttJqR4bz4a6tOSiXqPVO5r07Y0KFTsDA4EYeaLh6Mycpr58 K6rxyLMY1QZU9dR8KN4Hl+ri8UhJ0Jj99jV7api+gjELmw4bynVgW3tSvm7VDwgISgFF3dbPGr9 N/aAuaVE1Ymp0BaZgj7OdAXy7nQ+mAGrghL3R3zJ60cZ3lCn7zhwGJr90ynMA1GO2dS+YFXGKHf qT0B/36UNwC6Q0fxM5Yw8xVSG4yPgHAc2YVkEdygNHzwu9x9CAZOcqMgB1M3IXH X-Google-Smtp-Source: AGHT+IGl4IYz/3yZadUUvL7dAbHAgHSNh1Rq3g/psvGcRO3ocvXjxYeg0SLdnVoDeEY5rZqWb3gtDA== X-Received: by 2002:a05:690c:c8b:b0:6ee:8515:6730 with SMTP id 00721157ae682-6f6c9b700bbmr38197427b3.17.1736987322337; Wed, 15 Jan 2025 16:28:42 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28: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 v4 18/19] ACPI: platform_profile: Add documentation Date: Wed, 15 Jan 2025 19:27:20 -0500 Message-ID: <20250116002721.75592-19-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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 Thu Jan 16 00:27: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: 857959 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 8D64945C18; Thu, 16 Jan 2025 00:28:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987328; cv=none; b=WAY+kb9JJKruNktd3H9iRF5bmll7T5GdkbURwVmO7gg/CuG3s/tKZ7ctig8leZPO0Q+mF5GZQWCp07QGjuc/967H3tPaX2/myu7f6+IdozImv5aIuQ/7NVCCHrQS0MSihucisyCEP3FsjztKDkCiUx65CXbUqaDVmBemwztDaaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736987328; c=relaxed/simple; bh=tf3agz/yQ4+YuVcUo0n4xHxtsItY/QfcfG6wSMlJ3bg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZqXUgeSCpqV1lSiwAKrEPbdJLAvvYpCV8/vzK8c5sF1MHQUBZe+GT24/7yTw3GDosGT8Ybt0ZEB3gep8Hhkd/9J2LslHS5qUkaeHroEIsuErtDNDHr0WjMF0l4BCIsvv8CyBJylp9p30EiP91wTSTaYTf7YnQB6d1rfA9O02ENw= 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=LdYXUCis; arc=none smtp.client-ip=209.85.219.174 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="LdYXUCis" Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e545c1e8a15so643139276.1; Wed, 15 Jan 2025 16:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736987325; x=1737592125; 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=XGfpz1gJR0mzcUohVKtWrM56Xk5GG0gK5qV9PX6GMzY=; b=LdYXUCispaqyZTz9BUfA8dRD5Ih15zg4tUWXPokU5KVfKyoIh5P7/cz9LCBa0ZHfsi m76RPB7a/09UqAexKB00Fj2ktDcLYPeh+GLPCUQI7T5Ao2OL/0YhfTnrM2SmDrgzO+jQ UvmHvVjOEEXCz23hXMKXBYK1NPb6QhGY3dzaim7XrV1Fj32cnHh3biDIsj4UuQ+cZhQj GaXPdrtlUu97LDqVY4YYCqN9ALrsfMwDnwKWPsNYU978d8+rk5ewIjWv/Q3fjzVRtJJe ukP/NHui31tPWXu51Nyr6c0wuxSNxf9ln4liqzlgasVZchHwG+d/4y6y3S+cVfY5nMDP ECdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736987325; x=1737592125; 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=XGfpz1gJR0mzcUohVKtWrM56Xk5GG0gK5qV9PX6GMzY=; b=RKdSVMQNVdoWxpZvA0TReL1Cfwy/rQNrp49ueWO6LNeIaYx0r3LVnyLAEwN1mX+1sP FBuAHfG74OQkiqqm9q1tpnhELvxzvA7j8sXy8IADDlCGvySdhkoGa/5L/Nx4PA/TzTqY 77w96RY60y1O+zkniNTCoitG6ylHcrIVH9e1SRH58ycSuN8B2vJBmdCF+mPtWhPInPRa 1Tns57/GprrtIsGlF2puIjhX4XbHsU+JLczYRg71KReHs6Rgl5M/mQUlRizNNorw4Ti5 uekDtvH9SLDSjQB/kMA9ebIPlInmhBqsiNgga1fRrukdqOxdha30DLDjBDXkRYwrhluM Mb4w== X-Forwarded-Encrypted: i=1; AJvYcCWLadHvWxAQjZZdyqs2NaHncAVMayKC/7w8M1od+tpG7BmukqSuQsRkF6bANZV8K3mFKHzRobF/VbYFo6WC@vger.kernel.org, AJvYcCX8kqjFB6/ZWjqsf5QrJg0PPEa878eOz6QoLwafHyOMJZ6tFn43PyFVgZUjCNOuQOlLS8Ko+QCScO2u@vger.kernel.org X-Gm-Message-State: AOJu0YxboiPY/CF0EcJq9jS5eGUn0ehfcW6gOiZkugo4tZDOSRtk1yP1 KiXBozTTHBufSkz1tzIhdwLWL3YNNqkuyphLsI+pEL56zg4fVzdYZIo/Zw== X-Gm-Gg: ASbGnculjW88I2q13XJt/cps7IQKtB2TjkF5qUkP/pvZRhpAxdu8Wt+LBFUw1V09Uve K6dlYUpDBrT6z6LZJ7iLj4cLunBd28cWjCopabM990wZZ4fKbpGLv1wBj2kIISiLMzsRR+FB3Ok y1/p3p2rRcT/dC7y1drhOH3JmS65vJDU6un6Pmi+CVJvE8jetAePREWTuEext9fW9nTTc0mMvuK x2UgwsCAwF3NGlRyRLnC68THHQ8XfhZpl1QTa0lo1A5BaIS5cHz7/zz5w6dGqjI X-Google-Smtp-Source: AGHT+IGAkkUAXoV9MV6VA9Y3fdhemgc2f5vcqxgNw3Qy77/rTdlluZm8ul8MV4scM7E/OSwkoFMHtQ== X-Received: by 2002:a05:690c:c8b:b0:6ef:4fba:8158 with SMTP id 00721157ae682-6f530ef3e96mr260308657b3.0.1736987325443; Wed, 15 Jan 2025 16:28:45 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c46bdesm27229077b3.50.2025.01.15.16.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 16:28:45 -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 v4 19/19] ACPI: platform_profile: Add a prefix to log messages Date: Wed, 15 Jan 2025 19:27:21 -0500 Message-ID: <20250116002721.75592-20-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250116002721.75592-1-kuurtb@gmail.com> References: <20250116002721.75592-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. Reviewed-by: Mario Limonciello 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