From patchwork Thu Jan 14 07:30:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 364226 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 F2D32C433E0 for ; Thu, 14 Jan 2021 07:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C430A238EC for ; Thu, 14 Jan 2021 07:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727134AbhANHgy (ORCPT ); Thu, 14 Jan 2021 02:36:54 -0500 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:54017 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbhANHgx (ORCPT ); Thu, 14 Jan 2021 02:36:53 -0500 X-Greylist: delayed 353 seconds by postgrey-1.27 at vger.kernel.org; Thu, 14 Jan 2021 02:36:53 EST Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id CC3E6131F; Thu, 14 Jan 2021 02:30:19 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 14 Jan 2021 02:30:20 -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=iNgJixmZFXWN3EvPGIHvF4OFkbnQR 58EZq206l/y9jZeH4mY3BV4+EX01pJQcYyE3i7xcl47E8nd5n832LNbTQ/lc7rbp zSNtZYXIpMOVoJcmfzP8eEjyDjHFYYzHyfHmci8vFJ0mTXkQqevUr45FxiEsCweQ WRCoj81DEaQeeDd+3eR0BaXM3tSgS7slS67CcuhADBbwjgvppwK8jGki+fff4iD0 GHaax0KMnklO26zhy9jNjBxVR7aEJNauJasqQzINGFD96q6jRb73JbZwr2i+nsw4 /WmyT3iijQQKWtwg5qPzbeMjxCP/hTUGq6q6RrhpWcmUcbYs/Ipb4pGkA== 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=UbQAdf7/ leM+QG+OK0qqlkzqH/TbOL/zFg/mC2ykzjQ8nNZ/ZUPBVyRSj2Kzm2fCUKCBrngv kba1IAB9gXrZbLGfu9bxTCAJht/8Uz2ToEyWFG98rRIBloGIr30dPAzRH4JCKH2M LVqvoVwasI6svMP6QdosV6k+w7YIwhajtunwqH54qxmMJy66Ssh/vN2fwv+cCiqF gFvxpvGK/pxOZq7GXIi3WY3kKDt3LlAE3emXtGCNZbOY04FBtj0WRvXHgZKe+saz Mxeyfjigj1gCzMVH6nogRgY4IKbUKHObPOm6ToBM6ajnfOZS/sG6s/e3uYyjNVCr oKi3mvLlPeUVrA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedukedrtdeggddutdekucetufdoteggodetrfdotf 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 BBDB21080064; Thu, 14 Jan 2021 02:30:16 -0500 (EST) From: Jiaxun Yang To: linux-acpi@vger-kernel.org Cc: hdegoede@redhat.com, linux-pm@vger.kernel.org, rjw@rjwysocki.net, Jiaxun Yang Subject: [PATCH 2/2] ACPI: platform-profile: Introduce object pointers to callbacks Date: Thu, 14 Jan 2021 15:30:04 +0800 Message-Id: <20210114073004.174502-3-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210114073004.174502-1-jiaxun.yang@flygoat.com> References: <20210114073004.174502-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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);