From patchwork Mon Dec 18 19:24:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 180632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1479449dyi; Mon, 18 Dec 2023 11:27:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwmUmyt3XQJWtkExjYpTRKWBkYNxsl02GG+h3gxK79NI6TDaDEMCR4mor2rJqmwB+/6AnC X-Received: by 2002:a05:6512:2243:b0:50e:d1c:5892 with SMTP id i3-20020a056512224300b0050e0d1c5892mr6993710lfu.93.1702927631358; Mon, 18 Dec 2023 11:27:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702927631; cv=none; d=google.com; s=arc-20160816; b=w5FId4P89m+uU3zgVcX7L1pDqMY6m6n5Ayjgu5X8F3eEvZnEZZzWnXz0n9HQfLPFYc b4R2zSBq9WHZc7fg1sDFif6kBLas6YjM6bXlNVxAsYVtJH4vtEHX1aclcRuJEerbWsjp KZinWs2CWyLXeuDKlsXk2rywWODiqh4XA0mPNup6qItLE3dVxvbpUTdb58IO7e4vUYri LoSjWV9gGWSnSLnd7pqwWbTdvKaPd42NLHGcTl056th3ZwbKX2K652CwnMUaHgkQmua+ Uh//qMeceTnxp6NfTyad90D6LCvDB45MpxdH347QExAs1jVFpjjbUM7FN1bzf/shjnO4 MJtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=O0AGkmcARnuQJkGccKHtqimFgyaHWSnAuqh0v4nuq8A=; fh=VE5ZfoJWem8it6OrnlM5ov49ej/hHjarqyIgnpICDoo=; b=wYstN6MbyzuZZqXpBbbOHc7bSTVXpAC0pN8Qch7k6snfUL6fL5VMcV+AgaHqOg8uHm Jg7o5ni0psMak4GjnaXQpQuO+vbW89B8e0mXcLhWVNOIYMMs9Xx2vJ7iRZ3OvZ7C4Q3F jiC8C7JKApxjSryONk+T/ngFYqaTk04crZsJoahYyS46qx7BTmo+CS/BDdJvv4Uo2Sn/ ox2wj0RaDfSeikruf49rUlTkCrbmiPIBhrxyn639CBimiBNZGkDbEAJjJLIULF167Bx2 khB7xqf7bBeCRiu9G1z0MuotXpuCrQ/Oqj+QpjDSg2e4fyMV6W3vUZgcl34ygKlpT0sg xF+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=qHQ+kTO+; spf=pass (google.com: domain of linux-kernel+bounces-4293-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4293-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a14-20020a170906244e00b00a235a6ac1ecsi965241ejb.849.2023.12.18.11.27.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 11:27:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4293-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=qHQ+kTO+; spf=pass (google.com: domain of linux-kernel+bounces-4293-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4293-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 999241F2146C for ; Mon, 18 Dec 2023 19:27:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9223F760B2; Mon, 18 Dec 2023 19:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="qHQ+kTO+" X-Original-To: linux-kernel@vger.kernel.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1961B74E18; Mon, 18 Dec 2023 19:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1702927480; x=1703532280; i=w_armin@gmx.de; bh=8xcRS4toKnQj2X27ThuiST1cF613b/lRiEqma2uezJw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=qHQ+kTO+138KHKZMQD8j3zmW9TQ7RaND+tLp54ET91nuGKkc75pFVJL/OWweRIHb 8t58GaeTcOC86MCBsEfhgShtRv4DXJoZj1y4hnxjGXFJxTEp/J9TEvWY0s2V4Ly9a rOLqsunFMOSHkLzsZt9CaNYn0SZk2AWu7EBMM+HwlhuH1mxt6qw0G+4NttRw630KI UbWqlollhIWAnwbpd2Hdf5MaThJDIDg8ikGzJ78JN+qIizYOWqjbLzsdB55+cbL9O uzAmYh0P1SDIAKAjJ7RiDYPr6v0/TqhS0ODwrCclGyKd/d2Hqu/fRoIKdfZsFzCCF lVMOf/2uf+UBYOY/Ag== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MV67y-1rhSSE06kg-00S7zN; Mon, 18 Dec 2023 20:24:40 +0100 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/6] platform/x86: wmi: Simplify get_subobj_info() Date: Mon, 18 Dec 2023 20:24:20 +0100 Message-Id: <20231218192420.305411-7-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231218192420.305411-1-W_Armin@gmx.de> References: <20231218192420.305411-1-W_Armin@gmx.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:JJpqrj7iaYiG8Q8VKBhDxjgqXLmD4e3e1HfFdXhL8oifTZUsq40 YPW/znJwDNgKUd8QoBmCMG9Mbs4EaBcQ2w3i5V0l1CMx5321qfmWx/fzOzTSAjLIHVFLfEa SDfUbR1xivK85813OouVHTk9kOCSw45BSFkxyIyFvqA/sRRVkINhb97Ibfhgq9c/z0Z/FBi 0BLazZeG6gb0CuqTAwlIA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:8DBsO9zt8vE=;Lgts6BU2rDjAkv83v5ftHJbk1cq 3TdBM54kTm9YSiom/AUBfOGkFkFMhXD1v547LJZkl1Omnst2ScFBICd05JFUYhya51bkp689L TAWvtKIx807u4r4CNeX3K5xuHjXV3csijd3fcjANXyq52bhhGN+NmxJdzNCdSqATrCFQ4JOTO dUCy0WlHaUQAlBG0WAnwbal7xVVfqbd51dwbP2mQ17xuVk77Lu7UBKzn0MxYWXTsiQUuJBZks EaQBOIyh2f5r77fUvQ/vmZCSlcm3iK6m1J5JOAokfMDejyGzbidkdZJ0tKe4rMzgbNUrauN9E VgPYi2c1nfbSuKkth9sy+naRVDqkuCGY2ZM8hjRnDLEdAgsQz4fxtokBcT+HSW33QWOJLC1jM VBgNIqCPXNTOmjzsrb6q7HwgsxlHvcrHvBlYncpRisdbeo66q67WfJJJt6qiARSGfKpk2LMXw N6z2oZqbx1QsglWLjKHHz3f3SPHZ+T0sBNZY3u5NKxjd9+GJxLNTo+Rz9Z/SpNdx0v+U96b41 kMq5K4C/3CZ9ywlJWQ5VXK1GmI/VbLWs+u0JMVjDEniKIy2m2POrp7CM7wY8yEVazbWCOhwpt 5mc8j3tlPfKU/axjvskRyPalfnfVlTRjFpiRgPVpucvprg2RL60xlLAj82CAsRbwEs7zLJ0d3 QZojCWlTn1QNlB7v4C9vrsrauzSQgzuH0RDo7cbNI2eOP4vFF7UuS6wiqP9KU2AP4c06pvtck Rbc8Hn+o1FtT/RT+aZbpWYuQjQAsgufI11wtEMn2C3hw22aUycdrjPd+palL9FJzpYTnOVqx/ Z9VvyiODsRkWM8BwHY/Gmp1nsnYDD5JqaifDsO6ffrHoeVCOTFmgrH5ewp0sEG555PewTK6P4 YHTcci3BFsalIxPnPULM2iplxXB2uym4hUGy7VaPVZ/puU9CQ1t/mGn0i/bsqX+qvyiMl3kTn 02bbnA== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785649043744994278 X-GMAIL-MSGID: 1785649043744994278 All callers who call get_subobj_info() with **info being NULL should better use acpi_has_method() instead. Convert the only caller who does this to acpi_has_method() to drop the dummy info handling. Reviewed-by: Hans de Goede Signed-off-by: Armin Wolf --- drivers/platform/x86/wmi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 559a99ebc624..a7cfcbf92432 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -132,23 +132,19 @@ static const void *find_guid_context(struct wmi_block *wblock, static int get_subobj_info(acpi_handle handle, const char *pathname, struct acpi_device_info **info) { - struct acpi_device_info *dummy_info, **info_ptr; acpi_handle subobj_handle; acpi_status status; - status = acpi_get_handle(handle, (char *)pathname, &subobj_handle); + status = acpi_get_handle(handle, pathname, &subobj_handle); if (status == AE_NOT_FOUND) return -ENOENT; - else if (ACPI_FAILURE(status)) - return -EIO; - info_ptr = info ? info : &dummy_info; - status = acpi_get_object_info(subobj_handle, info_ptr); if (ACPI_FAILURE(status)) return -EIO; - if (!info) - kfree(dummy_info); + status = acpi_get_object_info(subobj_handle, info); + if (ACPI_FAILURE(status)) + return -EIO; return 0; } @@ -998,9 +994,7 @@ static int wmi_create_device(struct device *wmi_bus_dev, kfree(info); get_acpi_method_name(wblock, 'S', method); - result = get_subobj_info(device->handle, method, NULL); - - if (result == 0) + if (acpi_has_method(device->handle, method)) wblock->dev.setable = true; out_init: