Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp78085pxu; Tue, 5 Jan 2021 05:44:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyud7UZmAs8o9QMC9OKv8/H1F36iZ5LwSU2PUkb08U7TfIiabTvsa2eHZR+mi6MWG976Jd6 X-Received: by 2002:a17:906:2b1a:: with SMTP id a26mr51407409ejg.23.1609854243771; Tue, 05 Jan 2021 05:44:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609854243; cv=none; d=google.com; s=arc-20160816; b=IkpW2h8Ps6+Ve1AYJoTuMOh7ZojO8amO6+TH8joXCLSSuNjZ4A7c92FmCZxHOiWRtF a5Qqg2rUBwTKmXcoV5a7PImV8eVjrla0wvO8RBeBOQFkSIFcDdkISWs7mt2pcefNNJKB LbHTHZYgkCVHzfZZRcWeSrgSznq+t6bhuIc/fKaSdLQTz5L5tWynyJ+gb+UmNR4c/Hzi oS6nCmEsQhD1BMybp7om2NL25nGj93PonlJyRZEsv0zZ402Gwf71tko1V2gDGgmgE6Bh hAwzVgsyJCKX3EtN2fzIk1Y/KRiPJgHgRvTZWXT3S3IW4zPThr9PscmmhHjNBhHwjaLT n1cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=ETwu6CPGMYAhTxVZhEromat1wLEp52aBdndvKeYkzEA=; b=GrB3Hut+vIBiK8SluKXgMPqzfexw0NCF6ZOeXS/7jcLGYgMLRBYNjRJ4uFUwQG9WV3 +829VntY41tlneaqGn55jzU03LiZNeA7BrT06IzWAJwehXJP0YHs+oPQ4iAFFXQhhoqc Fskn6ddxnoPDJ9mbXTxSe3H5ngobLpzaShO5IBhHRgBBxjpXzXn9byzSSRd8iJu8camv 6d2AuqVnQK5//dzL6wk9aWo19LVdJzGRSEEEYSOGFQpJHYhK5f+JUZH4/Z6mqnJgbQWF TVFr5AoTVOJ1O8B1j+9JgLBhp16xQ9/NrlhIqncdPxrMyh7CIrxDVrduQIf5dPfbNgA2 XshA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=1BWqdd1c; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=KpDmntg+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si33006882ejd.135.2021.01.05.05.43.40; Tue, 05 Jan 2021 05:44:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=1BWqdd1c; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=KpDmntg+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728331AbhAENQ0 (ORCPT + 99 others); Tue, 5 Jan 2021 08:16:26 -0500 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:33801 "EHLO new2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728153AbhAENQZ (ORCPT ); Tue, 5 Jan 2021 08:16:25 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 77ADA5803E1; Tue, 5 Jan 2021 08:15:39 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 05 Jan 2021 08:15:39 -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=ETwu6CPGMYAhT xVZhEromat1wLEp52aBdndvKeYkzEA=; b=1BWqdd1cDOIRw4ZZynCPGZvO//5Vb mlr1o+fHPg8evYSzUqkSErwahM9zIKJv1JBXA0V17owU4t3+txl2C8RUxHG4+xV0 HFDhHDLD3NvhPkvAaRpOXrJ1effVE1DKobEL49XItkz3QD053t3S3t4w4tV5dSlM gZ4mQs3bStXQb1SWMtgrfvnr7NPWZJhkbelofwaQrAQ2it2+/0TdYI+XnYdUxlgh rn5H3G1ld/AKYE7MRaTq24F+yFb70FULgZQQNQe0dURCt6+20a2lp4h4QPAXO6wY pMVVmn7CgTwemA5Y4WmRINb79elJ6mxKlhG/Zsmj1o1mxWllmO5G4IqPA== 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=ETwu6CPGMYAhTxVZhEromat1wLEp52aBdndvKeYkzEA=; b=KpDmntg+ Cq/UQGbIsVASQgszF7mZTfayxfXdiN20f6hDL1vwEDJivC41563O92CMZ/bEf0hn KwHLsbRpd5ltzOx4dMrtXJMxaGbg8orctj4Wx6fvkZWlLQ8tBT8N4Jp0HLifYM49 Pa/rt06exVU3JPr812R2BALHBrFP9IFaGZAUWbkeYPx3qdir79dWoN7Mrn0Cl0q8 Y5HcyYT+eu5wO8I6P4SgtJl5fiPJhyzYkSW/KcBaQ/kmri+gq0NJLP4BcVkxblCs 3wDM/EGh2JWIf/L1llxBHidI/e14Izmd2uDx5Yvoa8zD/HPEI0cQls1bl078qG7u K3dmfrzWpTIR4A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdefjedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeflihgrgihu nhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqnecugg ftrfgrthhtvghrnhepjeeihffgteelkeelffdukedtheevudejvdegkeekjeefhffhhfet udetgfdtffeunecukfhppedutddurdekgedrudekrddvudeknecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhl hihgohgrthdrtghomh X-ME-Proxy: Received: from localhost.localdomain (unknown [101.84.18.218]) by mail.messagingengine.com (Postfix) with ESMTPA id EA3FF24005B; Tue, 5 Jan 2021 08:15:31 -0500 (EST) From: Jiaxun Yang To: platform-driver-x86@vger.kernel.org Cc: Jiaxun Yang , Hans de Goede , "Rafael J. Wysocki" , Len Brown , Mark Gross , Ike Panhc , Mark Pearson , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] ACPI: platform-profile: Introduce object pointers to callbacks Date: Tue, 5 Jan 2021 21:14:42 +0800 Message-Id: <20210105131447.38036-2-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210105131447.38036-1-jiaxun.yang@flygoat.com> References: <20210105131447.38036-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a object pointer to handler callbacks to avoid having global variables everywhere. 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 91be50a32cc8..bb4d7b0fe2ac 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); -- 2.30.0