From patchwork Thu Jan 9 15:06: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: 13932782 Received: from mail-vs1-f46.google.com (mail-vs1-f46.google.com [209.85.217.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8832C215162; Thu, 9 Jan 2025 15:07:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435278; cv=none; b=c8okXu2hMdntq0rYbgCspPZfxPpSSOA/6AdsNM6/MUDI3oPwxE5IhP5cq8ykyVSEkFd9+R1DjjjA313kW+94rOrj7FeVjcEOWpYs+2G3F1K5DzSzD8qgmLVJG00Ga5Huz9+wYOsbylnZ1H3FMfQDoqdT/xPTLJ+jx3g2UHSDGgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435278; c=relaxed/simple; bh=QuDC9olJP1pupf4cEnH8ZTzBo82H5X4uKF7YUC/eND0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=orfHHsWnuCosCk+airFX25pV118138Oj8zV/PEmylKd9YSFyxpsqjJP9wwj5wks7dId6B5Q0kKi/lc6nUnQQALVwplp6w4bDER8AJsxSUXSeePx0/fqyVpD63E7/YViiRm3Cr4TI4A+UHFi4jiZMQUS11iPQxTyQYlaH5Rz9oUU= 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=Fw8STjil; arc=none smtp.client-ip=209.85.217.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Fw8STjil" Received: by mail-vs1-f46.google.com with SMTP id ada2fe7eead31-4afed7b7d1bso379483137.2; Thu, 09 Jan 2025 07:07:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435275; x=1737040075; 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=XgHdvr7181OCnJ8fFRDqSKuSAsUo7zC8uwySsOgNu/E=; b=Fw8STjil1l6wt5xkoCpXcXyRMThhYvCMZ1INo62D0MfRQ22Irja/DUvFgUcbSktRjS OkdWvfczlVjbpp0OUt69RRms6dKqtK/R8tpNmv9HHfauNPPPGEQr5S0GtZ3nbUJNp4Ku yavrqnWULhpUBanKb1puSavYIjIAbt09LxgKif1RThhAeuBkf8AK5tYwXqmXAbMxekgA 7q8/y/zzQdlSb0LIcSYYOcI49D0yWayOK2iyU/c14YJJo4CaVNFgK8gM+hr22VJ7Kef2 NoayyIMKaDYAk9N7NfYz3JzS9S/7+XhaiZTJ1ytgp8Bw2yGYeUy5wPsFfh2KgOLuy/Ij wrFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435275; x=1737040075; 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=XgHdvr7181OCnJ8fFRDqSKuSAsUo7zC8uwySsOgNu/E=; b=D/S9+S69vlhik70ywUpKxHUZ21q6Vq7TingZYos7R64o3cBPK1XYexexEuuV1KtC7U BVeJIx8vJEnKSvfECiVoFXeBtF4eCvSpp+2w8ZIJwmJBqU7wcIgD9bkqhrA/OEsCuFab j2Y1MrcCTV+MDJXNR1g6LM8CD9Y7vQ80CSwwxiFUV4dDTS1y5K5I+ss1hXYVUguQ65QZ 8yUWRStDSOz7L3CTGK/OCOHLBJ21uwey/FDxifg1lR8EMaZUrHZT09AOhY7IJadfARkZ QfsIIgou4dgTr4WWXm5GZ8yS44BF1XD+ED6DaKOUW3zIioNdA0kfSaybzryU2P1al41p 0oGw== X-Forwarded-Encrypted: i=1; AJvYcCWRWwpGTBy5/6CE+rt3ChDdDH9cIkQJS7kkWoo+Ib9edi78y6X4I+GdZkIp6yWBDfjdlL6vJsr9g2srPwWU@vger.kernel.org, AJvYcCXfH0/fs2Fjsyp6dddgVYRy02uy9dlQheXbOZqNC7HPMZD2y8e5tf8EBH8BYAiBn0TfPopy1dzsWgNv@vger.kernel.org X-Gm-Message-State: AOJu0Ywsy3Wzr3YtwyXYGk/k35XitZGTvrQ5kKqbTeA3j3vgPo1pyooE eJNV8LWS8fydWYyntAumbKXZQuEADjBOt3JeGnk9iRRCMPnCkVAZO8KoDSQf X-Gm-Gg: ASbGncsdONXByHNPt5K/z00Spxr3eLpH/yz33LzvY/LGn8CLDHnzsc5QbJz0r4tuQi5 xJhgPvUfs5illjIbVVv4z+V8lhZXBT2XFRvfboOPOc4ek4HYYV2WOS4H+TTOfd/wMQ39rZ++kiK wNEUvQEPwje4NLxMD3cBCpAPvBvoS5INxM+XV5lmh4Ffk+wdNMxb6FcQrBFlcoYjZdbsEXjDNJP q1SJX80rXLK3cipjB+27b0jr8bAt2qejUumeSHXpaYjiZ9SS2hefjIIWJpmhTfJ X-Google-Smtp-Source: AGHT+IHVcrKUi7wErwOfwZpS/PaRFWvaghQ5ibM4XLj21ds5s29oRt3+lCg6lLFKavl2+qdqlzbt3g== X-Received: by 2002:a05:6102:c90:b0:4af:f740:c1b4 with SMTP id ada2fe7eead31-4b3d0f6193fmr5928394137.5.1736435274889; Thu, 09 Jan 2025 07:07:54 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:07: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 , Colin Ian King , Alexis Belmonte , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 01/18] ACPI: platform_profile: Add `ops` member to handlers Date: Thu, 9 Jan 2025 10:06:14 -0500 Message-ID: <20250109150731.110799-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- 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 | 14 +++++++---- 12 files changed, 86 insertions(+), 33 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 4c4200a0b1a6..39a22e27acc5 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -64,7 +64,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->ops->profile_set(handler, *bit); } /** @@ -101,7 +101,7 @@ static int get_class_profile(struct device *dev, lockdep_assert_held(&profile_lock); handler = dev_get_drvdata(dev); - err = handler->profile_get(handler, &val); + err = handler->ops->profile_get(handler, &val); if (err) { pr_err("Failed to get profile for handler %s\n", handler->name); return err; @@ -465,7 +465,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) /* 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 6c87e982bfc8..2a9716372d56 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 platform_profile_handler *pprof, 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 b3043d78a7b3..ac7b3ab8fd2a 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1900,6 +1900,11 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof, 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) { @@ -1907,10 +1912,8 @@ static int acer_platform_profile_setup(struct platform_device *device) platform_profile_handler.name = "acer-wmi"; platform_profile_handler.dev = &device->dev; - platform_profile_handler.profile_get = - acer_predator_v4_platform_profile_get; - platform_profile_handler.profile_set = - acer_predator_v4_platform_profile_set; + platform_profile_handler.ops = + &acer_predator_v4_platform_profile_ops; set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices); diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index bd2bd6cfc39a..7c8391ac4dbb 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 platform_profile_handler *pprof, 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 fdeebab96fc0..ef4129d91656 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 platform_profile_handler *pprof, 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 7b3ee2d6a23d..c824414565b6 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -1108,6 +1108,11 @@ static int thermal_profile_set(struct platform_profile_handler *pprof, 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) { u32 out_data; @@ -1154,10 +1159,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); } diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 3797a5721dbd..1751b7235031 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 platform_profile_handler *pprof, 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 6d6e13a0c6e2..c37e44f7606c 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 dc98f862a06d..b49ee94f9bee 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 53af73a7fbf7..38d4745f6be1 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -166,6 +166,11 @@ static int inspur_platform_profile_get(struct platform_profile_handler *pprof, 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; @@ -179,8 +184,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 f51662861738..04a292af2bfc 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10538,12 +10538,16 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, 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 f1cd4b65e351..a9db95bc360d 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -27,16 +27,22 @@ enum platform_profile_option { PLATFORM_PROFILE_LAST, /*must always be last */ }; +struct platform_profile_handler; + +struct platform_profile_ops { + 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); +}; + 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 platform_profile_handler *pprof, - enum platform_profile_option *profile); - int (*profile_set)(struct platform_profile_handler *pprof, - enum platform_profile_option profile); + const struct platform_profile_ops *ops; }; int platform_profile_register(struct platform_profile_handler *pprof); From patchwork Thu Jan 9 15:06: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: 13932783 Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53DED21CFEC; Thu, 9 Jan 2025 15:08:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435285; cv=none; b=DtL6wOX+6eJiNtUP9mk/D4hoc90ExRw5dtqv3q2yiiBgUs86K4U/WODxaj8pxEqI5vtCy84ouWj9pzYG3v1zsA2/L2O/rphlT7KDnF63W7wdMBSjB+XyGYIbflR5zU0B5FMXWPc750oUs40Noj14h6Kcm+PntQfkrkNG/ugeUso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435285; c=relaxed/simple; bh=rRetxo8v9LWZ8uozl4d/SR2xB+xG/A+f6yMZOFXQVnI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JPT+ERr0cOdWtsaKcwDdceqX9ueahD9Tbs4q1AzZ0KBwz9hRfm5sfrmGJPc1bdrPk+ngN7Ga5gG3GXr+AFMNtT9toIkheiuSbyQpvU8o34DYMoCi8CMV3Uo9H/Zd+b5SsJjGcGB/zOa2+5N/Jma3HMvEmCzQ95Wg04XXgOoTGI4= 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=ntSwJ80r; arc=none smtp.client-ip=209.85.217.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ntSwJ80r" Received: by mail-vs1-f48.google.com with SMTP id ada2fe7eead31-4aff5b3845eso467667137.2; Thu, 09 Jan 2025 07:08:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435282; x=1737040082; 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=X7/ilE4wKe17fP2dMeHsDJvp4dxl8L2B6sowIvQLZLk=; b=ntSwJ80rBR15JdnLWZblCWREltpzXYcM328rDvf5GetBu3taBfs61TEMbYm3BUeMB+ qBKo1n60tHcJENHFVaenCHituaGA+KCp7KJCnmjDXOS/E5OA3kOtZt7RM5R4bGwULyQS VRdz976WASSSlwN1wwNVCxA4qW0AlS5dthE/ZgZVa82puVt2yHqLPpXGRXYstSQG+Oam d5hjDX4RuDkVdKFhQ3Wg+x2Hl0jH4w/0KNEZKqnKHbvYCaZhetp2tl03/CJ+IbWsWA+G 7DMe/hgb+jsLLn2yheXgqM9iAQmMXv0//mzH2+zyi1j1pkVGm9B79hN4aI+RjZUnR/LY mmow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435282; x=1737040082; 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=X7/ilE4wKe17fP2dMeHsDJvp4dxl8L2B6sowIvQLZLk=; b=nH3GPmr4bDh4WxsxKF+CD/rRtQ+tbIHI6pb60JZSB/Yh+80oIL8jRoUpZDt16RvxCO An5UrCnqUZM3uqwUIaGuJvBzNSRHEid4jR9ngIMG+oYn0bi4QMZn0OdDtmqbM3+k1vkO p6I95zyVCb0VdjU1Tw/4vIEkhur8eePwmT67WAxsUtIz18S9JKLjkUDKIrb5NbNDlbES nlzFNjR3aBOzkjaQXi/set6W7C5ESoRQR75BOb6k81nlA/MOmcHhs45n5TrZLurnvVY8 d5o63f9bbOhW0iym4R0Fm5Yiv2z7MnKNw7fYw3Jha18zLA7yXxdh9VZCcOMAGkzhLd67 Y+mQ== X-Forwarded-Encrypted: i=1; AJvYcCVAIPn+gkbRyJODVk9ZtIeC0HI9GB9SI+xafgBZXYLpOcmt7b9IBcGLe8Xe2YpQTA23nT2p2KHeNUzY@vger.kernel.org, AJvYcCWonTIeJaoMtzm7M1WXQy0WUzwWrFqWjP9gzJm22gUUOoEUoRUvzwdYYrKO0LWHSqBI2auk40Xh/LVskJYL@vger.kernel.org X-Gm-Message-State: AOJu0YwS0z57r+Xv2Ikuzh6Dy65VGVOnRSuOTLMzKoOlSJ45SLPnIBQZ LVgfxbCRZ6lgC9Gl7f1V4tOooYNf38zFGLQu8f/LtjjaOAPbV5kjke22bm/W X-Gm-Gg: ASbGncuxOehSki+IMbt918mOv6lH/9LuoYzDKGO1HUaJzSQCFpwVfWgjOQIeCunPTo5 p14WG5UNLa+OIOGkc6LUp2jILPSBdagVXN+dRCw9todyJjbm4Imf9Gr/TXUz058X3V6PYmvdPAq IokaSSFcRBjNNGfZaXjKfG9bEkoHm72RmKOS7s/3n0e2fhBtXPdlAbMnItWSrDDWjFcNiQLqqAy 08+V/Atm3pVlD4dB77eKy6Ldd/u+D80342iNcxoC/NEq+qN8oC+skNplLILZIfm X-Google-Smtp-Source: AGHT+IFguFKf1b92s0mVyF7N4sniR6KrG7JkdNcMGWyYMmpLnYoCmUSh5BO+i26XkRYHZZrb0D/tZg== X-Received: by 2002:a05:6102:5128:b0:4af:a98a:bd67 with SMTP id ada2fe7eead31-4b3d0f619f7mr6263797137.3.1736435281416; Thu, 09 Jan 2025 07:08:01 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08: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 , Colin Ian King , Alexis Belmonte , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 02/18] ACPI: platform_profile: Add `choices` to platform_profile_ops Date: Thu, 9 Jan 2025 10:06:15 -0500 Message-ID: <20250109150731.110799-3-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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 `choices` callback to platform_profile_ops, which lets drivers specify how to select available profiles. Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 13 +++++++-- .../surface/surface_platform_profile.c | 16 ++++++---- drivers/platform/x86/acer-wmi.c | 24 ++++++++------- drivers/platform/x86/amd/pmf/sps.c | 15 ++++++---- drivers/platform/x86/asus-wmi.c | 16 ++++++---- drivers/platform/x86/dell/alienware-wmi.c | 24 +++++++++------ drivers/platform/x86/dell/dell-pc.c | 26 ++++++++++------- drivers/platform/x86/hp/hp-wmi.c | 29 +++++++++++++------ drivers/platform/x86/ideapad-laptop.c | 15 ++++++---- .../platform/x86/inspur_platform_profile.c | 14 ++++++--- drivers/platform/x86/thinkpad_acpi.c | 15 ++++++---- include/linux/platform_profile.h | 1 + 12 files changed, 137 insertions(+), 71 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 39a22e27acc5..9cb82173947c 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -464,12 +464,21 @@ int platform_profile_register(struct platform_profile_handler *pprof) 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->choices) { pr_err("platform_profile: handler is invalid\n"); return -EINVAL; } + err = pprof->ops->choices(pprof); + if (err < 0) + return err; + + if (bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST)) { + pr_err("platform_profile: no available profiles\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 2a9716372d56..b69fcc4c3858 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -201,9 +201,20 @@ static int ssam_platform_profile_set(struct platform_profile_handler *pprof, return tp; } +static int ssam_platform_profile_choices(struct platform_profile_handler *pprof) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + + return 0; +} + static const struct platform_profile_ops ssam_platform_profile_ops = { .profile_get = ssam_platform_profile_get, .profile_set = ssam_platform_profile_set, + .choices = ssam_platform_profile_choices, }; static int surface_platform_profile_probe(struct ssam_device *sdev) @@ -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); } diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index ac7b3ab8fd2a..1fa0cd69da8c 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1900,9 +1900,22 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof, return 0; } +static int +acer_predator_v4_platform_profile_choices(struct platform_profile_handler *pprof) +{ + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); + set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); + + 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, + .choices = acer_predator_v4_platform_profile_choices, }; static int acer_platform_profile_setup(struct platform_device *device) @@ -1915,17 +1928,6 @@ static int acer_platform_profile_setup(struct platform_device *device) platform_profile_handler.ops = &acer_predator_v4_platform_profile_ops; - set_bit(PLATFORM_PROFILE_PERFORMANCE, - platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, - platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_BALANCED, - platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_QUIET, - platform_profile_handler.choices); - set_bit(PLATFORM_PROFILE_LOW_POWER, - platform_profile_handler.choices); - err = platform_profile_register(&platform_profile_handler); if (err) return err; diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 7c8391ac4dbb..37316bc3e071 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -387,9 +387,19 @@ static int amd_pmf_profile_set(struct platform_profile_handler *pprof, return 0; } +static int amd_pmf_profile_choices(struct platform_profile_handler *pprof) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + + return 0; +} + static const struct platform_profile_ops amd_pmf_profile_ops = { .profile_get = amd_pmf_profile_get, .profile_set = amd_pmf_profile_set, + .choices = amd_pmf_profile_choices, }; int amd_pmf_init_sps(struct amd_pmf_dev *dev) @@ -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); if (err) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index ef4129d91656..3e94986078a6 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3852,9 +3852,19 @@ static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof, return throttle_thermal_policy_write(asus); } +static int asus_wmi_platform_profile_choices(struct platform_profile_handler *pprof) +{ + set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + + return 0; +} + 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, + .choices = asus_wmi_platform_profile_choices, }; static int platform_profile_setup(struct asus_wmi *asus) @@ -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); 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 c824414565b6..386b22e9c922 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -1108,12 +1108,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof, 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_choices(struct platform_profile_handler *pprof) { u32 out_data; u8 sys_desc[4]; @@ -1146,19 +1141,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, pprof->choices); } - if (bitmap_empty(pp_handler.choices, PLATFORM_PROFILE_LAST)) + if (bitmap_empty(pprof->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, pprof->choices); } + return 0; +} + +static const struct platform_profile_ops awcc_platform_profile_ops = { + .profile_get = thermal_profile_get, + .profile_set = thermal_profile_set, + .choices = thermal_profile_choices, +}; + +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 1751b7235031..ba366c28d9a6 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,15 +232,29 @@ static int thermal_platform_profile_get(struct platform_profile_handler *pprof, return 0; } +static int thermal_platform_profile_choices(struct platform_profile_handler *pprof) +{ + if (supported_modes & DELL_QUIET) + set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); + if (supported_modes & DELL_COOL_BOTTOM) + set_bit(PLATFORM_PROFILE_COOL, pprof->choices); + if (supported_modes & DELL_BALANCED) + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + if (supported_modes & DELL_PERFORMANCE) + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + + 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, + .choices = thermal_platform_profile_choices, }; 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); if (ret) diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index c37e44f7606c..3c2d4549eb7f 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 platform_profile_handler *pprof, return 0; } +static int hp_wmi_platform_profile_choices(struct platform_profile_handler *pprof) +{ + if (is_omen_thermal_profile()) { + set_bit(PLATFORM_PROFILE_COOL, pprof->choices); + } else if (is_victus_thermal_profile()) { + set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); + } else { + set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); + set_bit(PLATFORM_PROFILE_COOL, pprof->choices); + } + + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + + return 0; +} + static int omen_powersource_event(struct notifier_block *nb, unsigned long value, void *data) @@ -1568,16 +1585,19 @@ static inline void omen_unregister_powersource_event_handler(void) static const struct platform_profile_ops platform_profile_omen_ops = { .profile_get = platform_profile_omen_get, .profile_set = platform_profile_omen_set, + .choices = hp_wmi_platform_profile_choices, }; static const struct platform_profile_ops platform_profile_victus_ops = { .profile_get = platform_profile_victus_get, .profile_set = platform_profile_victus_set, + .choices = hp_wmi_platform_profile_choices, }; 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, + .choices = hp_wmi_platform_profile_choices, }; static int thermal_profile_setup(struct platform_device *device) @@ -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); if (err) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index b49ee94f9bee..f5ea03763a54 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 platform_profile_handler *pprof, return -EINTR; } +static int dytc_profile_choices(struct platform_profile_handler *pprof) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + + return 0; +} + static void dytc_profile_refresh(struct ideapad_private *priv) { enum platform_profile_option profile; @@ -1066,6 +1075,7 @@ 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, + .choices = dytc_profile_choices, }; static int ideapad_dytc_profile_init(struct ideapad_private *priv) @@ -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); if (err) diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 38d4745f6be1..8fa9308d4686 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -166,9 +166,19 @@ static int inspur_platform_profile_get(struct platform_profile_handler *pprof, return 0; } +static int inspur_platform_profile_choices(struct platform_profile_handler *pprof) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + + return 0; +} + static const struct platform_profile_ops inspur_platform_profile_ops = { .profile_get = inspur_platform_profile_get, .profile_set = inspur_platform_profile_set, + .choices = inspur_platform_profile_choices, }; static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) @@ -186,10 +196,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); } diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 04a292af2bfc..a35453c3c605 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10538,9 +10538,19 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, return err; } +static int dytc_profile_choices(struct platform_profile_handler *pprof) +{ + set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + + return 0; +} + static const struct platform_profile_ops dytc_profile_ops = { .profile_get = dytc_profile_get, .profile_set = dytc_profile_set, + .choices = dytc_profile_choices, }; static struct platform_profile_handler dytc_profile = { @@ -10584,11 +10594,6 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) { int err, output; - /* Setup supported modes */ - set_bit(PLATFORM_PROFILE_LOW_POWER, dytc_profile.choices); - set_bit(PLATFORM_PROFILE_BALANCED, dytc_profile.choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, dytc_profile.choices); - err = dytc_command(DYTC_CMD_QUERY, &output); if (err) return err; diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index a9db95bc360d..972a62be60b2 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -34,6 +34,7 @@ struct platform_profile_ops { enum platform_profile_option *profile); int (*profile_set)(struct platform_profile_handler *pprof, enum platform_profile_option profile); + int (*choices)(struct platform_profile_handler *pprof); }; struct platform_profile_handler { From patchwork Thu Jan 9 15:06: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: 13932784 Received: from mail-vs1-f46.google.com (mail-vs1-f46.google.com [209.85.217.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2047F21C19F; Thu, 9 Jan 2025 15:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435290; cv=none; b=abWvLp+GF1fUNlwh+YudIj/mHAZWJ9HUV6pcN8035DG670SFLbabN2/9ios9Y9pZLL7MwBwz2jwDA+IMg8XkbHs2ta/sT6y7W/ojrP9jxM3ZmM5u08z6Kui43pfkcuwQjI6Q7UqVOQ1ZtCkHYmbHk2jqq7JW6UTBxtTyMZJ/oVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435290; c=relaxed/simple; bh=kQ0xyOrHLHgqL4B8cNM5E02Cets2aU9OrgEWK0BVjpY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KAWlJc5PsNFqd1AYVEy4kfE/mrLxESd7pY0hOLDZ7Tp8tmKysFpfmopPmXNr55uwypXgeZS5sfne1T/IJRz4nf8l3UkOs70Iezv98mnXWmPQ31xa79/sOEbRD6QQ1BXze0gDb2Dp0DafZJog5WmNbOEO7AzvA4OBUHLwIi1R6sg= 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=OmqX0+ZJ; arc=none smtp.client-ip=209.85.217.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OmqX0+ZJ" Received: by mail-vs1-f46.google.com with SMTP id ada2fe7eead31-4affd0fb6adso361771137.1; Thu, 09 Jan 2025 07:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435288; x=1737040088; 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=1FO0DTPEiGjE6vOWmEKb4fddXaogxmmVS1xP1xC2Y+8=; b=OmqX0+ZJEJuzej7XeKFPeU0aR8G/IMWCn+LMqxpccgKix0usCn1zRwftnqNzI7I/X8 AF29SiF8ca5JgyHD8c4flLgpHquEO8r00n6HYTp/SGwCAr29MjszXSlITEEzHvu0Fimp +t+Q4FOU/aaPJRdkgYIIlLn4B6rRytKrNF7KI2LAqiWgu8sXy0kvSTKV2WzbPf31mVeI 2zeZBuA74CATNQC15deltFZYxxbheffPRR6TvIScXkOEBZLLOVhDav6ozGSJ0K4UmsvZ e/SW5kScTtL8Jl7WabC6eTn1jX87S9Xj48lSob2zuc4iEBph6+rAOrQpGJQvCBuCMvzr lNKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435288; x=1737040088; 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=1FO0DTPEiGjE6vOWmEKb4fddXaogxmmVS1xP1xC2Y+8=; b=sq7z1uxqdSyd4VyV5+yl5IbwNrzazhnc4AiRHEeIo/UlOSoDNRYwmQNzfF4fu01svM x/jVPOtJfQy8H1spHEsVVO4TuTnJhHMtDx2pt6bK9UyySgAQyxn7lKpVvEnjaFnnmpbo Ao9y8fQz24I2411xwqQGTmMQPoFaWP1TDtZT8DTJnf6cDn/pX2cJXMLUyroq687JM0h/ OhHeU58npiRvfK7tn4sf+S0grRi0JWkYFgnONYADlg2Y09+WStG4XP2B9rXBP+JPA3nk OdEzSJNsfMkBrLLm7AAI+sYHWOnifTE+dcztca2c4GHzWid/N9dRVQZXFCIJd5lETG6T ncTw== X-Forwarded-Encrypted: i=1; AJvYcCVvMN+/QewMuSCVU2PofaNSCta0S/2as82x4HIIb1pgE9OYA1G5i1OeT41Sh9FYdSevXvF7rG8oE/aO@vger.kernel.org, AJvYcCXs8YRcBMxJHMVnUytcSOu2K9JtO/4xjq06InKho4QPL7xLDlNlx0DIm69fUgpA5DgNaQW98gPVW3McXj7V@vger.kernel.org X-Gm-Message-State: AOJu0YzwUeo6qgInSCjckfXIsePFaWc2NIqBvX16e790Fec20jozlQKG 59yBGhmf9CFou+vUGcL4XfkTcPT2X0zVx8uL1QCNfTL+Gmgg+7Zud//L8Jd/ X-Gm-Gg: ASbGncvVDEqW0T5VIsE/TydiwlJXcU1ZiWUmtXM/01M5zRkku0/nj0aTI95PgGaePfQ rcMuTPm3XZ8ACQ+b0WvCyTN8sGPT2MFPb0mEn+W4EvDBaBp8VyiVEO2DH9/u8/1YioZOHCz9PwR 66ERGEPewCgIHugMYTC+VGfn8oWFJnM8yMVuXzJj5aRMGYn1f+z0Y+f7h0Vn6Zpuh8dcEIe6xt4 EEnsObDU8SXUjt3V3AdpjoNdzT+ZQMH7eiz0MTOwkzyABCtWvASVLg3f7KdBsNG X-Google-Smtp-Source: AGHT+IGwteO2+oDnS4b7ZTJBs+pRAvKcXQBYzvIhgrDoQ5ggqeRAAPmRQBG7yUgUqLG97vOfhndg4A== X-Received: by 2002:a05:6102:94a:b0:4b2:bceb:1ac6 with SMTP id ada2fe7eead31-4b3d0e5f60amr6393154137.17.1736435287619; Thu, 09 Jan 2025 07:08:07 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08:07 -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 , Colin Ian King , Alexis Belmonte , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 03/18] ACPI: platform_profile: Replace *class_dev member with class_dev Date: Thu, 9 Jan 2025 10:06:16 -0500 Message-ID: <20250109150731.110799-4-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 36 +++++++++++++++++--------------- include/linux/platform_profile.h | 3 ++- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 9cb82173947c..3cbde8dfed0b 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -10,6 +10,8 @@ #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 +62,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 +78,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 +102,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->ops->profile_get(handler, &val); if (err) { pr_err("Failed to get profile for handler %s\n", handler->name); @@ -124,7 +126,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 +144,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 +231,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 +412,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"); } @@ -485,13 +487,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) goto cleanup_ida; - } sysfs_notify(acpi_kobj, NULL, "platform_profile"); @@ -502,7 +504,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); @@ -517,7 +519,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 972a62be60b2..f549067539af 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 /* @@ -40,7 +41,7 @@ struct platform_profile_ops { 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)]; const struct platform_profile_ops *ops; From patchwork Thu Jan 9 15:06: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: 13932785 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50E2B21C19F; Thu, 9 Jan 2025 15:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435297; cv=none; b=PrsqqRQmvQcbNICmTGngTIgUKn1JGcuZGUhPNE5F6wtO6XFMYd+WNCYDSo8EP4mf4wriIp8bEW3ot99FwJ0kJuvy3dPiyB+pyx88NtG9d5zz0yHVLxEZsllSq7u/e3WAvpk/3A6so4J2fGuZJFAEEcdWzb0uf49MBp7zDUqlEjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435297; c=relaxed/simple; bh=kwXBt4b3+q4Y39p8H6JPM3rIsgMPMUcZC/17KDplxYo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iJzuzOYvkVAwSboVYtBX7sQMmuEX2RsYhSb7KumKZZCjpj6t38txuALCzL5Nbr14yWJiL6BWhJZ7774qcIMNn+6/5KqqgMJ6XVv2sxNIQIo3TMc3X27CjR+U/cd56GWl84kbIaZIj4Hmj63pye2D6ZY7yohdjTpnbS7rEcA+S+4= 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=DzeJ/puM; arc=none smtp.client-ip=209.85.217.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DzeJ/puM" Received: by mail-vs1-f45.google.com with SMTP id ada2fe7eead31-4b2c0a7ef74so656216137.2; Thu, 09 Jan 2025 07:08:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435294; x=1737040094; 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=DKirfVfr3JrJ4phvSlQyJq6q5S3I1b+zwqhd331cro8=; b=DzeJ/puMoUjUzSPzdIaS8G2A0kD+rLVwo5gJur3s1Bep2GseSczmjXFH8dibH8RBp7 +bBYILCEYVtbJj7rbtmrvxzdzxwvlvswRw2y/Nd9+EBkAalMALvf/rd9h1au8ydDg5Rf hxP7iK7r9Lleof+2/ztWcnJHKC4jb9brh4KtLvIgfDHrCXcJAtNRTZaaY6gOW7GBe1+e p3lk/juuswDhug0815zfbrAZNkfz1gcdYNfK6icGgQwbVjkfBuwY06ICfoG13xbei0gW RSmu1vb2gFq2+6HL7B+8FHABEsDS3AOp72YGvzWWERKeXbiQQXLAqckJivrlgOkPgzGt 1I9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435294; x=1737040094; 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=DKirfVfr3JrJ4phvSlQyJq6q5S3I1b+zwqhd331cro8=; b=PBSIwtB2bXAnHtt9eNTwjZGKmhNsxyzkCDyqkqfN41veSCs1wco0rf4WuoX5zwL/60 sb/vRBe//4HT736x2WOQm5P8Z1RTrk9fTm0984/oxhBOg8flpKjmHAXJmTNlGNnU1WNn INBsQUE2UZj8t1qnQArpB7dM7xPaC4nDwsjw7SR+oxjI37tgdPBTgN01XSxTAr/Yg39W fWlomgIRUT41OD3GGp9fXF6Exzd6dtmb+lEGYeQpibQthhlSjyajJ5F4Jo3P5um6irM0 ZzdKrDcnUeVkO0IRYZcaCopdZWWCnt83X4ijbsspz3nHlldQxzanMWG98aZ9xsbc3LR6 Rbkg== X-Forwarded-Encrypted: i=1; AJvYcCWjKTQacazykICa9NO+gAfSo+uBvgnMHhE7RUuL2F9zhhq4f6vHagiopUUP+giC3xkT21hrDw49biks@vger.kernel.org, AJvYcCX6SxIxVbzW8mr9lx6ouvSwCMSbhTZ822JJQvI5T4BauCadhN8M1SieInR4EPFI4U96uyrJupaW6YokU+MO@vger.kernel.org X-Gm-Message-State: AOJu0Yx9m2Ab4H5wc4Vxceu+Jo5hmBQ1OGUCDwmYpZLWLRKy6Dnbg4O2 5t9MhR6Lq9LnrnnAkSo9v0Ro538UBOUbf7i0bB9NMh1rr9WRZM3FaWxpJjGf X-Gm-Gg: ASbGncuElhgvpBD3iW1zzv38d8K3LyGXirDV+Sbc9aMdU4z31dz5DlhUef+Y32CaI2w Fd4ZIeBXOxSkxX1LEukb6i7XizGCyJD1PrlpM0fZ/xZu+dBhdyOi9WCmSkbTG5Mz617GxctaFT/ 9yiXSI0fYvSVtppEnqjYyyXCV56wcEyy7NLmtPfbm3jeb30Hi/ik/KbX21wxRXHvp1Knfn1ZpFx PJRSRO6bwhfelaASP1CCs6ugXKjawHbfPtYrdw6A0F44nCzdUTkH4vT4NwC9T76 X-Google-Smtp-Source: AGHT+IFJxb1VK/f6PtdkYvY/B1TzEVKdzi4rM/myKllQrpU6mJlwSpnWhlKays2Qs1u0wNVapOwGNQ== X-Received: by 2002:a05:6102:6e88:b0:4b4:27dc:ffe3 with SMTP id ada2fe7eead31-4b427dd0152mr4719591137.0.1736435294021; Thu, 09 Jan 2025 07:08:14 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08:13 -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 , Colin Ian King , Alexis Belmonte , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 04/18] ACPI: platform_profile: Let drivers set drvdata to the class device Date: Thu, 9 Jan 2025 10:06:17 -0500 Message-ID: <20250109150731.110799-5-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 7 ++++--- drivers/platform/surface/surface_platform_profile.c | 2 +- drivers/platform/x86/acer-wmi.c | 2 +- drivers/platform/x86/amd/pmf/sps.c | 2 +- drivers/platform/x86/asus-wmi.c | 2 +- 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 | 2 +- drivers/platform/x86/inspur_platform_profile.c | 2 +- drivers/platform/x86/thinkpad_acpi.c | 2 +- include/linux/platform_profile.h | 4 ++-- 12 files changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 3cbde8dfed0b..5a867b912964 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -461,7 +461,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; @@ -490,6 +490,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) @@ -537,7 +538,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; @@ -546,7 +547,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 b69fcc4c3858..00a1178e552f 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -234,7 +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); + return platform_profile_register(&tpd->handler, NULL); } 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 1fa0cd69da8c..585d54d8d80c 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1928,7 +1928,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); + 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 37316bc3e071..8e75ebd25e21 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -425,7 +425,7 @@ 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); + err = platform_profile_register(&dev->pprof, NULL); 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 3e94986078a6..248490571e8c 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3895,7 +3895,7 @@ 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); + err = platform_profile_register(&asus->platform_profile_handler, NULL); 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 386b22e9c922..a8961de004ab 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -1169,7 +1169,7 @@ static int create_thermal_profile(struct platform_device *platform_device) pp_handler.dev = &platform_device->dev; pp_handler.ops = &awcc_platform_profile_ops; - return devm_platform_profile_register(&pp_handler); + return devm_platform_profile_register(&pp_handler, NULL); } static int __init alienware_wmi_init(void) diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index ba366c28d9a6..1b6e60a63491 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); + 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 3c2d4549eb7f..2cf1da00d5f9 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); + 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 f5ea03763a54..43e4d9d8d595 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); + err = platform_profile_register(&priv->dytc->pprof, NULL); 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 8fa9308d4686..43cb2a927fdf 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -196,7 +196,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); + return platform_profile_register(&priv->handler, NULL); } 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 a35453c3c605..a72790cc5e0e 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10649,7 +10649,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) dytc_profile.dev = &tpacpi_pdev->dev; /* Create platform_profile structure and register */ - err = platform_profile_register(&dytc_profile); + 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 f549067539af..cadbd3168d84 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -47,9 +47,9 @@ struct platform_profile_handler { const struct platform_profile_ops *ops; }; -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 9 15:06: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: 13932786 Received: from mail-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A25B21C19F; Thu, 9 Jan 2025 15:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435303; cv=none; b=XtET4svDS/NCfUryhztq/3adVKIwrq5l1CJlVyFYwHDIJAx0rg7lIh/nx3/y5jBiM3kkBxe0yXqfZ42+Kh4/TyEJ7dwyjsbYY1OokSzPwbQw6gyZ6VPxsxpIFfIZtChNGxCYHb6FgF1Ik6iez+91pRssmI0Ft95dUWgz5a41rJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435303; c=relaxed/simple; bh=xXd7/bxWsamtyu89sAy0WEtkdtiHL7TrPuPupG6cCEA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dWBZkRVmwtHIATMQXkqVZuI7PR8TN7RGGFhF8pDHZAlNJHyzO+/MwET5Uf4vDWmFyjWYVCwTXMhbxfnX0rdLf1RmTSI7C8MWMCWJ/RD+Nv5VP/mc6Rs2F6pVYMOa6qCawZbbphYCzMHdtbuDE7xPHM2AbRnwhZn/pJ2L1qAbYZc= 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=hlWZfCZT; arc=none smtp.client-ip=209.85.217.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hlWZfCZT" Received: by mail-vs1-f49.google.com with SMTP id ada2fe7eead31-4afdf096fc5so314390137.2; Thu, 09 Jan 2025 07:08:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435300; x=1737040100; 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=2pKRMBIvNnmP7mlypvEctiZQvcwUOdv+eJehK0tFBB8=; b=hlWZfCZT+ziC0SU29j3pasPRflCdGhjif/XxswOlfR6r1Un6c9jVJ1iw6y8cn0KjbU aejyPi/WjEHyE8G6/tIatkycsuvatYODNNYHkMp+is8E66SVuUYGyiB0Yd5p49BmAcAW xaOCcL/T44sR5l87DchmSo3zQfGXmHkCwbzfQjMFKRZMileysPe40PjgcjBh67wAo9Vn oXBVnqRTXDEfkdSOwL+blXzZRC8f0MJdDslWtHfWZSCTD8QXSNl+uTK6WUGUFp+vd1uw jBnZJPpGE7OQIMdTX+RVZv60yqW6w3z6XTko4tU2kwM7XYjEQnEKbHDn0uL2b8KccTB+ AnYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435300; x=1737040100; 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=2pKRMBIvNnmP7mlypvEctiZQvcwUOdv+eJehK0tFBB8=; b=jdB8JtV7PKbvz7qnZzmyXACjmzp0dSJmdvDKJn3zx+6Nw1VFZmZk3+X9H6jsWYxenL lKDZF9bdrGrk6/wOOAI50bXPj4SCNu6Hp20+nHWPQXoqdfrj39DQ2Jp4MiP2b8mWxaqk NpCqdPbFqgho9bk4cwgf4gvkwTmXOHDNfKmbuMtsEpxlN/1OO8qHQJoJgKNuD3/xxEze ++9TfMkYAvr+/pLquOhO74y5+zhVZibba9Mq/3fqYT9KbcySDnDF9XjngoSY1bFolMDc zig0YpqXNOrDrPVJSOPY8prCxzYyCHw5h3I7Rr5azl2ax+yx6/ItDuaxSk0nm/m0wKvc iiZQ== X-Forwarded-Encrypted: i=1; AJvYcCXLG+V1pyFE6ncDsv7rK3UhACUAPWeuQAsKVLhWZqnQKZqxv+d85zDf52JsWR/G3gcce3KHbkzOPqX0CxXs@vger.kernel.org, AJvYcCXfAt75dyvy9Mqa3QKxLNpxmOD2PZdGfE7FaJCKU0fjwDc64S+kvnyetggkZgDHsKdT8rp0NbcaI9bi@vger.kernel.org X-Gm-Message-State: AOJu0YwA3Hq77ADvfBmPa/IGHVF4v0Y5dFMXi7hHCDI5CZDJ/38T+ADg pkB+Il63sf4IN/3TCRwUGyRhpEZLXlOVLESswbKfzP7fOSBRly3tG+NeRV4g X-Gm-Gg: ASbGnctToW+pu4nnBH4Wb97nC93EgICVqYohyr9lwkAsCpCO9Ari5I+M9rch6xF61I9 yO29mhe0L/A6kD8nb+vVjGQAZbuCX3tFU5D8Z5KXze6ajVkZwz3uWaz0cPwQt7+WIhXuVl3vk/4 QrIZbpWHDPLmQ8Pj0DmclEgsCMhE2Bx71qkf42616w0Bdk6vgd1KAAVHLyNVhP022XVe/aH+BOC C0A8GfNG907J6OwIvM0CwygCpuubDeuqfp+8moBYEWDilInUnCz9VwRuJhnQhCh X-Google-Smtp-Source: AGHT+IGnQgCC9RcckDWj29i2/mHE9ovkbWx1Wu2mUVNLteeCviq1oOTEOHDEs1A5UcyKdPR2fTrCPA== X-Received: by 2002:a05:6102:3591:b0:4af:be6e:f0aa with SMTP id ada2fe7eead31-4b3d0eccc9dmr5986327137.25.1736435299857; Thu, 09 Jan 2025 07:08:19 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08:19 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , Joshua Grisham , "Derek J . Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , Kurt Borja , Maximilian Luz , "Lee, Chun-Yi" , Shyam Sundar S K , Corentin Chary , "Luke D. Jones" , Lyndon Sanche , Ike Panhc , Henrique de Moraes Holschuh , Mark Pearson , Colin Ian King , Alexis Belmonte , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 05/18] platform/surface: surface_platform_profile: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:18 -0500 Message-ID: <20250109150731.110799-6-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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 ssam_platform_profile_device to the class device as drvdata and replace uses of container_of() with dev_get_drvdata(). Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- .../platform/surface/surface_platform_profile.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 00a1178e552f..efb6653ed1d5 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) @@ -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, NULL); -} - -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 9 15:06: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: 13932787 Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27E32215162; Thu, 9 Jan 2025 15:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435309; cv=none; b=oB/LqKRm/qgjFMiWXwhwRy3UVxpSz9LJCeuH5+/CywoxMq63e281g8fONTDtFb8qPfT98oAuZ2faz9VcMntp187JdYVB1LnLnIXd4rQ9Gmpk3O0wKVoKAWzlgGNYz+q88dj1uhsFZLeRs9H3w4H/yPVk7e8Mq3X8Ailwg0c7uXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435309; c=relaxed/simple; bh=KZeV286NRfqGS4NBEqA1eDQujyluseICOjJBryAdLCM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nvq4dfoCVguR+2EV1UgiKvlAVxu72jCUXx/HfTxVK3Xt0LD1bm5tnTV3MA8r1YCxknwKdCNIxKGSNTliSXWGfJul7eqDelngnnWGe0CJ7QoyQc9nHUeKr0WIvJRgVSuCAJwxeSVh+jV9sFQJR7tA0QY/14gAbw+OIlIfD537zC4= 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=TPWDT8MM; arc=none smtp.client-ip=209.85.217.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TPWDT8MM" Received: by mail-vs1-f48.google.com with SMTP id ada2fe7eead31-4b11a110e4eso286345137.1; Thu, 09 Jan 2025 07:08:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435306; x=1737040106; 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=p1tUf+9DK9tMnD8L1mOJiRs8Bs/JKwc9KQrYpSk0By0=; b=TPWDT8MMrTPWRj4Gq3hnLg9u+Z8moFwI6UG1gGvxnvzB+urLpMeSO8OrUyIX8tyFY7 7a5o+i2ZJ9urmtiHtDFa6SN+ykJGDpstfjjy2phBR+1tU5d8nlLWwEi45iKOjqbb7S/N jz0VHX53raLAX1RElvL11+yxafi6M9HODgRxJlf9h4CW7LtAHsnYdV4BTV8DMy+UDEpY 8ZJyrlSOd2ep17JFw7ImsM8Wx3OmURhsqZdbACjOG/gecrPfUNAVESCHn7Y35Ra4Dpxw WC7RHwBos7lsE5xUv7FyJYeDZq98v9nbDGSKKut1Vixe/5QqGbxOGzkQ38QBJePls8fo 1Ulw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435306; x=1737040106; 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=p1tUf+9DK9tMnD8L1mOJiRs8Bs/JKwc9KQrYpSk0By0=; b=agK31khi8ImJyBBvcHcnPIL1kjaxnBq8nw5AsDOEyIlnica45WLAKENNx3P7k1ZZ/8 ul2Kq1Ns5pIGUueWh4+UYB5RDqevy8RryyNRiPOStxpRI6oP2qa9TNTHjAuh+Bc0KTFG QNnKFrPbaTxsA9rJ1MEskuefCDBOnMOpW+Rk+WMg57gOl4N/k+8yx9MD4X1cvDwa1HgA RehMQdBqDWHQ24sbPvs7tXDpdwKLOFFkU7FerR9h8sEmIE63tJKYNKXZSM5Moo3VCwQF rUaczrYG9ujfAbICuL58tWS09U6mmLib4HR4tR5khn+awPAe/TyfIm9b2umQQ8KJ5490 E1rw== X-Forwarded-Encrypted: i=1; AJvYcCVhrbouPr3NC/O0JNgiGVLzBHKyylo7k4jvSDkrulBe3jf9bpY2DyP4F1qeFUXzIu2eunUEjsWiDnhoseUY@vger.kernel.org, AJvYcCWFCcWtaTdNrc0Wn2f6rWLwsanVGeLqpWLeNbF3BQLSpbazXOzNrDbBA8Ag48vIyGKjlegyaROSJJP4@vger.kernel.org X-Gm-Message-State: AOJu0YxS+GL6wsgjLS0iqbau4V2gWpE3XnOAnSIMkSgGA9jtXK/NoG0H gBNT4d9JoQFTL73cbxSp8VGTsJuQ5LTsLwW8E3jrqH1VxLAmgL6dQvrvWvgV X-Gm-Gg: ASbGncs9leUMrrFHBxtRBibFxyNLAEs/XMHoiyd7X5DrYMX21RMEEx2Yhr799HKAPeo A72eFNd8PWGFWruJl62oYU+f2Sri/7DilawrP0+3hp2cbVhZOZGZypYVh47fdNrIRmaBLbEijsy 5wyXT75DSo2p5UGSt8cPTm51EWK7IaMVQ0Jp+0ZxydyNTmp1ww01mozBcEpVPknkla5Ub3dHP4W 5a5uRkgtbqpa1eDywjOoYyojTJDG6I6v51K/DVNIc+kCh3V6IbHhA0t6wIjHbr9 X-Google-Smtp-Source: AGHT+IFjJvB65qdIOtwWFZNJWYdGw8KSgBVvzhl03AdUSd1avMwi0YmqB1FWOP7JvW3yslCDCjL6kQ== X-Received: by 2002:a05:6102:292b:b0:4b2:7446:fc18 with SMTP id ada2fe7eead31-4b3d0fb67bemr6267582137.17.1736435305836; Thu, 09 Jan 2025 07:08:25 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08: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 , Colin Ian King , Alexis Belmonte , Ai Chao , Mark Pearson , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 06/18] platform/x86: acer-wmi: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:19 -0500 Message-ID: <20250109150731.110799-7-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- 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 585d54d8d80c..70ec667e0cbf 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1928,7 +1928,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; @@ -2575,8 +2575,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: @@ -2597,9 +2595,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 9 15:06: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: 13932788 Received: from mail-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F69921D018; Thu, 9 Jan 2025 15:08:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435314; cv=none; b=inPFXH3kMccMuOgRKGAAzpfT5GPvXAyVch4Fajv2pS2SJaup1hL03gMEMKuGfZ+affb0+eam8lkxrLqWzLrGRzGhNw5LVFcT3XR4xndyeHV67goG9JYnbAlOWI5mkj+WcrVYgcBzhMaktMq/T15ndxryC8ts1I5YMfwEh3obm8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435314; c=relaxed/simple; bh=AgiCZajH9sjLEAC/PKeyz7IcBzBLd4dscfluYeRgNNk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qxod6EW7n1MFiss2UlGjQgT67ThmOOc/a9Vi7gQjXZgjzbchxr83TWnMwN5B3mTg+Gpk/iRCijvq9Ce+zpPJF06GUUWOa5q7WKFnUfT4Z80l3nA9Afgr/xSYMoEm5syQDOyAe8IcJlB2c/dOd4jMkUYkSYNobHYHrY6H91OS5xk= 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=kVCd58VL; arc=none smtp.client-ip=209.85.217.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kVCd58VL" Received: by mail-vs1-f49.google.com with SMTP id ada2fe7eead31-4b11a11a4f0so407920137.3; Thu, 09 Jan 2025 07:08:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435312; x=1737040112; 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=gtcPmrAHgkUUo4sRfcFR6W1QqvjqY3PBg9aacIt0Kcs=; b=kVCd58VLXvsl+oQY+aMD2nUBsa5iGZSEDA74emGCHCyWQe8Bh4mfrl3pVZrqMtH0+d QcJYszSAb/e8W5s9HwfYjyx4fRNAq3GUMMkGOfzBwoo3WjnpInP4LMsSAL0W4lir+RnC j1m1xuGhF1QGrhnxqWNmqahpszvnzfaFVZ6xIDol9iRnn2BIeTO4YQz2LSLk2oUF4erd HA+8cJnxZfjzdO1xx+vPwzelNLGrsa4bXwEBJ7CMIjRXGjq85Pvo2vWqo3VSYvbSIHVD mFvwPA/X5AtnPnSsN/niDdFAxkBPIZVIi/2Cf4Iwr3szcbJxP005dzv3JQ1r79XAs1pU MCsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435312; x=1737040112; 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=gtcPmrAHgkUUo4sRfcFR6W1QqvjqY3PBg9aacIt0Kcs=; b=QVZSLIVVdut5AtXxIneJwilgYlGcW27ANeeWn25i6htghLEY1ZueEgBa6cK6AZjEyC GV26iUfwtObdAWDnQwgffc+1ICyWbPQugi5uAMB+8r0IdWLEgb//DdC2uNxCj+QOxjg7 FrFaQPqPWUcAqi/I/uCPpYDJg3aRoxVI1/d7nJhxKI0u++rctInjBIGqEOJRRavAWYfD LpSxHUdfut3mh5WfpJEbZ0HFu9ktEnxnNOjIHfOhlFFmAJ6Lq/g8CEcfWAeANPLenRdm zYnzn4L0Y5UTOOHOu3uLF3IiGvKgd590cq76UCtC2/rqkPAk/nWnbQV2/a9dpecWb26g b9Ww== X-Forwarded-Encrypted: i=1; AJvYcCVRB7nKMicQEVKfk9BrH9uDMgZmKtYke6rERx+JzVcqG9B36m1fZWD64KvDwQWmkMX23PqSDIymZ4hu@vger.kernel.org, AJvYcCXG/hGRAwU83qEnEkytXW3nF7ikJLv1O3XZqiMXeBOif5a3ZLHq8Nw0GEyV5MIqIBrwI/HQ5rIAupS8Dm7r@vger.kernel.org X-Gm-Message-State: AOJu0Yx5QHJaUrPBay8fwUDCBMhF6mc/CIqiP43Pcmc8jiV5lAJQFLRu BZ+/nnLftM9dNH7bdeP7E+XPiZMDP3OkyveIPSO87JCDhpYw2aTVAnBjtHTJ X-Gm-Gg: ASbGncvjiUWRU1hH/NfYhbvVeI/0W2fsZ/XecODMfXRHcUgqyQg5LC9yTV/YSu5IRn9 MoYa+5cwUUcV/NIfZsv19YshG2sEtEIk/equKI91zkqVZE6I3436p1zo0nEy5HC4ucxJXiLWaJE BsNAQ5UT5jHkXWlqPvD/a9KPCDaM9hw+QDJTfw8jFSu0n5OKyZDQACAijONufMyxb5qQz+F7odq 0vILH3nsH21WoXoTzTdm98hEkiTm9OHfi4XHnpLJS13tLAZxyZpICbnLH4EHAjQ X-Google-Smtp-Source: AGHT+IFMtfJ8yR7tBbL8mxs/WV+A3Jnd18ab6j3DFPxW2nqJWpQEUJz65hKjWpLExsDmpWKF/fxEGA== X-Received: by 2002:a05:6102:3ec1:b0:4b6:1a4e:9ed7 with SMTP id ada2fe7eead31-4b61a4ea005mr1464980137.5.1736435311971; Thu, 09 Jan 2025 07:08:31 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08: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 , Colin Ian King , Alexis Belmonte , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 07/18] platform/x86: amd: pmf: sps: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:20 -0500 Message-ID: <20250109150731.110799-8-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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 amd_pmf_dev to the class device as drvdata and replace uses of container_of() with dev_get_drvdata(). Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- drivers/platform/x86/amd/pmf/core.c | 1 - drivers/platform/x86/amd/pmf/pmf.h | 1 - drivers/platform/x86/amd/pmf/sps.c | 11 +++-------- 3 files changed, 3 insertions(+), 10 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 56024eb40266..198bfe3306be 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -764,7 +764,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 8e75ebd25e21..4f80a73eff9f 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; @@ -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, NULL); + 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 9 15:06: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: 13932789 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69EEB21D018; Thu, 9 Jan 2025 15:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435321; cv=none; b=cj2okFT7GON7qWWgGRaPfkYyxdufJbtnSJTb6MuRQnlfX5woklNDx/SN3g4HqtY7V93uhDAp9az/BhgFgBokjmqlKj9obHeEtm46vsFq1eS93tskz6ePzgayEDlytrgTRseWUtNetjHEN8ZEffQC6jypHgA+vxHEmrVLi73aMOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435321; c=relaxed/simple; bh=vywDhdcsdLuqHYO3u64jCjCA/7sqHd8JsTiWODBy3Mk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kkrz3Wd5tkBY8V7x89AjUY85iXF+cZWjcGRTypy5Z5v8muceGlPo9nmf2A9rJBTwV1PFNkdaWfZfkpYXVDMRvibkqOa1OFRCyF61VEWLRlFH6FY5NE/haOExuifEP2H9Ws/FmpNO3sf6OIwhUnvt/6FWMA6m2PM7eLdMhAs5CWc= 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=kNj0v02p; arc=none smtp.client-ip=209.85.217.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kNj0v02p" Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-4b11a110e4eso286404137.1; Thu, 09 Jan 2025 07:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435318; x=1737040118; 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=RpRy3dAZpB7RhV9HHTV4GtpVfyLmWse41E4e4Kgh7V0=; b=kNj0v02pIJPEKlul3AdQGYspain+7OkzLlcD4F/Hl9wGaO/3eCvuGkb/5kxlWiJdlM 3jOic+sqpfKbh8fkrR9H9e61KLQhiqBXN5p1J+kaoG5472hHa7d3tNa+4IWvwT28kTgF 4q+nvTn1wityZQDRtXQUtzWaUV+yIjmffy5kqyzLP91pBy57hHchmWchvqbxBnazUsqG PqwO/oRQXHXohYVM5BMW1MVqRbmXNLLUmm7sN9HBV49s7W7Tg/nZnyvVxVGZcRg31kuD Ail09xav8OpkSA2JaCdqyohTznW8yryp7iS/73ZZ87M69NXQPdpYidxriyn31jwmdKo7 IjoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435318; x=1737040118; 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=RpRy3dAZpB7RhV9HHTV4GtpVfyLmWse41E4e4Kgh7V0=; b=Xr46NUjvaXgGJiuVhV89a5fQTzsOTN+K2Q388VdeNmv4KwrjE4ETSIIFIhC1ZZaY5X n+LqYsB36YgU/0UNE9cgcWrEUj0y7CKtAwYEOIZFDueQKhbndQ6v9hizW8KzuKlYg6/9 /gMU8/oO3G2MoGNUWUDl41tG1PQA3+Y/QQorzDGh/SHlxGPdkEgNOv4hzI1YDaCNJLaE Z475n6xaTDvHwQLB7raa8zZEPbLdsq3ScrT06uoQvdJ4CHwDNhkEOvU97Hc5q3BiDVfp CzAkBc7UPFYDiapourzwjAyDI+aKZW/BNuKgRFZbP7W4GBtB31NCvDRn8QnvxAQWYhAe 79Dw== X-Forwarded-Encrypted: i=1; AJvYcCUc/NBLe+bpxN5tINQ7Wcsn6feVheepEg0PnRbrHlKSG1l21V3FrPd+JHgEad2RyBJquUAb5Uhd3o+iTBZe@vger.kernel.org, AJvYcCVydZWN9hNrXnATsp4GkELauUvs4sQmLa03WYCdZ8WI85HWnY1Zq4Yz3LO5iPhwsXh627Jk+0A3ocWw@vger.kernel.org X-Gm-Message-State: AOJu0Ywj7B+mnQdN0OulU3lB49LsrIXQbVj9RgvGQJ2t3lwnypZMhcET Jmg9AO+KIiOW++aAtmMJ+9Pb4V5v+c+SlvlYcbL2vEFk6qLIzAgxM/4ypLCj X-Gm-Gg: ASbGncuG4CurNPCTWltHWK/6qkLJWXe/nzRYjPzz8E7oO7I6YiVr3z+bhQjSORjEn7H FDFvKcBZNeQhg8aoT5KEd5woANzy7MXkez42vMaaM9/47u27K7ljhWkJwbm3x4KtVA2Yjy0xyL0 /Nh9Do75bJ/z4t4U5mGsIjBzM9Komh6ZZWZUiGuMrK2aW8vyrbkZVCHgOT+DU2x47M5xG9AFUAr VmNlP4JClhm6GXARhPmxXSMuZqEFXvcAneaEyEPAHGkNr23XyF3bAAuRn6qDHH9 X-Google-Smtp-Source: AGHT+IGR/+CwNsQKCyZVv7L7iExfv3QE2DSqFOuBUmkY3DxOHBohtIkPAje8Sxp/ioTZav30tJeQOg== X-Received: by 2002:a05:6102:32c7:b0:4b2:5d10:2cc6 with SMTP id ada2fe7eead31-4b3d0ee5017mr5660651137.6.1736435317983; Thu, 09 Jan 2025 07:08:37 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08:37 -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 , Colin Ian King , Alexis Belmonte , Ai Chao , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 08/18] platform/x86: asus-wmi: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:21 -0500 Message-ID: <20250109150731.110799-9-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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 asus_wmi to the class device as drvdata and replace uses of container_of() with dev_get_drvdata(). Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- drivers/platform/x86/asus-wmi.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 248490571e8c..5c7099dc6109 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: @@ -3895,12 +3895,12 @@ static int platform_profile_setup(struct asus_wmi *asus) asus->platform_profile_handler.dev = dev; asus->platform_profile_handler.ops = &asus_wmi_platform_profile_ops; - err = platform_profile_register(&asus->platform_profile_handler, NULL); + err = devm_platform_profile_register(&asus->platform_profile_handler, asus); if (err == -EEXIST) { pr_warn("%s, a platform_profile handler is already registered\n", __func__); return 0; } else if (err) { - pr_err("%s, failed at platform_profile_register: %d\n", __func__, err); + pr_err("%s, failed at devm_platform_profile_register: %d\n", __func__, err); return err; } @@ -4859,8 +4859,6 @@ static int asus_wmi_add(struct platform_device *pdev) fail_sysfs: fail_custom_fan_curve: fail_platform_profile_setup: - if (asus->platform_profile_support) - platform_profile_remove(&asus->platform_profile_handler); fail_fan_boost_mode: fail_platform: kfree(asus); @@ -4886,9 +4884,6 @@ static void asus_wmi_remove(struct platform_device *device) throttle_thermal_policy_set_default(asus); asus_wmi_battery_exit(asus); - if (asus->platform_profile_support) - platform_profile_remove(&asus->platform_profile_handler); - kfree(asus); } From patchwork Thu Jan 9 15:06:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932790 Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) (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 9FBFB2206AE; Thu, 9 Jan 2025 15:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435327; cv=none; b=fzlewmlzn3QRhkAsPHRFPouNjfMuCndCXUTdHqDSdoGR5MwnEdWapM6ERdarGCKAqkcn+usP21Sb9zY3Tcp4mvkzXpm4/N9Gsf3CQ7SpzhNGCufL3dFcY05Jzdeehz8sFcyiIDCTqCLPNetVcUo1GwfL06a7rEZmYSHdfgPZcDQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435327; c=relaxed/simple; bh=j0SkN7T4T/5f3rBo4tFthXYTLFlDzJG6wEc9cSOq9z4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Thl152sYSoDDnWV+A95X6/7RXzpfzgSlkMk6RxcGsmE/dnIMIgpYQG0XVd5/sIq9Ky3oSQnaT9j82Or8L69f/zQckABeL53K+MQU4WQCCXtYWtVRA7gDnDSToejQbn4h8CC6OuhTuSeKXzwmorru2CGyuVFkYoVdJd3VSCTRIAk= 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=DUA9irDf; arc=none smtp.client-ip=209.85.217.51 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="DUA9irDf" Received: by mail-vs1-f51.google.com with SMTP id ada2fe7eead31-4afed7b7d1bso379862137.2; Thu, 09 Jan 2025 07:08:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435324; x=1737040124; 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=/iPeOvfqR3a3r89mRdqSnR+yrBxJ13wmx1V2/OlLHjY=; b=DUA9irDf6Qsds2L47JePYovMInaXKaaxo+Qqkt+fnT8irNZpgC9wJDcF6A0t2NP0ix FortFdx3mN0HA7AZc5FrTooDRfQxR9Qr8PXSv19AgUqOZEACMA3FcfbI7OgHyLN6cQfN g8Ufr62ou3nx6H44QkymGPV1xem6bUDg6eRm/HtkdNc6OapszDaSzN+ccEaL6BDH6P9R KHyoyHvBaCT7Yvv4iCyt+y55D9YwuPbth6lQSBadcxn+FmSwgpXNZWG9H8ydLSW6XRC1 p2IaMX8WmYXIF8+8BXNqlGBLYBFyLgymVwNa5Gm2345IYB1K7VVOd6ov8jF1wN1g7TIx 1Bnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435324; x=1737040124; 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=/iPeOvfqR3a3r89mRdqSnR+yrBxJ13wmx1V2/OlLHjY=; b=oE/lM9lGMbSzP47MltSjr9hzWpmhHfkw0LK/DjCPcWiZ27V/3UZr/ytMPiUnRYGUHY uu3Vh8UfE5Njsnq6kWAunphdYNnnCns8eXYaJrLfznHVS92CQJVLJCiXkkcE3WnbBFH3 i8yx3x1jSe4Q9IC3LYt0pgttbONvxAaX09denVET2RHnoDTXAhPBq9ddQnt/4P9/LhNL RHtCW3eyuQU3x9hYS8MRpVJeXKeylYbmQTBQvngyhhcQ436RAf18r9A1P0u+l73kSxtx LTdIbcdks+w4tcG7xhsArksUPGLJRSwGYi1kJBe6rWMqPDD0+U168wpyCBvoOJByxcF+ 4SlA== X-Forwarded-Encrypted: i=1; AJvYcCWC1YI6jFd2/CRu2cwnOuC5UIBEFylgaJihCHSGg7uw12Amu3oWk7CmCJyAtn9CRLySw/LqzfcLIqMs47sa@vger.kernel.org, AJvYcCWOFl+0wcpT/g0mFc1CzFnfs0kriEvWd7VANcG8dRUvLDjmUwbhFf2TO3lA8vIxBpfu2UeRj+pxB51p@vger.kernel.org X-Gm-Message-State: AOJu0YyhC/bop2xKoQWwz2Jdc3kGxuZQpxx+1vi1CaMofgfYxgRB0W2K 7wMNzhVkKAvg/iSyY0cjAq26SAnYhzfVLPMQN/X+vPb2jJbK0unp1WR4DkKO X-Gm-Gg: ASbGncuTIunu5Qy9srjfR3xl9nEsA8ym0fkJp5Qums6Ldj67iVVVZMU+AQFErOHgFZz ZR7yWEgYaY/iPJzz23VN//hiZDNFDXe/tb3ZP3wEXg1ZFRGZqQBfbCJ1wYo43nAhOtryNE2pul+ djC2M1ICXEn2nAtiI4MQbzPnL4Q6/8dcZgoiKmqW4aqTVXtXPRHM297TkcZRse/udlgJApV1GsS KfIajgEbNMZuMziHzvwT6kzA8lVuUWoNO/xdKnrvIRL4dTP8N7pfhv6zLk3ty/i X-Google-Smtp-Source: AGHT+IF+xscYmEWQekuErTlAVFKKdQqn3JyBZsYrpGaTGJsFbmztIiP7BNf8GdvQl9CqmV5Q1g+27w== X-Received: by 2002:a05:6102:b09:b0:4b2:cca7:7d51 with SMTP id ada2fe7eead31-4b3d10482d8mr5814670137.19.1736435324083; Thu, 09 Jan 2025 07:08:44 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08: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 , Colin Ian King , Alexis Belmonte , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 09/18] platform/x86: dell-pc: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:22 -0500 Message-ID: <20250109150731.110799-10-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- 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 1b6e60a63491..dda6f13295e8 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 9 15:06:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932791 Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C9672206AE; Thu, 9 Jan 2025 15:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435334; cv=none; b=vA3VrkVWg/hUe0PWlqdRRP8zwqtgd2QdwwNb493ePNVBZ/r3uGZv0u63BNqquTxk9D/ls6EWmaAthvrqMD4tHYFgIqqrKmQdDM40lEHxtMFpnxh/uKJWvBfGpEhpkxhgQ8Kv5hmOOYqBukh8WTGRuq+VCC0nxZ83BiaMtCiV6xs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435334; c=relaxed/simple; bh=+pQFibEAjx3fhuHAJNt/J0bsuHSnnAYKNMWP2WmQ4uo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O8ZthmI8UTAOKW4trUnlCX3chqifN/kHVVPiWHxzgHFmpOPGH2FjsSrsArHAXjOnzsp5KyeffyK8oFDNfhFf+u4uRymhetf/R9Lvq5ZIkfA/VA0HZjkvpbz1SBEyIh9dwwDWSROrVfh7HZpV/nuXSLOsfM9ZA02/2QpTxbosKr8= 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=g9LZ29SD; arc=none smtp.client-ip=209.85.217.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g9LZ29SD" Received: by mail-vs1-f48.google.com with SMTP id ada2fe7eead31-4afd56903b7so359944137.1; Thu, 09 Jan 2025 07:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435331; x=1737040131; 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=vjDgxfYVgerBzLzfq9ijJVLGFXFEgkBOlqWQa/hqQF0=; b=g9LZ29SD5SiYsTCo7vvISWBXrLBVc7H6GMsfpiuPuwPY+zv+AjvG3ycc6rykUD+zIH sd/TG/qEkDi8wRWr2s9ftvL86OQvhQINzVHi1x46mIgz/aES0YRXjWRqW3nFCcFdRxiI U2SrMGBVyD0M9C+y2yX7o7RHzEBDf+kWr6+bcjO2YfwZzYob75aLyvWfGyaF5G1afGkM F0EaobzXc1BFaRU2o1+6gRFTrWr9Bx+ryAdkuBxfULpIbjJQ+36WyXR8NNBFqjsciHXi 1VEErVsot4KE1qn3npKmqpRzkXrD6rGw8c+EkNmFCfnPvRwiIReEofiSx0k5/rs29GHh 8+qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435331; x=1737040131; 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=vjDgxfYVgerBzLzfq9ijJVLGFXFEgkBOlqWQa/hqQF0=; b=dm9yeZkEsvEGr+oRiE7V9W7Z6E2j3F9azpgBY3yotWNU1nZAD9VnnbtiF5SM4enx94 NxA7g7LhyyZt4gdz42youSz7PWQAV1FFlkFnPNEvzTYwuVYwYV3NiU3MS1W2wQFx1hV1 DJczCkIqkAyfRZVLHqNUKZsWl0CMCsQjmZq95un+QIB+wFuBDHPY9s3DOBwQm7s1YY0n yTIMaerec/hYtwbKqrAvWqXZ+LyC9sWbbYluknngLfqcceUBALwSVclH0AEH+TmcvlO+ yFRUJsYryT0j4TuBbsa+7h7MpogfggyWvGkEDd3MZWIbJXgcnKY+0n8gYFP+e7cY/qWg dHGQ== X-Forwarded-Encrypted: i=1; AJvYcCVN9Ktq0OrzksESUj4Omg75frsOLyTDVRgzOH6sE3UaytMyjTnO/a9v84fe35L/hH7jshlGmWrMBHMW@vger.kernel.org, AJvYcCWTF6R4UGfQ6jcBbTTvR3PpOKcqgpcOB4VlsWu9i9XTz1mkNskiTyavoy839Mckfj2ZUm2FGmmT2dfykSJV@vger.kernel.org X-Gm-Message-State: AOJu0Yw3zn40Qjrxl4cWiks9gxh6n0DGSXD7u0JU+jVVDsjV8M7GwBGe fmx0fVL+XRCys0VJqjUYeRvrsc87fGV6ac19BbCcV8buB0EHHrfIRfbgJQbS X-Gm-Gg: ASbGnctoFHBli4rL/st90A+C0jgIGc+7dBPS4mafzWByL05nQWRY7G0aNLtG5aBbLTM UOSJnUCsrYJTFPPJyBWPKAiaL3//A6O6yUD+jDPhcuw7pzJbLBJZ9ONK1JQlnJ+7s2JMTk52w+J S293BpVfuS+aE/S7u6NcNkc0JyDy2sbzGwjgBYzEzYkwYAZTFgfKxx0pYABxPfX4YNqiD85WDXH OYwHHSbvS/zJUIXNDoYumKYxREaASRSVGSJ+1kKDnYT3IgF1dIT2MxFr6s6fwRC X-Google-Smtp-Source: AGHT+IE3OpgIgY8w4vOlfqAoadsrw3xphaYjGr34L9DX9hWpRlW1LEhdiSl+3kVD1AlwTW6vgUuw+Q== X-Received: by 2002:a05:6102:50a5:b0:4b1:ed1:56ac with SMTP id ada2fe7eead31-4b3d0dd7df6mr6395494137.12.1736435330794; Thu, 09 Jan 2025 07:08:50 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08: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 , Colin Ian King , Alexis Belmonte , Mark Pearson , Ai Chao , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 10/18] platform/x86: ideapad-laptop: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:23 -0500 Message-ID: <20250109150731.110799-11-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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 ideapad_dytc_priv to the class device as drvdata and replace uses of container_of() with dev_get_drvdata(). Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- drivers/platform/x86/ideapad-laptop.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 43e4d9d8d595..d34d565172f5 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; @@ -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, NULL); + 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 9 15:06:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932792 Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BEF821CA10; Thu, 9 Jan 2025 15:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435341; cv=none; b=Bhm+MAE3IXJ4t/MezEPTBCzX74xWDPmoqX4sQGoEomqNOH12gYubDvy/wBW60qyPojSK4tR123i5bVBLiS9YQhkUcX91TEWGlb/4UqhorZYXn/D/BpHpu0FWbTrl1I9Y6SJhKQxn62MBbAlmG/B5LoLKLELtECzkxWU7pIzZT58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435341; c=relaxed/simple; bh=gYW9aV+qhwvXSzR3wKKONocs/wa6M95/gqFjvC7QP68=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fjqpsosgLRyOKiNsPkvV04PWpNwXioNNbNpJItqT6GH/8TG6C9rvy7DROqkRGSfML4DqAEpi1+BBRuj6CTttfYZxJbRqJZ6U3Yn9W+omfxuXd4QfVdGbXeAqvRKa8Sgs7Ojt/LPZgsP2LnJPxBBN4pMCwX+KmwP30K1z1pnNUec= 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=ZkO7zKNr; arc=none smtp.client-ip=209.85.217.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZkO7zKNr" Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-4afdfd3124dso347190137.2; Thu, 09 Jan 2025 07:08:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435338; x=1737040138; 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=0Iy/iNzO4iWV7mgCauIwixil2V9UKIGAzdPrdWEMOSA=; b=ZkO7zKNr+NMiaUT79dVAOYxINAPeRJ9BZU+bFN4smcSqexkEEtaA0lyE0jeId2hvBW b51pucQfZmjSLsZMJg8qA+dmqivBzic7J1aA7gkBCvjbJ8keYcBohdcPXf8/z1Qh/O1v 0pYQzrDd/k3QcB4TFKJnnkra/bGIBOe/jzbvQPW3Js36i1GZcLKuroas43tUWYMvlocT 9HuuRY1yWxZZEhpFmOmvzWAnEcwcIoZmqgzcovKSnZTxhniTyPotG6WeEsPNIf2wiazT KIxEZNRXidUamX4BI/9BrWjqhlxuLW9ZYDYpx6ZNXmweX/HmC9trfDZrr9rq4qpvQ5rW rqUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435338; x=1737040138; 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=0Iy/iNzO4iWV7mgCauIwixil2V9UKIGAzdPrdWEMOSA=; b=U4+ZrkMRfBHCa9dnzxyAf1kI65OU1Nj9IuCkai7L23CB/FZMshBDFG8seHfyzvTAUE Xptsx3Uc7sAFlhn4sCKPe6LK5ztynQ5kZzfLfJ4hqUvk97iBL3XcpbfXeTgYOzUf+MdA Z/us0Yrlml4k2h+KRw0Cgo/jYWKuNJbW2rbKuCkCFELZmWUjI7csUmbSte5oGrZ9A3XV ra7uzcLJQ6MoXcXjKbQBrn8gwAViUQibk+ozSrZ2We9jOZZaBC5obe4hFp1eQOUYJVrS icXzRVviYpUrfXWB+Z+ScW648iS8eqmTwjBWuHvRzEbQskxF1V3HJ1tiK3gP+JBmbRVk LsJQ== X-Forwarded-Encrypted: i=1; AJvYcCUTuoWMw41C9BYQ1RUAv0oo3B0DWynBeYefV0TCd10HrKXmsFn1LmwWqkteVB7BHqRggYuZJcvtNXbRZBCT@vger.kernel.org, AJvYcCUUX2jWdi0BUyK/YgRnP88SUgWHgceSAlnIL11XnuwqmDKngO0HLc652dZkInlz+XiU0hqMTfVVSRzY@vger.kernel.org X-Gm-Message-State: AOJu0Yw9Wm6y8ZWXAR9jnu2+laNi3zqlgiw+v4Xo2plorJ0iRAPbiavB kq9d8KLfog09R8HVBAhLHvbtpW1GCo4QVX7MN90wj6yx+h/EQtgP30kTMhCe X-Gm-Gg: ASbGncukA/bXxwQdqQGtIR6bztJXf4a6AeUTg6sjUCSNuCj2Kep80yTKpcumzAqHuXN FPpAfM8lUKZTDnlgymLKHNCKytiMkmK6PB9UsRnYDXdLjqFFmVJqw9kgTiUqgtVO8tiLdea7bpo jwXWRtN7ZGp3g1UAtBiSKDW8WsyzmbxYRl1qjEtDF6qlQ8BiR9wEj/kWMfCQuiBVXsS3xnwQ0b6 Ep1RZJ7fCtyQa/7GNQrGwicwzUUIe8ivr4Jm8P48jHXwmygd5q+uXYmJw03auK9 X-Google-Smtp-Source: AGHT+IHhytoth0TPlZhKT5Po3SIoqiBBAvw/Y0vwolJzl3cFFRKKI5U+Jy7TwEWCy0sYJWmVsB2vLw== X-Received: by 2002:a05:6102:292b:b0:4b2:7446:fc18 with SMTP id ada2fe7eead31-4b3d0fb67bemr6272819137.17.1736435337763; Thu, 09 Jan 2025 07:08:57 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:08:56 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , Joshua Grisham , "Derek J . Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , Kurt Borja , Maximilian Luz , "Lee, Chun-Yi" , Shyam Sundar S K , Corentin Chary , "Luke D. Jones" , Lyndon Sanche , Ike Panhc , Henrique de Moraes Holschuh , Mark Pearson , Colin Ian King , Alexis Belmonte , Ai Chao , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 11/18] platform/x86: hp-wmi: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:24 -0500 Message-ID: <20250109150731.110799-12-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello@amd.com> --- 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 2cf1da00d5f9..8a620d36f926 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 9 15:06:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932793 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (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 10CF221CFFB; Thu, 9 Jan 2025 15:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435348; cv=none; b=jFzhdAPeoHbEN6DGNWvCShJP93eRYxd7c4KiZSJsbfcU5AR86fvnAHUc+v1GdLIAtgxSnQ+s3vfaw7U2+5xFRQIhITlsttYJQRDcOpQmdKYOIjkQJLvh7GNu6LjGusPiRTVA4XiSRlqU4EbB7m9doG6q3kzWTMIsvRVcUM6GQ14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435348; c=relaxed/simple; bh=qLNpxdQHmr4FUi3kZDQjLaRkVRppkBFUeext+V90VxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tkm/sqmx9nxLy+MTtQztqod0elWuteCItEujREWT+wCNcYPJg8KfMAI52gsjzOt6HkiYYWYGhyJ0KPmI3cuTjqhY8kCIl51Bi2STWTywK48L6beG2jxDUGlD05MFFHNZ5zD21OPEItNvBYcNCdsBg5Qp55VdhCkHiYMwuWvyvck= 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=aj7YboJF; arc=none smtp.client-ip=209.85.217.47 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="aj7YboJF" Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-4afed12283eso781444137.1; Thu, 09 Jan 2025 07:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435344; x=1737040144; 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=re4+pG1FRpqOGyXJCRSQNyItv7j72+FDLGCOtmj2Lig=; b=aj7YboJFSTP5uhfB+vzM6kdlLnZhY0vmRgcKTyw0dSTrd402k+9skMr9qiJZn2hxQ4 08Jf9ZasqkSPfaEN7M7EH4Wt9UlJljx5l3fiQXs+m//K6vW8VaGEqlL2Ldrzbc3uU/jE 8pJQpMsUIaLLQ2MGx8fDm6cHYDHcXtAsArGw7CV2AnKc5j5gzrP3lnbGVpaM6VACY3av Zrvhd2nDvVCG9XHm9bKvMfy03LArWl24mOnh6gHVF5AtDkDUw5XMeTov9BO1VbatJaqo RfyytwtBL9ubMdLHeZzRz0EEZ0/v0FZC0zzBUvQfqbRagEUyC2S+zj2nQNTvtr0wI5F1 fLXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435344; x=1737040144; 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=re4+pG1FRpqOGyXJCRSQNyItv7j72+FDLGCOtmj2Lig=; b=Bx0okKaLsfACGrsrd/9dSTKKrpvWNcL1uV+prVfMRZNd9Tb8yRwqUGQf5OJ2o0FFFQ dIu5C+ae6ys7oHe9Bn/Cta7td6M5VLpXcoULo2xgaZRkxsZ/mAU5KQe7NFfNyKLgd0nQ SjeFrKFeFCzbP+VKeLxzsAgeMitOCuTRMcYXZPPv1lwrRsB8oq9XXIrhtwqj9gzPvMIb GV3XpVqlv6kt9QqfOdNtZqtbBpqgXB3vPGaSMljjQmC5BcXpopy0IGVuYikRluhQOQaJ 16NAegezHFITR+PkdWMFrQPaK8KW8hYJpKvWuP5fv3g+u48AWZ1CGxJhQ0QHdT0++Xe/ YEjA== X-Forwarded-Encrypted: i=1; AJvYcCUlUZ04O1kWaAVJI1QT2AFwkx7ed4NMYxAQk5HKAu6bCIT6p86djvAvdynb1sJVuBSTPdPUTFggCRxptwnF@vger.kernel.org, AJvYcCXSAEo7nsVS4pkO7GweDI4sV+9DdK1avQWmnVsG0QCmfu3s12Q7ig47CQ1uFkV4LGGEROXoYvXP9yF+@vger.kernel.org X-Gm-Message-State: AOJu0YxBytdwSdRFATJp6X+xvWFCHy8+z/QvEkwFnbOvwq4zrBDiQ64u N57NOn4flpUOsGxH9PXfEvwNjd5sinfWquLhhRrdl85owF6slp3trxkIcuOd X-Gm-Gg: ASbGncvQL5+0aKXGa+H4wd3gbvsNEJRaE3rlILqmSUm3YVrsK6/5OSDUB2pUfVHpajD ez7IOQlkDBXxGr9lIvoeJCIRuMMa62R1WYE8quffyKVDHxawLyQJXPtTnUhmDMe7cduMOccNkyg myUC88ppjane7P6Pfjit3k5qZeZoHXEn12aQJdeyKBD2OFfEskbNgT30AesUNQrINNKB9feUWuw vLKIapwWsRHTbqnl1Mn0upRt79YfrIFlLbBkSxkjZiU1RrN8rqBz2XTnJQMuUjh X-Google-Smtp-Source: AGHT+IEujRA0A36aLkuS6cpy6MKnOsgT8lfTISL9cm4bumoexauwj4sgzoivPoOWFQM+FXLk+rZ+Tg== X-Received: by 2002:a05:6102:440d:b0:4b1:1a11:9628 with SMTP id ada2fe7eead31-4b3d0eb96c5mr5449671137.24.1736435343867; Thu, 09 Jan 2025 07:09:03 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:09:03 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Mario Limonciello" , "Armin Wolf" , Joshua Grisham , "Derek J . Clark" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , Kurt Borja , Maximilian Luz , "Lee, Chun-Yi" , Shyam Sundar S K , Corentin Chary , "Luke D. Jones" , Lyndon Sanche , Ike Panhc , Henrique de Moraes Holschuh , Mark Pearson , Colin Ian King , Alexis Belmonte , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 12/18] platform/x86: inspur_platform_profile: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:25 -0500 Message-ID: <20250109150731.110799-13-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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(). Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- drivers/platform/x86/inspur_platform_profile.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 43cb2a927fdf..543e4bce1a57 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; @@ -196,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, NULL); -} - -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[] = { @@ -221,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 9 15:06:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932794 Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A97FB21CA15; Thu, 9 Jan 2025 15:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435353; cv=none; b=e9ZJjvOZX/HiVnZCr+T3paujAx2F03JtXp9IrurqjTBTBrk5rGcIutjazf0Myv/A4B57CyHg18iUKOmaIJA+WG5BzO9aiAdKihjYsNCKoRZRTQ9aD5sQ0CCa6MQHBo7uVEMr4wnHy8sEoT5crYd/OIxCon4l8jYB4k6MJobsavI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435353; c=relaxed/simple; bh=9Y6ZRZMbCwK5Qs2xCOR7ZHjxG1pU8jAdhife7DbEr6M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n7yUlM3B2+bVMNZQqL9/0Ds9DDNb0FXFx7jFCRvhqua20hVCTEktCbUTpm42DE6rlDZfclTicCa8amXlBF5lj6bLf1ApLnerqpESmfCpqm0KIAjJ/fbGCYOxJ1em0KL8MtYHlo9JLQO1CrwXroUPrZmY7wZvJuNOQjSNn7wW31s= 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=P5Qy2JFq; arc=none smtp.client-ip=209.85.217.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P5Qy2JFq" Received: by mail-vs1-f50.google.com with SMTP id ada2fe7eead31-4aff620b232so402897137.0; Thu, 09 Jan 2025 07:09:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435350; x=1737040150; 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=cadwM7mu1HtIGfCND4i7fxTwuLTCfqLApVy4IXNFf3k=; b=P5Qy2JFq+ZIDsXfwh6g/levH92YrMLv6tRDvdqB0Mk0RURYHtyql2ebOJNgXaK1FDZ tBcd9gpgn1jd4lIAeBor/HWoK979LogItj5RvBzLOQuinT2b2ZkZDfutPN8DZKYVcRzp yu3IVFrbOQCtWSCY1PFc+iYIcny/nne9fWUIraVcCzeN+RerxyPXYEOlGh1yZ4dl7f3v J3+uHldZjWcj9G0jVCLX9nEANwlH5baDhqUdXXTEzaiPBwNU6aZ7s1l4G+mVZMaP4ClQ OQphQOe2kS3t1jSQsbmAxELD8PJ7aU9UqFIWQaL3Z7bJuceJJlsu+7CIk3yv8o0W9pAM Hw3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435350; x=1737040150; 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=cadwM7mu1HtIGfCND4i7fxTwuLTCfqLApVy4IXNFf3k=; b=DWo/v5tfzI867X3J2hzJCH3wObRFerpja1eFdI2sPU/a5x0vPftwxHzJSU625IiJ5I yGvY2joV4gnkf9OwN06qx6JJ+eImjphRfQkwUu4dQv913RIhbqoYyclA0KeMFhaYhPLG JVkBMZvT/0RuOx7Q2OrfZEZBBCrWD5DHv0oKgs9SZAj+bxRlQG8wPfm9yMaFR640lYuE zPP3kW+xWyrST5T2T5D91Wshz2BRAIRyeX1Yd9+hya4E+jBNVHtiSQlu5Tgs+Ais4pTK uQxhM8HGz36cIyCswbTAjlquFV1SWgt2LQ/9kr7znGraMwq8DnuAeOTFQ0mv9VSTg6xi iU9g== X-Forwarded-Encrypted: i=1; AJvYcCVCPSMEFJlLbqZtSJZYgHIiMhhE331fEJrgKybvEnuZ/d58jbX4X/eqDXBkU6tcDaAEuxuP47ySHkQE@vger.kernel.org, AJvYcCXvcdKTjXnNJspt0DI9oKe6IZ1e2IA2Qel/4iWsTj5JYuX87xyQGCMI/CH5S453oui/N0lijtymLWAMFPbE@vger.kernel.org X-Gm-Message-State: AOJu0YxPTqgxGCevcaBBBMzNtp0DGfiftXWAnd6YfR1anKHc1nxtaVGd lOoeM+T2RUSmxAIBoidZ120XsEub+YjHCSfUdlNaBWNxUvbDavF9zMrPBEHn X-Gm-Gg: ASbGncs/zIUZY9AsfnhehSL3YViE39A+sNnMwoWnzdET7yYI1fBLgfxAM4L9g/EZobb E0Cf43aCJcw+G47+pOG3mHSWlcKEyaiXrJyvu/7Qggsrbvt5sD22EBNwgfhotb03t1fwHWo6WRg 4YL36R+ITUKCJkCiOa+O2fYldMTR0D2DfNPdp3kb2LYnmL+JU8Yf2uh8zt3qUfCKt35QXUk2qUI 6EXrTKHqUmBvd0/xjO5YCG7Ks1SkBQlQ/YuFmezb53s8gh4AIL2jhkq0JHLmYWK X-Google-Smtp-Source: AGHT+IFxq39jA6F7LUlex8wfOW9jZaQhVh2rXzXrM/QBMJz1bHhNNth0HMSULAyeCs1uEIg6wvHO4A== X-Received: by 2002:a05:6102:6d1:b0:4b1:8b53:2987 with SMTP id ada2fe7eead31-4b3d0f66c6cmr5904087137.1.1736435350353; Thu, 09 Jan 2025 07:09:10 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:09:10 -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 , Colin Ian King , Alexis Belmonte , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 13/18] platform/x86: thinkpad_acpi: Use devm_platform_profile_register() Date: Thu, 9 Jan 2025 10:06:26 -0500 Message-ID: <20250109150731.110799-14-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- 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 a72790cc5e0e..a0b8987bc328 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10649,7 +10649,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) dytc_profile.dev = &tpacpi_pdev->dev; /* Create platform_profile structure and register */ - err = platform_profile_register(&dytc_profile, NULL); + err = devm_platform_profile_register(&dytc_profile, NULL); /* * If for some reason platform_profiles aren't enabled * don't quit terminally. @@ -10667,14 +10667,8 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) return 0; } -static void dytc_profile_exit(void) -{ - platform_profile_remove(&dytc_profile); -} - static struct ibm_struct dytc_profile_driver_data = { .name = "dytc-profile", - .exit = dytc_profile_exit, }; /************************************************************************* From patchwork Thu Jan 9 15:06:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932795 Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6FC921C9F1; Thu, 9 Jan 2025 15:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435361; cv=none; b=E+Eic/uh1H4gd9ThIblIG0wSbIo7swzTOKDM701f4YFhuIztYqhdxwp3ZT8RIWbdAVjJjzCDJ7W2Vtry6UF3Un0IF+pF6wGmANMX8ffI5wI60XHzZz+ITKmreUWoSeLbEeitlJKoV88eHbnUKbR4KFqMTvC1uuqVOLJK+WSL2Ow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435361; c=relaxed/simple; bh=3iJGuulPAYHJM2VGs5Cig15HMex4vup9V3Jh9EOnmSM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ub9ElN5WADa1FPEMGThqhcBiG7q4FjPyq2D4dK40kAO3tbqYISI4WPmAhdnUA6qCHEhLQycu2e008GD8HebtqlM5+99H2Oj5M0MVxUqswj6cFMHAgWtZg41l9620ViSAbz6toRtg6+QJA4RvnsimF5kjKF43nZXyue5rkMuqh7Y= 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=LX0AJALi; arc=none smtp.client-ip=209.85.217.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LX0AJALi" Received: by mail-vs1-f43.google.com with SMTP id ada2fe7eead31-4aff31b77e8so427660137.1; Thu, 09 Jan 2025 07:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435357; x=1737040157; 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=N0XNXY/JMeEK+RY7wfbv5qEFmZNkd0qCHPSEjoe+4/U=; b=LX0AJALiMEzIsYbT0Uc1o2SitTPhRJiSiqRFCrg2o9KVY4NreOO1Vqw6th9ambox9r VjYTkX13Xps/TV1z3aPhQBz5tYP++ztnxrv+T2rqSbCyxPFtc40FXuLOrgShHWup3aYo vE5b9izcM2hVW87HDoRiJRzis5ojwy9b8sEERhpPNHxdAnfI/2bpAi/sAd7DuWlCBriB MT/p3tYt9GtCBLdecFfWgG1fY9EXuS2dCY1Q1ThAMEjvreI4DqU++pF2CETtbzpOSJtv u65bchcUAiwE61BrRNJ0ld2a1czF6Y0YshvbJ/+niDVPLlQPaIgVntyjwbClRyPQ/avu t/VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435357; x=1737040157; 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=N0XNXY/JMeEK+RY7wfbv5qEFmZNkd0qCHPSEjoe+4/U=; b=rAdKj/cXFbesTHUS1GTMIyCxxMmMAYERo3VxuhheNzq+xd2J2qoNb/6/DEmjGgxZT8 e33aRgaqsBOG1QD1En9fD4Hj8QFJODYFk5uPBhLhv4bdtbzqL5Rm8kjc0YJCwk0cNC4P 9OpDCkHDL6AIjxiIz5oyX+BYDfoGZ6F5+fakDtG0/8ahKv8CsRfsot4F6RamV29uNs1c dmYuG9LuZFNAWnx+2iRRc/hQPNNG6MqAj8wy6j9qbJ7hrwkbCPa9xgMPnCf9B5tPqhBM 9ypNJQ5ugmr88J2xqI/Y+Q88NVgRN56mVrMPbRx0t7wQsqvI+IxP2flX2Qv9rHNX+pmC xtqg== X-Forwarded-Encrypted: i=1; AJvYcCULwvZXkWvw8FPCPaQwNIFLyOfG9PHiobT2FSX4C0L0JaZItvdHHIN+J2qjWzIpfco5kJ5Uu3v6ZWSZ@vger.kernel.org, AJvYcCV2CSkkLiwXM1xXKDK8pSXs7XioJ+LBjuWKHB+j0b0n4MhZepadTJD2XIeqsaOi0U/PdD+1CTEun07135fv@vger.kernel.org X-Gm-Message-State: AOJu0YyhZykQRyLCDmX+wP5jKhy7BUf6ZoteaJy575mN2LIBubxEMVNy XuGq77fRaGvqk02nZD/8JsdpeOBg7mYQZ1NMIN2x5VTYfjFq/z1/ckhurG6W X-Gm-Gg: ASbGncvBRP43Ue9qfPr53O2chGEl4ow21o5sM3sWFw3380ZTUqwspaKKL6u31kbnL7x op/sxM45jE7D+sK03tOR171SME2ujKTZcd+rhdw0J5LeZpJEXrxYKHFOcIORkwNNMcoaea4uPlW sa02QQTGBGIya0qYDpwrx6J51d5P58rkgpi2b5E5ayQlwLK3KtBk54S8q7WdJAyWELxkjKyZRae C0NyNDq2neIc1hXUWxIF23os4Ea/6oi59i5mpgbq8UAv1S4Rqp3RTpAQuICKa7T X-Google-Smtp-Source: AGHT+IFgH3W/KdvqRrNrwfpOOUxIGtaWXK9uZdSbZkYvIWAKPZKw6IJ4yfSisxYpkg28GcoPU0ipZA== X-Received: by 2002:a05:6102:290e:b0:4b0:49ba:8278 with SMTP id ada2fe7eead31-4b3d0ff5da9mr6050866137.25.1736435357192; Thu, 09 Jan 2025 07:09:17 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:09:16 -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 , Colin Ian King , Alexis Belmonte , Ai Chao , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 14/18] ACPI: platform_profile: Remove platform_profile_handler from exported symbols Date: Thu, 9 Jan 2025 10:06:27 -0500 Message-ID: <20250109150731.110799-15-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 93 ++++++++++++------- .../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 | 15 +-- drivers/platform/x86/asus-wmi.c | 17 ++-- 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 | 14 +-- .../platform/x86/inspur_platform_profile.c | 9 +- drivers/platform/x86/thinkpad_acpi.c | 14 +-- include/linux/platform_profile.h | 12 ++- 13 files changed, 131 insertions(+), 125 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 5a867b912964..fdf79b81b62e 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -3,6 +3,7 @@ /* Platform profile sysfs interface */ #include +#include #include #include #include @@ -213,9 +214,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, }; /** @@ -409,10 +418,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"); } @@ -461,40 +470,57 @@ 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->choices) { + /* Sanity check */ + if (!dev || !name || !ops || !ops->profile_get || + !ops->profile_set || !ops->choices) { pr_err("platform_profile: handler is invalid\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } - err = pprof->ops->choices(pprof); + struct platform_profile_handler *pprof __free(kfree) = kzalloc( + sizeof(*pprof), GFP_KERNEL); + if (!pprof) + return ERR_PTR(-ENOMEM); + + err = ops->choices(pprof); if (err < 0) - return err; + return ERR_PTR(err); if (bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST)) { pr_err("platform_profile: no available profiles\n"); - return -EINVAL; + 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); - if (err) + if (err) { + put_device(&no_free_ptr(pprof)->class_dev); goto cleanup_ida; + } + + /* After this point, device_unregister will free pprof on error */ + ppdev = &no_free_ptr(pprof)->class_dev; sysfs_notify(acpi_kobj, NULL, "platform_profile"); @@ -502,20 +528,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); @@ -533,30 +560,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(dev)) { 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 efb6653ed1d5..965940223892 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 70ec667e0cbf..2059b29dd36b 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -742,7 +742,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; /* @@ -1921,16 +1921,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; @@ -2017,7 +2011,7 @@ static int acer_thermal_profile_change(void) if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI) last_non_turbo_profile = tp; - platform_profile_notify(&platform_profile_handler); + platform_profile_notify(platform_profile_device); } return 0; diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 198bfe3306be..3806f9efaff8 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 4f80a73eff9f..e8d2de9bb646 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -420,15 +420,16 @@ 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->ppdev = devm_platform_profile_register( + dev->dev, "amd-pmf", dev, &amd_pmf_profile_ops); + if (IS_ERR(dev->ppdev)) { + err = PTR_ERR(dev->ppdev); dev_err(dev->dev, "Failed to register SPS support, this is most likely an SBIOS bug: %d\n", err); - return err; + return err; + } + + return 0; } diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 5c7099dc6109..809ab0353b68 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 *platform_profile_device; 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->platform_profile_device); return count; } @@ -3891,15 +3891,10 @@ 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 == -EEXIST) { - pr_warn("%s, a platform_profile handler is already registered\n", __func__); - return 0; - } else if (err) { + asus->platform_profile_device = devm_platform_profile_register( + dev, "asus-wmi", asus, &asus_wmi_platform_profile_ops); + if (IS_ERR(asus->platform_profile_device)) { + err = PTR_ERR(asus->platform_profile_device); pr_err("%s, failed at devm_platform_profile_register: %d\n", __func__, err); return err; } diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index a8961de004ab..1eaa746eb4f1 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -414,7 +414,6 @@ static struct platform_device *platform_device; static struct device_attribute *zone_dev_attrs; static struct attribute **zone_attrs; static struct platform_zone *zone_data; -static struct platform_profile_handler pp_handler; static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; static struct platform_driver platform_driver = { @@ -1165,11 +1164,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); } static int __init alienware_wmi_init(void) diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index dda6f13295e8..4ff80ed4f157 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 8a620d36f926..1b9e176f8d6f 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 d34d565172f5..55aac0190624 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,15 @@ 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 543e4bce1a57..9e2f24de0207 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 a0b8987bc328..964f842ef756 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -962,6 +962,7 @@ static const struct proc_ops dispatch_proc_ops = { static struct platform_device *tpacpi_pdev; static struct platform_device *tpacpi_sensors_pdev; static struct device *tpacpi_hwmon; +static struct device *tpacpi_pprof; static struct input_dev *tpacpi_inputdev; static struct mutex tpacpi_inputdev_send_mutex; static LIST_HEAD(tpacpi_all_drivers); @@ -10553,11 +10554,6 @@ static const struct platform_profile_ops dytc_profile_ops = { .choices = dytc_profile_choices, }; -static struct platform_profile_handler dytc_profile = { - .name = "thinkpad-acpi", - .ops = &dytc_profile_ops, -}; - static void dytc_profile_refresh(void) { enum platform_profile_option profile; @@ -10586,7 +10582,7 @@ static void dytc_profile_refresh(void) err = convert_dytc_to_profile(funcmode, perfmode, &profile); if (!err && profile != dytc_current_profile) { dytc_current_profile = profile; - platform_profile_notify(&dytc_profile); + platform_profile_notify(tpacpi_pprof); } } @@ -10647,14 +10643,14 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) dbg_printk(TPACPI_DBG_INIT, "DYTC version %d: thermal mode available\n", dytc_version); - dytc_profile.dev = &tpacpi_pdev->dev; /* Create platform_profile structure and register */ - err = devm_platform_profile_register(&dytc_profile, NULL); + tpacpi_pprof = devm_platform_profile_register( + &tpacpi_pdev->dev, "thinkpad-acpi", NULL, &dytc_profile_ops); /* * If for some reason platform_profiles aren't enabled * don't quit terminally. */ - if (err) + if (IS_ERR(tpacpi_pprof)) return -ENODEV; /* Ensure initial values are correct */ diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index cadbd3168d84..97ce9bd476ab 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -47,10 +47,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 9 15:06:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932796 Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15D5421E0B2; Thu, 9 Jan 2025 15:09:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435367; cv=none; b=GzJxxELZASjBq76kvKKQK8y28ylKyjKaa56LTqEnvwERHapNrNVmA7QEcmN6Q6SvoREHRpKi0fb08GoSUXRii+KNO8LVr0vrUjGGAdTfwddw5JvN7wAUyEaj3uh+B941/7R93AjI5hML2b4J5aid3QmMjXY0R3/yPV4cN1rT0mU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435367; c=relaxed/simple; bh=i1hkCbOJ7q5N58BzzZuDKEF4nYTEIMOkaF5e1YHrW2E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TtFaQ6jDYKNbj1E2qjGin7ccIv+hN53JHW93dGGoTtBiIWAYJ8q4KhROvmoFWczPEUKp1HbtfCr87JDOC3HlysBkqV4Jm3wAAMGXhFWTWG88PuMD1X5Y4ywD/9LxoxgC+JKbgVH4Kkjm7luXTW5QSBVMPwAagR+YLn0CDqARahk= 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=WqA4Os84; arc=none smtp.client-ip=209.85.217.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WqA4Os84" Received: by mail-vs1-f43.google.com with SMTP id ada2fe7eead31-4afd68271b6so369736137.0; Thu, 09 Jan 2025 07:09:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435363; x=1737040163; 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=XtwVtWXb7+6+BigRjgrXxEKF2qLe5aBj3AnEv8mSJuQ=; b=WqA4Os84wMQb74Anzzv3qSWiGSyddbVYCkn5Mpru41TJyYx8ISAjYvOVV7Q9iu2aSL VbM/AcFs6LIginWARq4XFTr3Q+uuiPAcAHYooBL2W2A4IQReraB7f64NkppAnbZS0ZiF nZfI3Y6TuhwDZ6RRGmdyxAO+ouq1UdeWOJ4rHkuHopSWsA7kd2f7f8r7H4FGuxZ7byem 2ZFXtbtYEockIhgZpzuc1LQPafhAeHfpPZdvgn5fiGE3Bl2LK/HPdl4rlmyt5WNpx8II UkfwQ+qt5tK7z6hVdGzKnwhZOCFkfwmNIWO27Xw8gpZkeJDp5e4Cj2nPH06qYz1eQbXX jSyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435363; x=1737040163; 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=XtwVtWXb7+6+BigRjgrXxEKF2qLe5aBj3AnEv8mSJuQ=; b=oyIg/lqW8ohSYEE1XdHgHgwIs9j0uvSkDoYfLW+b0oQw7IHqv1tB8mZcp8+SuGhFFa eJwxwDGoL7Pgm0tfjH5itNjRTbfOFFp8pC1qMDQsFUByEvSjOaXvYKAIKwh+YLm291Dj HfRTXPSqNDbBYcQxmJCfiWdASeLpx77SdJHQ0em3k8f/BILVPy6DAJPXE9LPHFu/yNcI ZH9z4xiIsXnlEs3fTkdhs3c6VkOLhSzvydFgtYdrPL7nT/3FP0m48rWb3ei13X+2uKDr z2wqgw81bnXcze52JYkxUbz2SRia7VC+qYLayG+gAmGZ2Zz5eneijtbArk+NSwmZfB4f TphA== X-Forwarded-Encrypted: i=1; AJvYcCU2K2ToofpUNfferNDmw4N/QRW7hnSmhA9Ufoh3NbXKKN9jzsRm7fTo1hCHNhrXL83Y1rvpIqiIpYsMoSY4@vger.kernel.org, AJvYcCUISdFgW4+Ed3Rbrihv2S8dvjO6vVz/bGudlhLfKk/1OGbcQYQUKIPRyxAE3fwLzoGHApkbGd449Hp4@vger.kernel.org X-Gm-Message-State: AOJu0Ywx4a2I8fK9k+2gGhc/3p2ychWUCxoDe3V2F8mPAb+Wzv44Yyet NCtuf+hZrGQ8KLWitd5Qf2DxIe9MUfETqqDM+nYEDjxTO5vdoWT2d0vf09qD X-Gm-Gg: ASbGncv1cIyG8nNUCKYNMzRIplpXTYeUxxTG2PjbW2F9fHAKLDXrYHixmSV5GMz0eR/ YTb/u4Rve9umGESH5uDDKAhKxUPOmQ44JUBtARqpJSM2v72GnIa98kvzV6iPXEWcpSMFW47I6bP caIAGh2aHCUZ4YeRUmTwcwcU/veF7YQGleYLjHXl0LYdSKqnJruFhxrHNgLRgJ/KzSLGIVu2EeU ZHDDOiD40XOKz6L12Txf3fgFrMawzraVJzP1aT7ksJXKqfJlWQbmOfQFuWiTmRG X-Google-Smtp-Source: AGHT+IEMJjK53/5tqcyv5W9ab1/qYLjDiCsFQ9+SvzwlB5Ic3l/z2qaQ4b3TjqaR47c4JzoeCMxiOg== X-Received: by 2002:a05:6102:290f:b0:4b2:5d63:a0f3 with SMTP id ada2fe7eead31-4b3d0f2d89cmr5797297137.15.1736435363284; Thu, 09 Jan 2025 07:09:23 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:09: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 , Colin Ian King , Alexis Belmonte , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 15/18] ACPI: platform_profile: Remove platform_profile_handler from callbacks Date: Thu, 9 Jan 2025 10:06:28 -0500 Message-ID: <20250109150731.110799-16-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja --- drivers/acpi/platform_profile.c | 6 ++-- .../surface/surface_platform_profile.c | 18 ++++++------ drivers/platform/x86/acer-wmi.c | 16 +++++------ drivers/platform/x86/amd/pmf/sps.c | 16 +++++------ drivers/platform/x86/asus-wmi.c | 16 +++++------ drivers/platform/x86/dell/alienware-wmi.c | 12 ++++---- drivers/platform/x86/dell/dell-pc.c | 14 +++++----- drivers/platform/x86/hp/hp-wmi.c | 28 +++++++++---------- drivers/platform/x86/ideapad-laptop.c | 16 +++++------ .../platform/x86/inspur_platform_profile.c | 16 +++++------ drivers/platform/x86/thinkpad_acpi.c | 12 ++++---- include/linux/platform_profile.h | 8 ++---- 12 files changed, 88 insertions(+), 90 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index fdf79b81b62e..8d034d928e32 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -67,7 +67,7 @@ static int _store_class_profile(struct device *dev, void *data) if (!test_bit(*bit, handler->choices)) return -EOPNOTSUPP; - return handler->ops->profile_set(handler, *bit); + return handler->ops->profile_set(dev, *bit); } /** @@ -104,7 +104,7 @@ static int get_class_profile(struct device *dev, lockdep_assert_held(&profile_lock); handler = to_pprof_handler(dev); - err = handler->ops->profile_get(handler, &val); + err = handler->ops->profile_get(dev, &val); if (err) { pr_err("Failed to get profile for handler %s\n", handler->name); return err; @@ -490,7 +490,7 @@ struct device *platform_profile_register(struct device *dev, const char *name, if (!pprof) return ERR_PTR(-ENOMEM); - err = ops->choices(pprof); + err = ops->choices(drvdata, pprof->choices); if (err < 0) return ERR_PTR(err); diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 965940223892..0d059986cc5c 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) @@ -201,12 +201,12 @@ static int ssam_platform_profile_set(struct platform_profile_handler *pprof, return tp; } -static int ssam_platform_profile_choices(struct platform_profile_handler *pprof) +static int ssam_platform_profile_choices(void *drvdata, unsigned long *choices) { - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pprof->choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->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; } diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 2059b29dd36b..2900ba060cc4 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1827,7 +1827,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; @@ -1862,7 +1862,7 @@ acer_predator_v4_platform_profile_get(struct platform_profile_handler *pprof, } static int -acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof, +acer_predator_v4_platform_profile_set(struct device *dev, enum platform_profile_option profile) { int tp; @@ -1901,13 +1901,13 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof, } static int -acer_predator_v4_platform_profile_choices(struct platform_profile_handler *pprof) +acer_predator_v4_platform_profile_choices(void *drvdata, unsigned long *choices) { - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_QUIET, choices); + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); return 0; } diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index e8d2de9bb646..700a6ef39201 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; @@ -387,11 +387,11 @@ static int amd_pmf_profile_set(struct platform_profile_handler *pprof, return 0; } -static int amd_pmf_profile_choices(struct platform_profile_handler *pprof) +static int amd_pmf_profile_choices(void *drvdata, unsigned long *choices) { - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); return 0; } diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 809ab0353b68..11e5fcecf3a4 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: @@ -3852,11 +3852,11 @@ static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof, return throttle_thermal_policy_write(asus); } -static int asus_wmi_platform_profile_choices(struct platform_profile_handler *pprof) +static int asus_wmi_platform_profile_choices(void *drvdata, unsigned long *choices) { - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_QUIET, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); return 0; } diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index 1eaa746eb4f1..19b7cd95018c 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -1055,7 +1055,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; @@ -1081,7 +1081,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) { @@ -1107,7 +1107,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof, return wmax_thermal_control(supported_thermal_profiles[profile]); } -static int thermal_profile_choices(struct platform_profile_handler *pprof) +static int thermal_profile_choices(void *drvdata, unsigned long *choices) { u32 out_data; u8 sys_desc[4]; @@ -1140,17 +1140,17 @@ static int thermal_profile_choices(struct platform_profile_handler *pprof) profile = wmax_mode_to_platform_profile[mode]; supported_thermal_profiles[profile] = out_data; - set_bit(profile, pprof->choices); + set_bit(profile, choices); } - if (bitmap_empty(pprof->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, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); } return 0; diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 4ff80ed4f157..1ba2e58451e1 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -184,7 +184,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) { @@ -201,7 +201,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; @@ -230,16 +230,16 @@ static int thermal_platform_profile_get(struct platform_profile_handler *pprof, return 0; } -static int thermal_platform_profile_choices(struct platform_profile_handler *pprof) +static int thermal_platform_profile_choices(void *drvdata, unsigned long *choices) { if (supported_modes & DELL_QUIET) - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); + set_bit(PLATFORM_PROFILE_QUIET, choices); if (supported_modes & DELL_COOL_BOTTOM) - set_bit(PLATFORM_PROFILE_COOL, pprof->choices); + set_bit(PLATFORM_PROFILE_COOL, choices); if (supported_modes & DELL_BALANCED) - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); if (supported_modes & DELL_PERFORMANCE) - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); return 0; } diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 1b9e176f8d6f..3849cf761a46 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; @@ -1488,19 +1488,19 @@ static int platform_profile_victus_set(struct platform_profile_handler *pprof, return 0; } -static int hp_wmi_platform_profile_choices(struct platform_profile_handler *pprof) +static int hp_wmi_platform_profile_choices(void *drvdata, unsigned long *choices) { if (is_omen_thermal_profile()) { - set_bit(PLATFORM_PROFILE_COOL, pprof->choices); + set_bit(PLATFORM_PROFILE_COOL, choices); } else if (is_victus_thermal_profile()) { - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); + set_bit(PLATFORM_PROFILE_QUIET, choices); } else { - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices); - set_bit(PLATFORM_PROFILE_COOL, pprof->choices); + set_bit(PLATFORM_PROFILE_QUIET, choices); + set_bit(PLATFORM_PROFILE_COOL, choices); } - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); return 0; } diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 55aac0190624..1937a2f00bec 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; @@ -1023,11 +1023,11 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, return -EINTR; } -static int dytc_profile_choices(struct platform_profile_handler *pprof) +static int dytc_profile_choices(void *drvdata, unsigned long *choices) { - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); return 0; } diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 9e2f24de0207..3d45df807b8b 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; @@ -164,11 +164,11 @@ static int inspur_platform_profile_get(struct platform_profile_handler *pprof, return 0; } -static int inspur_platform_profile_choices(struct platform_profile_handler *pprof) +static int inspur_platform_profile_choices(void *drvdata, unsigned long *choices) { - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); return 0; } diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 964f842ef756..2e9740b7e328 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; @@ -10539,11 +10539,11 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, return err; } -static int dytc_profile_choices(struct platform_profile_handler *pprof) +static int dytc_profile_choices(void *drvdata, unsigned long *choices) { - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices); - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices); + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); + set_bit(PLATFORM_PROFILE_BALANCED, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); return 0; } diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 97ce9bd476ab..0824a12b9998 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -31,11 +31,9 @@ enum platform_profile_option { struct platform_profile_handler; struct platform_profile_ops { - 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 (*choices)(struct platform_profile_handler *pprof); + int (*profile_get)(struct device *dev, enum platform_profile_option *profile); + int (*profile_set)(struct device *dev, enum platform_profile_option profile); + int (*choices)(void *drvdata, unsigned long *choices); }; struct platform_profile_handler { From patchwork Thu Jan 9 15:06:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932797 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E6DE223339; Thu, 9 Jan 2025 15:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435372; cv=none; b=THQ+pfdDx4aNtDSUAtm3VeU91s+Dl04rCWx1ggAAYluG5j3R3s7FZpqmV9mCWp1ASK1HDRvBfMQd7IOCqym22eB0bFRvB9e73t+xn9dDGD/Gy+yPTwYg0/Jfl5NVMHThp4+tTlCp7cHVdOpFqikiSGiPwzxtAPimhahW1GIsMzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435372; c=relaxed/simple; bh=hd4xcYLw3nB/xyzAEl3lcxHF1IrhA0+QO6bMSUHHYl8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o+/ieewXI4l0WLTV5DXK4yA4VO+0E71CAO5ikKxr4zZUA3WmYsJPvudp+NZgs5ekOejVtUknX9KNQv5qGNggKNAkyy5kOmx3p7NGtyQvICGCFoXUu8FXI5lsbPZN+5tkOuP61E81r/d44P3N/po2OI5OYeI5XMo3Lulic0G/LZU= 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=j+FEqLfU; arc=none smtp.client-ip=209.85.217.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j+FEqLfU" Received: by mail-vs1-f45.google.com with SMTP id ada2fe7eead31-4afe2f6cecdso994542137.1; Thu, 09 Jan 2025 07:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435370; x=1737040170; 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=LCPUh3IUWcLS4g8ZtG6u3bDbqVNKgPDzo14k9ivGOUE=; b=j+FEqLfUTEZp4dmfmJhkapPfU7FlhaAZul+uw5c3m1cI3/Gj1RmNaYveEfQ7lm4atj VolFj20yT0NMt9TK7fsIN0cPXtQQ2mUR4O9n8/e36pXZaDqc6lseimdg4yn1s3xyilmz 0NjYC+sTMpNmWQ7z2LPeaiNQQCSvsNU/3oxZoUQpt7WMFS3xztF2YHM1lgDPo32Js5gx BSeVyCa7maiVLUp3S0sQ/KQqInlVd3WKUc7YaQlONNfrTbYo5OG25rx8cZixwtkw1Czq nv7MnnpJhbigOXHLzzzl0om3rW/Gzh7lebkOapDtsNdaofwtgLcwqBcfFDaQRPHq9diI 5oGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435370; x=1737040170; 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=LCPUh3IUWcLS4g8ZtG6u3bDbqVNKgPDzo14k9ivGOUE=; b=C3t5m2wXZ3+P7GZggRmmbiAbKltUsihDODkMgDuXyZqUmqmrRqd9Syq3RBleuVOT2G VJYsmf7feb7qiXHJ24AgDoL9zLSz3tWKoo0DiVThAGu1XVLhSKkcm4GPfssCUzcuQ0BT cxF97V3y23x566cGQGrqE0GLaCjLwYpzZpNYdaIJL3FIVhAYSW9oUS+liDQ620Sd18+3 1rUkhhTGM8qhTASo1CLp1lXP39JVBToV0CHEBFsdX69pPBz4blXH3L2K0AD+LacJ+8MY /AUsnofzBMaN9YpeAWVmUkUzVFLmarA9YxboN26X1tI7D+dtZ5/nFRuUeiEzxxu8OiZg /U6w== X-Forwarded-Encrypted: i=1; AJvYcCVuD7lT1pfmSJokG9814qc5aqN4Up8Q67S0ruMjig1r+TLz+iDhTXM1dB4DkuEzjzZ/oTWY4Vx8Vwje@vger.kernel.org, AJvYcCXaGA8ByuaGGLHN4j3aXZrG/+FPgNumDz/2IDtx0CW0L9UCG/cMoWAMgQTj2lFMjp3zx8JOlynAKo9Ko65S@vger.kernel.org X-Gm-Message-State: AOJu0YxswBSc43+/DUbx+IetGz7eY9J1WLhNQN5UEdxX9f3MZ4ic4xfI OMP8QjLZgpjYttDzW77zyvs7D7gzG8TeKsFY47qxtHfpCa2ELLIjr/G4SBOM X-Gm-Gg: ASbGncv94ZIEmb0b4Ezj8LyJIN5Q7SNIsiwN2hltdUCLwlKYFh2S3agY00zlAV0tzse teBUuVKEPaO/Qjw4rRx5Wly39IcqJ1qq4WHuVm4CinhHdwmlb6r0PXiSohN36JU/+n+BvaKZ/ni DOxHYzRDcoASYQzH++RFVF5mkCwSXkAFWbixPfUGbwGk/qh6eCUfYcFyCONscwqkJOzMD6rHVZP mTmAEcTqq7nl1voAymhuLpbJgdqN5CDYK6hichkfZZWYGdDvamtzGX88vH/JIz9 X-Google-Smtp-Source: AGHT+IElwwsp4NqbvFdkiIUnAd+c3k1JAKYhoPpPzIupjHSpN5n+crDibgLtTHnzuH71WFxJFnotuw== X-Received: by 2002:a05:6102:3c92:b0:4af:ed5a:b68d with SMTP id ada2fe7eead31-4b6092b35f5mr2035296137.6.1736435369783; Thu, 09 Jan 2025 07:09:29 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:09: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 , Colin Ian King , Alexis Belmonte , Ai Chao , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 16/18] ACPI: platform_profile: Move platform_profile_handler Date: Thu, 9 Jan 2025 10:06:29 -0500 Message-ID: <20250109150731.110799-17-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonceillo --- 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 8d034d928e32..c7a867bd01df 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -15,6 +15,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 0824a12b9998..2c99aff7cd19 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 (*profile_get)(struct device *dev, enum platform_profile_option *profile); int (*profile_set)(struct device *dev, enum platform_profile_option profile); int (*choices)(void *drvdata, unsigned long *choices); }; -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 9 15:06:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932798 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14215220689; Thu, 9 Jan 2025 15:09:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435378; cv=none; b=vAzb5349Cxq+ZhhG/x5gQd8phuRpqDmf6ne08oKXjDdkCTs2Gnd/fFYpkx9vlerSYPF1hrLfSMc2nQAIJifi83AEP/UU4vrLXYmxOVyDxniU+EsP5zfqaXqApJlo9AnQyDDr3MmuC2D7oc0pegZMll7LgUBk1zlHZWPklzQ2GGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435378; c=relaxed/simple; bh=S6ZvjFeEp+wC82iABXX4BtMKahSZbvZujvbdRq1PYTE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pv1vfRDgA/zX1l3DR34fSnXoKAR5TGQj2clcUawjJDX0wrzCsoy0RPKFnXANfIKUbR3bRlsgT9N0FsOGIAgOdNY3nFULX1Y1+DsGsJ8TwhjhZQpHaU7Zo9x7fbkDYJs0jUqtBHKzXSqT8wqlMqZmssjViN9mNHpgn2XIO8u9qpQ= 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=Tc2gvbBv; arc=none smtp.client-ip=209.85.217.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Tc2gvbBv" Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-4afe99e5229so342941137.3; Thu, 09 Jan 2025 07:09:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435376; x=1737040176; 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=alWZYIMhk442ua4+AXwxd9UcSCUot/ASC61cF7csBfY=; b=Tc2gvbBvrVE8Xnm2pxZXquchJKe17O4OR9TYwQ8h9hYwwQev03ZG8gyfpYRu3v4Pto vygWlUan445IolsEMVaBspl5ohmu06eTJRD1b3bD40MlfBA5BJECgjntZ4KPBvMhtIL1 F/TMaa8FDjzNcr+oyo2Qi8xpqiviGPeRqwLzHCIoRvEo8K+zim+c4l3+TYtqEoTtyTjO 60eH0iSe+HexhtPVF+PiyN7qU/AMwWeTYA+Dqdc3DEcBcmrJFg1SV+pVHncmbF8QRWFu 1xWZpU/VqJpezmIrXuuv9PjQoKS5D1m1o4LIZGpcN5WDIjIaF/Npkjvc43cXDg7Tn7Fm 9okA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435376; x=1737040176; 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=alWZYIMhk442ua4+AXwxd9UcSCUot/ASC61cF7csBfY=; b=ZPUTo2tSKRa10ZReOppZ/FQaW3KCXAiTRX3ilyKkt54UKFg/hgqOYU6eNvWQGPGixd pcIl2QvLdrPvzXoBPA9k31Pod7EjqIw+nKQ0QBLnZQa3q7U4pEZlqmKNz4gfvA/cQV/t xDKm96r5bPypbJhmMsUpsGNINdE/7mfZDrTUlAL40oEbNOsFGD1DQjDi+/QmJK92wnFz hmbBuGGJMOTi/U3U9LupZ/qUaB2aP280rMUqHq2ueSU/Igh1wdgOf917dYTON5aM8m99 VykzHzoEIuuxIGAoGL83IoaJ/O7n/JYuKkZJRoba00TyuPDLE6j+MFkAAKj3ZJ2NiRJT XVyA== X-Forwarded-Encrypted: i=1; AJvYcCWYM430eSOB7x6tmE43HwQAbzJOGhmgDJCZRbfT/7UmMcf4Q3NiFl2R1wHuPlQSE8cvyy6rml+LF4/B@vger.kernel.org, AJvYcCXjVxz7PmD232wqE/lteTbo+ea/8GR+iWlx6mWOO+hiyNzMFppRNTscDFp9WE2/75Ln83pJFO/gpIvk+UpZ@vger.kernel.org X-Gm-Message-State: AOJu0YzhuvlTk4ihlbVu7a/40vkIHuSlzxj+nkQuyuqANYLtXpyRuhih phyw8n424GBX82cJjzkxFG0bk7o8dJytENmhcQ3X+yimUaXTTKlrzR+OWMC6 X-Gm-Gg: ASbGncsYA5hRS9KezgvRTEXz08nQBmYmbUyANxg4LEKU+3YD9aCqbG2VAXKCVqRDNpl 3EEtbOrQEb7TnTZqiyiwMVL7OYM13raMGxbGyU3C0alZYA1IXh+7nEl1z1Tzl6YlAc/ldhKxTVG WN8fKF9Sfr37z10UGp3kTaxmH6htf3KqljXJSKi4SHeMaBCwbtcB2XPCs6m9YGoTf7kEbf24VJK 87aNQEWNyR7M8NpLFHFTVp0qyqpKXQwTlAykTBCIRxyJsL9w2yldFOIPa/t06dG X-Google-Smtp-Source: AGHT+IFzJbwR1i5MRRJJwaT3bDY8YUxgY0hlGnEP4U8e2NG9/hsZi7OE1YoWuNz7wna4U9mU4EmOWw== X-Received: by 2002:a05:6102:4a98:b0:4b2:5d65:6f0 with SMTP id ada2fe7eead31-4b3d1048269mr6227064137.19.1736435375741; Thu, 09 Jan 2025 07:09:35 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:09: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 , Colin Ian King , Alexis Belmonte , Ai Chao , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 17/18] ACPI: platform_profile: Clean platform_profile_handler Date: Thu, 9 Jan 2025 10:06:30 -0500 Message-ID: <20250109150731.110799-18-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja Reviewed-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index c7a867bd01df..8c79ecab8a6d 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -11,14 +11,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; @@ -91,8 +90,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; } @@ -518,18 +517,18 @@ 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); - err = device_register(&pprof->class_dev); + 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); + err = device_register(&pprof->dev); if (err) { - put_device(&no_free_ptr(pprof)->class_dev); + put_device(&no_free_ptr(pprof)->dev); goto cleanup_ida; } /* After this point, device_unregister will free pprof on error */ - ppdev = &no_free_ptr(pprof)->class_dev; + ppdev = &no_free_ptr(pprof)->dev; sysfs_notify(acpi_kobj, NULL, "platform_profile"); @@ -556,7 +555,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 9 15:06:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13932799 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (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 4BCE0224888; Thu, 9 Jan 2025 15:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435387; cv=none; b=UDH1I9741LmR2GYlz8OGgoYqp5NzlUBidzVghmjSCv3ax3Bm/ZoDtieT5wUWIRgVJwmt64CW6yaPSPVpaGM1xrRiNjA5VCCyo2ZvsLiIljKUCL/aILBthZdlgwEKA0YbOKv7Cf90nbRQycUEkrOKHb2i3TYNdopQ7XZQIQibuLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736435387; c=relaxed/simple; bh=ueES1CpHxkIOmIdddrXeMAV9rO12JLZzujSA/AYR5iA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uo94KCC1jqqPLNVMee30SkJ9Kj5Zscky/aarmPF4xXALOO88Bd9SCcdqKrdAxjkE4tI7xigTh31GS8tOck/U32BDSRnWiazIHAFS+ErPFVtxoAtaql2qv/6X1UHicmd7jvGEYD0NbuHVDABlgVI4PdMdSgU7+LlDvx0aLuZbyek= 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=HUOWJ5zw; arc=none smtp.client-ip=209.85.217.47 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="HUOWJ5zw" Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-4aff31b77e8so427887137.1; Thu, 09 Jan 2025 07:09:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736435384; x=1737040184; 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=tXWFMX8a8Q4Pv2GPHLPCd0mT4LshIMD7WrNQh2s1+XA=; b=HUOWJ5zwI6QVQBYyLBzSXQLAkG+H6cfWWZJV4G8+WvRDpoY1D2xMjqmqIG4vyE7eU/ W9yY61mMKeu8FdMW5moV4pMG38D3tf6qJ8uUqW1SL0j5M6DFF5Cn8SJZyqKlxHOigrUg p5IBWitrMDuCJKOxMCNWoCBsfoIa9pJR0LPtnpb9HEaTqsS8Az74qI/peQa17eKWjuKH 0FuZqcRTeSkpviF+r2oKD6KwoR8HkftzyxdWeOHxLu7yFp8grDtCO8wKLQJ5mOblrKw0 dEZZYAwWv0h7totJf3+mtVOToYC+a6dbr6zrAWr5vGSFSPc481mkCo23MTJA8inVuQZ8 Z6Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736435384; x=1737040184; 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=tXWFMX8a8Q4Pv2GPHLPCd0mT4LshIMD7WrNQh2s1+XA=; b=hl5BxvMDD6hSX2hDC3ldhM8NfzAzWxfOXAGtSCnz0r9/Ix+Ef/0HjWhkc1MXCsY8iU NWNdy3dy1vXRforO3JR45u1KzV/05OTl8M5qyTumECtMPlzP0Fwcy6TAaRtsIub4+GIY vhMmGHkzketHjYs4z/ww1f0EeEX2xhf0OEaifSFTndem9nKQoW7IkydJLLT6fd+Tm7D7 FlSdqPGmk/CltP8XISN33m7iAYTi+ccsr9Pw+D+yCqj021C77NcK7Ifqyu3eNOg5vVdQ PwHmpFuf88mkLKpiMqYtIrDVWGzBh2eyhrl4lOS04kfLrkBNknyhEOiDL8xHJEwPxFfb Of5w== X-Forwarded-Encrypted: i=1; AJvYcCV13LOjadxFlbyaBl/E5+23Xxee+d7cilUSf3VY4RwVMg5dltdh0EdCONbm9z+ZEmO1YE2F9A9vjeoPrgc2@vger.kernel.org, AJvYcCXk44Op/K9gMqhvZWgcJwUuTtF587360UXCDtkJ08P9Z/P/8HOniPBAnrG2f4RZsn+oiaUFyZcX2F2r@vger.kernel.org X-Gm-Message-State: AOJu0Yxr9lFese2+RGEw6+aULeaHfUpYVnIpW/3B8ARYJc8pecpZPTer UpzQSndGvRT9CnVNc0KfscTpBYTM/JdCAgj20NiDon2aPzE32x6Le/1V0VCc X-Gm-Gg: ASbGnctXeqvjGgWAq7n8Mqsk2ttdo9DUIR2a+pcZmAeEZbfUVveaE4qDpLSL3ZsnqXT xMiJRdsYztDlknhjReDlcsLe19iZQ2V4hZr4Kag/6GOCcr6cc74b0ATReaidJRjs0HbfsR4EVFJ svGu7JxSFBl+LRpTvo7hyR7AAGY3xG76ek/iJ6HKaYpnWkyF6D60RFGmAkaXnQSJt0bFFb3xKzh kPphfuEZVEtJGfCa8Z49dRWaOYSX8jXrtuduHmCPyGIaDh51sQnL1GX1EoYES95 X-Google-Smtp-Source: AGHT+IHTsiyxTdRhLAyXTzqH/vzYBKjh+K4a/SbVvKlT32OwOtIjQS0SYK32yrgF2TjbYCaJTMQ51w== X-Received: by 2002:a05:6102:cc6:b0:4b2:bc6a:2e8b with SMTP id ada2fe7eead31-4b3d0ef6127mr5990268137.3.1736435383993; Thu, 09 Jan 2025 07:09:43 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:1ea9:11b1:7af9:1277]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4b608f4a5ddsm1019887137.11.2025.01.09.07.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 07:09: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 , Colin Ian King , Alexis Belmonte , Ai Chao , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Gergo Koteles , Dell.Client.Kernel@dell.com, ibm-acpi-devel@lists.sourceforge.net Subject: [PATCH 18/18] ACPI: platform_profile: Add documentation Date: Thu, 9 Jan 2025 10:06:31 -0500 Message-ID: <20250109150731.110799-19-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109150731.110799-1-kuurtb@gmail.com> References: <20250109150731.110799-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. Signed-off-by: Kurt Borja --- .../ABI/testing/sysfs-class-platform-profile | 44 +++++++++++++++++++ drivers/acpi/platform_profile.c | 33 ++++++++++++++ 2 files changed, 77 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..59486dc4313f --- /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 signalled 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 8c79ecab8a6d..5d74675c5419 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -426,6 +426,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) { @@ -435,6 +439,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; @@ -478,6 +487,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) @@ -548,6 +566,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); @@ -573,6 +597,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)