Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3098420ybi; Thu, 18 Jul 2019 21:00:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL+AV25PcobxqQxvDgMNESwsht+7bwCHg1Q0Kj4tgOKWgGTYvWUevwKL7sO0e/GiDhenid X-Received: by 2002:a63:6bc5:: with SMTP id g188mr20782758pgc.225.1563508831763; Thu, 18 Jul 2019 21:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563508831; cv=none; d=google.com; s=arc-20160816; b=PlienDRa1jVsVxV+tl7R6dyVFqgV7xuTriVVtbt3CYf6hifTKjWwe++9wLQVPFEDM5 0Np4aVATvBzftSZYqDLdEdgEojUOpTC9+l6+cPiWkhkkFAbn0KgWdRiSsN91r/34fc2X gBXW1OVgPJGnDg2XyW+/pTOZxYHJvxGxBEif9ZQdGXJH+nBBAgDOn2tGuStVKo1TsJi7 LmD3g0K00BMJiy+vvbVmtOhKI3xMPi24X20VDEtSaviRnhIGsKO/zinH18cQleMTWvzt l8JZARJ6g4dgpJkasJ3OrhJkczgf2dSHyi/hPIm97zOuiBrKxMNBlVAms/ptH4S4h4HB bUuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MxXALrRDkYysTkaa70bY7YTuCXwD6+wEXYGra4Gjrng=; b=RVcJoUCALUXjEMdYrKeucq603Oov/f+aHuC9OOUjnltrEpfSl5UIpy58fy0CpXP7hf sH2pmo9KxgOUBsI/f2rEjCIrjE2Q/OPc+RMSvj7uItr4Ac++O278TuWFaXSBmPFgWMKK muRU/ua17lEOxpo+oN4h4Uxee01yW3ewF+rECB5Zu5laRPRpTw2NwGhke/9Q6yc/kjkT uWszWlgMG4cF6hRVHgkN3EBCSwQ2yT6vjHe1rOFZyEb8WieK+hZulTSaqj/3P3a9xi5/ B1MEcqO8Tu0kqc8XVS2JXXDwKqkwAr/LIZetPpVaaVhb/pdDsLXdiBb8ku7BWQ9VmMwb Bq6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X1AehkT5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o127si586896pga.593.2019.07.18.21.00.16; Thu, 18 Jul 2019 21:00:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X1AehkT5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727019AbfGSD7K (ORCPT + 99 others); Thu, 18 Jul 2019 23:59:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:58486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728429AbfGSD7D (ORCPT ); Thu, 18 Jul 2019 23:59:03 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8AE11218D0; Fri, 19 Jul 2019 03:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508742; bh=yJmRyrzBt/ZQZo6dAZhH1BB6xNTq2RP6aEkDuFKhFlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1AehkT5+mFNEYjaYZ7AVpLXYlpSnHgh0vdkbvCz5699szOCDrX+WuoqylCVP4kwX gTxKFO5551fNZrVa+Q8pMbbBzrkEDnO+BfLJidjRtp09isWYIm63nToh07fUImQag6 i6vcZ2thNwK74Au3GcY3DjeGitMFsO4BZTaYtfTI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yurii Pavlovskyi , Daniel Drake , Andy Shevchenko , Sasha Levin , acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 063/171] platform/x86: asus-wmi: Increase input buffer size of WMI methods Date: Thu, 18 Jul 2019 23:54:54 -0400 Message-Id: <20190719035643.14300-63-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yurii Pavlovskyi [ Upstream commit 98e865a522983f2afde075648ec9d15ea4bb9194 ] The asus-nb-wmi driver is matched by WMI alias but fails to load on TUF Gaming series laptops producing multiple ACPI errors in the kernel log. The input buffer for WMI method invocation size is 2 dwords, whereas 3 are expected by this model. FX505GM: .. Method (WMNB, 3, Serialized) { P8XH (Zero, 0x11) CreateDWordField (Arg2, Zero, IIA0) CreateDWordField (Arg2, 0x04, IIA1) CreateDWordField (Arg2, 0x08, IIA2) Local0 = (Arg1 & 0xFFFFFFFF) ... Compare with older K54C: ... Method (WMNB, 3, NotSerialized) { CreateDWordField (Arg2, 0x00, IIA0) CreateDWordField (Arg2, 0x04, IIA1) Local0 = (Arg1 & 0xFFFFFFFF) ... Increase buffer size to 3 dwords. No negative consequences of this change are expected, as the input buffer size is not verified. The original function is replaced by a wrapper for a new method passing value 0 for the last parameter. The new function will be used to control RGB keyboard backlight. Signed-off-by: Yurii Pavlovskyi Reviewed-by: Daniel Drake Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin --- drivers/platform/x86/asus-wmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 9b18a184e0aa..abfa99d18fea 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -85,6 +85,7 @@ static bool ashs_present(void) struct bios_args { u32 arg0; u32 arg1; + u32 arg2; /* At least TUF Gaming series uses 3 dword input buffer. */ } __packed; /* @@ -211,11 +212,13 @@ static void asus_wmi_input_exit(struct asus_wmi *asus) asus->inputdev = NULL; } -int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval) +static int asus_wmi_evaluate_method3(u32 method_id, + u32 arg0, u32 arg1, u32 arg2, u32 *retval) { struct bios_args args = { .arg0 = arg0, .arg1 = arg1, + .arg2 = arg2, }; struct acpi_buffer input = { (acpi_size) sizeof(args), &args }; struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -247,6 +250,11 @@ int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval) return 0; } + +int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval) +{ + return asus_wmi_evaluate_method3(method_id, arg0, arg1, 0, retval); +} EXPORT_SYMBOL_GPL(asus_wmi_evaluate_method); static int asus_wmi_evaluate_method_agfn(const struct acpi_buffer args) -- 2.20.1