Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp11968225pxu; Fri, 1 Jan 2021 04:59:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAoiujpLAwdvaDGjsugW5KGdB0e5iA+PyNm+BMf5Cg3mzh8e0yviRaw3rFbLuhF5FNs516 X-Received: by 2002:a17:907:40f0:: with SMTP id nn24mr56163722ejb.233.1609505988918; Fri, 01 Jan 2021 04:59:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609505988; cv=none; d=google.com; s=arc-20160816; b=D7574OslSA0ooZQH0GPOib6U6VYLZEEfzTPGAt+6phDMPblY0/aMKrliyZgARpGL3Q 1+VJUkE4ZFs7BoTSLBVYWRS+5+T8GWWnEUtXEtIDil+tCOn+2Nhrf59EdFGN4e4A67tK 4XeQyoLcEMeHQJBakprrE+POQW0HBN/9LMdPsp5pa949T45i9N8qZxYN+aMSaCG60ouc rcrqPokTqVvXSu6Zjmw8Eh9NGdIuflOlY4xQq7oMXAfoOMB8ZkH7njE56Za+cUw2h3UK NNngBBGd5KgrEVezyOZ+/WnLl0jchGIMwvWDH8a0ThM3KC/cCRqAoTFwRHADXw8hewXx mMaA== 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=/ETWZ4/0vUN6qk8OTyPL4Ov6POGsGEMJ3pj3b0rxw10=; b=wfgpMSuYEX0FmcAAdsScnS4wZrrK+rKs0SD+xnH2c57ASNkzqiWMz6rcGljQeesqHk 7dmanIiDlcFhQrJuG4pPrNiyYPKbexkV6VO3NE0w/bA/kGZLRldgEwZQSbQfFlJyOU9u R7esAJzL/v7LAWTwNW7WRAb8lmW50aabLiYe9araFlN3kQPxYOQXRuBxKe6KWPZy3kVg ALG8w2Bs/n64JZX+9outX4lxVlqxkjYy5/6UEUynhyPe8TDQUy6lZ2EYKY2aN3z3Z1rs 8cHFqinu0OcRsZ6sECKw+OOWPAwEe2lqoIlmnQPwUDVDsLFDa54tIT54xzon/D4lP7K6 IWJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=TzeRUmDF; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=bmGfekQ7; 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 x31si17131152ede.198.2021.01.01.04.59.01; Fri, 01 Jan 2021 04:59:48 -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=TzeRUmDF; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=bmGfekQ7; 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 S1726974AbhAAM5k (ORCPT + 99 others); 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a data parameter to handler callbacks to avoid having global variables everywhere. Signed-off-by: Jiaxun Yang --- 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); -- 2.30.0