From patchwork Mon Oct 2 13:52:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1487265vqb; Mon, 2 Oct 2023 08:04:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxIZzYgy2hdDWtz5QOcs2r4/LNiB3a4xJXwcKEN0I3sm2KXo8uelTvlOE1ZWsyoZUzG8Mx X-Received: by 2002:a05:6a20:7d83:b0:10f:be0:4dce with SMTP id v3-20020a056a207d8300b0010f0be04dcemr14970818pzj.8.1696259049127; Mon, 02 Oct 2023 08:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696259049; cv=none; d=google.com; s=arc-20160816; b=pxROe6u592xA69GCxcR9LHQLRfnSiM6g6/AbsGv+vZ9Lz/9jcK9OVlkPpqSfmIpgfz kJtps0bcd628XJ+87mpX4fzMPIUcoo4xU1u7QXhG5OqFjPP/agFiR7a0y1AI9pGyVzv+ 2WSHj36Idfmihk+jFImvHlHkAhjBUfEjoTBFpImONe5a7doRcShfxKLVmu65EgbVgRc1 RUhua3TzWlpFec5zPd76j6hspK5LsMRVayZvHt10i3wPdTiKYKwkwyBG81FPYWgCqHU2 cYFE2icDlZoUM+th1HzVA/jGktx25P2jU0qvT457p//UT7Zal7syP45G7LMJzw5yuZ/D GJsA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=PmpsJ3E6OqnhdqYrJRnBi+508WmbPp+CM0mqxFeiCYY=; fh=eNe/iM6obldhXgX3rEUcQtd5kgAcIdOcd9/dlMZw0sg=; b=Ogu43VWrqpTRic6ot1rg39rr5EM/NjXgFnLV3mFujn6RfSONGZWr5RT/A6UNw5QKFF JjX3tZRNSHcSfGpJYvsAdnExUZl2Fct/LemERCo9L/Lc5ohXkzt2dUd7pdEvT8Wwgcar Ng1hbxLN+kByN0nOkhoRTO/J6OEeZucMwef1BTQD+LdjaNlOLati++Uv0rshOYmxeUIM WCFdDe5/yDY+8Nak/9CtKtJG4lihVN5x7zKLVDnHHTz6HNTm1k2pk46Xcb5G0TvorB1d Rriho9mFHqbD3XYWsK/D2XFAssHz81SrDz7ckz8bmPLy/PEQhbgWce/FeaTUlm5gOcqy wz0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="dTw+/Y9Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id v15-20020aa7850f000000b0068fa9821905si25231819pfn.335.2023.10.02.08.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 08:04:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="dTw+/Y9Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1332C80234FE; Mon, 2 Oct 2023 06:52:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237550AbjJBNw0 (ORCPT + 18 others); Mon, 2 Oct 2023 09:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237531AbjJBNwZ (ORCPT ); Mon, 2 Oct 2023 09:52:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29B4DAD; Mon, 2 Oct 2023 06:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696254743; x=1727790743; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=7nlAn6hAP7k5T95XmMXzQAXl6G0OaiWRwQc+BLw1N8A=; b=dTw+/Y9Z9KpYjfurAQXQ10EY/GAvxNG23QNLXVWC1nK3V7nb2G64Xi1n ioIWpr00KZU3f/DVPIh/uQtN9+LxMQkexbFJ87F1R7MuUy8jyvX99tZg+ wxmPvJ9yASNbpovDBc6dpvb8EsfjbVHPLKsfgs2qFxvx/vpAarM3zjkJi jyXo9lgW7Tl1JEK/q9/uYbuEWbwmfojCWWsjsDf0O1y9LpVtSipzObdGU pyNmRm4GZU1tddPUutxAOHhNDq4XhfLduXEoTaeN3t08Z+p2lvjml7AI1 STYKHSNwfAY3qd6BTkNWwWLKrHhMsXWuDSXGz7SKpd94hULnLU/iJkEXg g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="4220507" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="4220507" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 06:52:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="816290762" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="816290762" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Oct 2023 06:52:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3BF251A7; Mon, 2 Oct 2023 16:52:19 +0300 (EEST) From: Andy Shevchenko To: "Rafael J. Wysocki" , Mario Limonciello , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko Subject: [PATCH v1 1/1] ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed() Date: Mon, 2 Oct 2023 16:52:18 +0300 Message-Id: <20231002135218.2602969-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 06:52:33 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778656528738832546 X-GMAIL-MSGID: 1778656528738832546 The acpi_evaluate_dsm_typed() provides a way to check the type of the object evaluated by _DSM call. Use it instead of open coded variant. Signed-off-by: Andy Shevchenko Reviewed-by: Mario Limonciello --- drivers/acpi/x86/s2idle.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 08f7c6708206..7d64e655f1b8 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -417,11 +417,10 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *d int ret = -EINVAL; guid_parse(uuid, dsm_guid); - obj = acpi_evaluate_dsm(handle, dsm_guid, rev, 0, NULL); /* Check if the _DSM is present and as expected. */ - if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length == 0 || - obj->buffer.length > sizeof(u32)) { + obj = acpi_evaluate_dsm_typed(handle, dsm_guid, rev, 0, NULL, ACPI_TYPE_BUFFER); + if (!obj || obj->buffer.length == 0 || obj->buffer.length > sizeof(u32)) { acpi_handle_debug(handle, "_DSM UUID %s rev %d function 0 evaluation failed\n", uuid, rev); goto out;