From patchwork Thu Jan 14 07:34:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 12018743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECE59C433DB for ; Thu, 14 Jan 2021 07:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A69D4238E7 for ; Thu, 14 Jan 2021 07:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727184AbhANHmP (ORCPT ); Thu, 14 Jan 2021 02:42:15 -0500 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:55133 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726806AbhANHmO (ORCPT ); Thu, 14 Jan 2021 02:42:14 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id A2DA3132C; Thu, 14 Jan 2021 02:34:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 14 Jan 2021 02:34:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=pl/fwFs3liZoW 1v6PYB/hJz7Z5at8pyDDKPnWlYHs1U=; b=Vjx7eaOy1vJv654LTe33cK7wrK7ki cxqh1sckvpLPILenpW40fU96MM0i5tqiJWOvH6wZXPHeGIoK89GxBsJfFvxtbrWa u/ZViEotgUSHRpcx4fX9RcaHRQTPTuDUufSbW8SGpTmpB6P+yIXVya8uaCI+DsCk RI++t9XnAEGt60pubaZCL9axdNvaoFT51FE9VGCyhqKbZqD5ybJhKKrY7kyL0EBL k/of1r1lwdAykELA10rhhR56fnN7yaBi2KVfKIeviIlcAGhm7+pshE92rUvYiP8G Tsffk34iueSsuprrt5lwKUub3OIRcirU65PsLjlNzTp2JSIfBOEDTO5uQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=pl/fwFs3liZoW1v6PYB/hJz7Z5at8pyDDKPnWlYHs1U=; b=m4+3rHxg q3fjYVSNPIXoHSYd+cwQwAxEnlVDa8Ad/BKqihP3amQStSTsrRk+KAuySHMfms1N WkSocEcHJgZUo3nRL5ODSiVTzbq2XTst3iIlXYsDPMPf6lVPUtLNGK/2iBoEaHsE TQ28Ikln1/iJnecSsEf1vSzCpYns702p1gs/zbfThdjDqgdu1dxEgX3vQ3IDUDe0 kl/7N6fyhgX3h4WLV5kPGd7TJzsPEdOuDgl+mJV37SmLXF3KfNEpJ2imTHji3EhL HXwxf7MBpZMejkZysOeWZb/EzaGq0KWNqxlLpF76gjKPthv4hnBl8n9B7KgcvaHq Y/P2NaKr5AFbhg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedukedrtdeggddutdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhg sehflhihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpeehgfelvdeugeetheekge dvgeehhfektdetteelhfefkeeuudekvedtteffteegkeenucffohhmrghinhepkhgvrhhn vghlrdhorhhgnecukfhppeduudeirddvvdekrdekgedrvdenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhih ghhorghtrdgtohhm X-ME-Proxy: Received: from strike.U-LINK.com (unknown [116.228.84.2]) by mail.messagingengine.com (Postfix) with ESMTPA id AD72D240064; Thu, 14 Jan 2021 02:34:38 -0500 (EST) From: Jiaxun Yang To: linux-acpi@vger.kernel.org Cc: linux-pm@vger.kernel.org, rjw@rjwysocki.net, hdegoede@redhat.com, Jiaxun Yang Subject: [PATCH RESEND 1/2] ACPI: platform-profile: Drop const qualifier for cur_profile Date: Thu, 14 Jan 2021 15:34:28 +0800 Message-Id: <20210114073429.176462-2-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210114073429.176462-1-jiaxun.yang@flygoat.com> References: <20210114073429.176462-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org All planned uses of cur_profile have their platform_profile_handler defined as const, so just drop const qualifier here to prevent build error. Link: https://lore.kernel.org/linux-acpi/5e7a4d87-52ef-e487-9cc2-8e7094beaa08@redhat.com/ Suggested-by: Hans de Goede Signed-off-by: Jiaxun Yang --- drivers/acpi/platform_profile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 91be50a32cc8..9dddf44b43d4 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -9,7 +9,7 @@ #include #include -static const struct platform_profile_handler *cur_profile; +static struct platform_profile_handler *cur_profile; static DEFINE_MUTEX(profile_lock); static const char * const profile_names[] = { From patchwork Thu Jan 14 07:34:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 12018745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9697EC433E6 for ; Thu, 14 Jan 2021 07:42:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51525238E7 for ; Thu, 14 Jan 2021 07:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726806AbhANHmP (ORCPT ); Thu, 14 Jan 2021 02:42:15 -0500 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:46995 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727236AbhANHmO (ORCPT ); Thu, 14 Jan 2021 02:42:14 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 30BF2133C; Thu, 14 Jan 2021 02:34:44 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 14 Jan 2021 02:34:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=y9iRB6bWqyUOw TqFryU9bKwjbnx+WsNsQUdiHEf3u80=; b=yuOR9eeGEYszXoXcjxIOQ5wU5/gxW oAf1xKensHC9wRv5w7HYinK8QY1DqiozSUbTjTHE/WAAVewfPjRj4hXB6LvWXbTd zc89xW1IHFwUdKLYYovlsmjzZIiobwnfPeaPWotV3wb66wbsKpHd9sCywvy9yAYA PmQmj+BeXIGpvqnv9QYMDF064fElYp1GslkGE1ms79PEnAD9Gf4Cjm75SvUmbtqG LUV3Urc8qNo87QhO0GSwJmK1eP1Zqu/NDDpsrYZEUUZ/gHjocQXhpuOdYGucrSAY MIB/LueHOCAnldUJZHYVQrnORkIUTY1JMsq7a9iTB+kLzkpTu2UYWwGJw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=y9iRB6bWqyUOwTqFryU9bKwjbnx+WsNsQUdiHEf3u80=; b=PIirAcYc 6F+ruUoVAvsfEtw/snDwaXFKkzvT3zliRgCCn8UIhx/ypEk+hOfBNCY4Vpc5KAaa ATGo4lrloRR5YQKIae4iPd4ojlBF6vqClnRNb243B62ow0/ZOMwu72XLpWYI1att 6sUdLd6ICO0Mnedos3tz5N0Yy0KgaXqgisbTIjo4/By/ga6Gzu8XKuznCPq22ZBR YlCRcWy9xYXh8i3Nf6La19iEW9qQ7Yk3tb11wQVq4NQfJpWrKcW0P3eUvPWsBFBW VVHeQRj/1VDEOqCUT9AK/GGVXejLv1qAJ/qsBbf40TXVdSOwa5/ZSZ1PP7gRZ2e+ /ncSQcjaVnXLsw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedukedrtdeggddutdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhg sehflhihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpeehgfelvdeugeetheekge dvgeehhfektdetteelhfefkeeuudekvedtteffteegkeenucffohhmrghinhepkhgvrhhn vghlrdhorhhgnecukfhppeduudeirddvvdekrdekgedrvdenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhih ghhorghtrdgtohhm X-ME-Proxy: Received: from strike.U-LINK.com (unknown [116.228.84.2]) by mail.messagingengine.com (Postfix) with ESMTPA id 5B363240062; Thu, 14 Jan 2021 02:34:41 -0500 (EST) From: Jiaxun Yang To: linux-acpi@vger.kernel.org Cc: linux-pm@vger.kernel.org, rjw@rjwysocki.net, hdegoede@redhat.com, Jiaxun Yang Subject: [PATCH RESEND 2/2] ACPI: platform-profile: Introduce object pointers to callbacks Date: Thu, 14 Jan 2021 15:34:29 +0800 Message-Id: <20210114073429.176462-3-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210114073429.176462-1-jiaxun.yang@flygoat.com> References: <20210114073429.176462-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add a object pointer to handler callbacks to avoid having global variables everywhere. Link: https://lore.kernel.org/linux-acpi/6a29f338-d9e4-150c-81dd-2ffb54f5bc35@redhat.com/ Signed-off-by: Jiaxun Yang Suggested-by: Hans de Goede --- drivers/acpi/platform_profile.c | 4 ++-- include/linux/platform_profile.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 9dddf44b43d4..6398b40e6d31 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -64,7 +64,7 @@ static ssize_t platform_profile_show(struct device *dev, return -ENODEV; } - err = cur_profile->profile_get(&profile); + err = cur_profile->profile_get(cur_profile, &profile); mutex_unlock(&profile_lock); if (err) return err; @@ -104,7 +104,7 @@ static ssize_t platform_profile_store(struct device *dev, return -EOPNOTSUPP; } - err = cur_profile->profile_set(i); + err = cur_profile->profile_set(cur_profile, i); mutex_unlock(&profile_lock); if (err) return err; diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 3623d7108421..43f4583b5259 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -28,8 +28,10 @@ enum platform_profile_option { struct platform_profile_handler { unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; - int (*profile_get)(enum platform_profile_option *profile); - int (*profile_set)(enum platform_profile_option profile); + 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 platform_profile_register(const struct platform_profile_handler *pprof);