From patchwork Fri Jan 1 12:56:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 355788 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 026F5C43381 for ; Fri, 1 Jan 2021 12:57:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9DEE922202 for ; Fri, 1 Jan 2021 12:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbhAAM5k (ORCPT ); Fri, 1 Jan 2021 07:57:40 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:36673 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726693AbhAAM5j (ORCPT ); Fri, 1 Jan 2021 07:57:39 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 25D7758041A; Fri, 1 Jan 2021 07:56:53 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 01 Jan 2021 07:56:53 -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=/ETWZ4/0vUN6q k8OTyPL4Ov6POGsGEMJ3pj3b0rxw10=; b=TzeRUmDFW/zy7JbeS+HW2hWzgUy81 wfywMNo5H9l1dsQUENRD9qIm81s/RMFicByO7A6euV3ARAucYouC/C6Z1gPtrWVq Mr2e0GzTAka4iVEtq+ptrtTACXb4vSDttkGUylVKPuC4A9DgyO3HmoJ8jej0ZNW7 6uPgFcLZtK26wKC4ARjT5T7w+LW7uFVRdRKojgUsVoSAtuwyFRgpsFdWDCE2cCVM wEibcYqyLtZKt2/YhFFwiHq7TapdjfZ8/JYco+X18UJdv/+CEJbrOurjliewc+zn Heo51y4fNEPXsaqccFW0LljVEXNVV4AglZGsR1eGYSme2RUvE/AcBH2dQ== 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=/ETWZ4/0vUN6qk8OTyPL4Ov6POGsGEMJ3pj3b0rxw10=; b=bmGfekQ7 fH7/f/ZBCeXR+qyhbVLLcpzXOfiEtxeCDqTZjVklRTc0v1PwYQy4zd4TB9sQ/PEV yBfNntLk7AV3taiP4IvIwy9Yd197sSI4fmvWEd2YtsbrlALtxhNumKZLJvWp4m0b ybvs8C/t1ZcOd91qtyfaxAEnclntt+y9SwZ489hjeQViAAbeZybiNiPCE17rdoI9 ZFmtjNXP5EfTCgh2W1skwpIYTJwLcETFcOfCEEU/3jpZtD5Q6IAcUUd5ZRBhwjPx SRA4puBwvZ9J9E9vvO0ZJ/G24uB9EaRFv8fmxnxnrRsG4Y8PysQAQI0UpZTa2l3H zjbb0CXqh0Cl+A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddvjedggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeflihgrgihu nhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqnecugg ftrfgrthhtvghrnhepjeeihffgteelkeelffdukedtheevudejvdegkeekjeefhffhhfet udetgfdtffeunecukfhppeeitddrudejjedrudekledrudejudenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehf lhihghhorghtrdgtohhm X-ME-Proxy: Received: from strike.202.net.flygoat.com (unknown [60.177.189.171]) by mail.messagingengine.com (Postfix) with ESMTPA id 457CC240057; Fri, 1 Jan 2021 07:56:46 -0500 (EST) From: Jiaxun Yang To: platform-driver-x86@vger.kernel.org Cc: Jiaxun Yang , "Rafael J. Wysocki" , Len Brown , Hans de Goede , Mark Gross , Ike Panhc , Mark Pearson , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ACPI: platform-profile: Introduce data parameter to handler Date: Fri, 1 Jan 2021 20:56:25 +0800 Message-Id: <20210101125629.20974-2-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210101125629.20974-1-jiaxun.yang@flygoat.com> References: <20210101125629.20974-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add a data parameter to handler callbacks to avoid having global variables everywhere. Signed-off-by: Jiaxun Yang Reviewed-by: Hans de Goede --- drivers/acpi/platform_profile.c | 4 ++-- include/linux/platform_profile.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 91be50a32cc8..60072f6e032d 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->data, &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->data, 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..272faf55875d 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -27,9 +27,10 @@ enum platform_profile_option { }; struct platform_profile_handler { + void *data; 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)(void *data, enum platform_profile_option *profile); + int (*profile_set)(void *data, enum platform_profile_option profile); }; int platform_profile_register(const struct platform_profile_handler *pprof);