Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2818175pxb; Fri, 12 Feb 2021 02:00:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfnFpUkackuMeR0/xaOw/TfQH97sLXGstfBtPSZKZbqnUE+jE9/Ut09s4qH/LnKdv3uctK X-Received: by 2002:a17:906:3444:: with SMTP id d4mr2229669ejb.410.1613124047044; Fri, 12 Feb 2021 02:00:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613124047; cv=none; d=google.com; s=arc-20160816; b=QBc6fZtaxstjmxMmh/bDMHzZENcU03y4PKTa6F7IV9l5WwQ+biUu82sZdnToQ6Yx8i 0DxVn9ne0Wue6p66oyCuWLt+wkbOg2qpNpEhH5F45n07dSuB3U49dlur9wD80aIQAcp2 qAOxvH5TJzyXgIi0FbDz0QgMF1aAtwoDrlug36w1pyL2qTJg3XuCfYhNAwPOIIZcAImA WBf2alk+yzxN0iCoMJ5b8VS9f2iFdE1eVDH5TRIth3a9faFUyg/1+1+ax9tEdN8EkVo0 l4I34PgiDWyJdFeqSJjKtEknNkZG//9jVXzIVmEQS4UazEKZJb9wD+oQTqLDV8XY0vA+ TgOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=uIXe43Fi1RYkmHygOaEe2lmcFBzHoMFPdlrkCPYdJ7g=; b=pQcg66R6/ptMnElBl/s1c0F2GVI5RCBeVz5Xn9gQyHCRrLpaG/pxDHuCyqjBqCZR84 ehmy463oPBv2wGyLKKwoTRGfkv1GmdApTckqzazzsIsaPXGUj967q2j5err35E3eGJgy 7W4uLfODMa2wG5/xK+jsWshR3YIAdOE45Fc3Gcc778TPEU1LE/uwfThPDobREg3ZKhiy lqM8BWxoqHwhS2kEDSUO98Nsf1zEmjpGfcEQfRP2uM5tTQ47uQur4HWs+SoqEoB1qd+v UkRAhlCpsaxuv2iWavxJtl4bQ4ykuiI/1KWLlsZSHa0/AlnNMPWJjHB64O7KJCrr2F9L wFFA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz13si5754181ejb.726.2021.02.12.02.00.23; Fri, 12 Feb 2021 02:00:47 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbhBLJ7t (ORCPT + 99 others); Fri, 12 Feb 2021 04:59:49 -0500 Received: from mga12.intel.com ([192.55.52.136]:53425 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbhBLJ7q (ORCPT ); Fri, 12 Feb 2021 04:59:46 -0500 IronPort-SDR: AWMcEvOMA/KgUrvkMKedPrL1Ybs1rIgUjyAHDv9ah/U44UaUe/IlPmUApnnqhCO0xCAU7YpxEb lPNfLAIxRzSw== X-IronPort-AV: E=McAfee;i="6000,8403,9892"; a="161532184" X-IronPort-AV: E=Sophos;i="5.81,173,1610438400"; d="scan'208";a="161532184" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2021 01:57:56 -0800 IronPort-SDR: AvtK9ndARQGVy4E+Zh213bC+NiKFJ64EIdfF6Wult9Dfh6Irc1uq8KKw8/E6IhXHfYgeK9J0Xe 64lIR7lxGFBw== X-IronPort-AV: E=Sophos;i="5.81,173,1610438400"; d="scan'208";a="376284205" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2021 01:57:54 -0800 Received: from paasikivi.fi.intel.com (localhost [127.0.0.1]) by paasikivi.fi.intel.com (Postfix) with SMTP id 78F5E20345; Fri, 12 Feb 2021 11:57:51 +0200 (EET) Date: Fri, 12 Feb 2021 11:57:51 +0200 From: Sakari Ailus To: "Rafael J. Wysocki" Cc: Andy Shevchenko , Linux ACPI , Mika Westerberg , LKML , Calvin Johnson Subject: Re: [PATCH] ACPI: property: Fix fwnode string properties matching Message-ID: <20210212095751.GB3@paasikivi.fi.intel.com> References: <5831274.1ZjA0VymzF@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5831274.1ZjA0VymzF@kreacher> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, On Thu, Feb 11, 2021 at 07:30:01PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Property matching does not work for ACPI fwnodes if the value of the > given property is not represented as a package in the _DSD package > containing it. For example, the "compatible" property in the _DSD > below > > Name (_DSD, Package () { > ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), > Package () { > Package () {"compatible", "ethernet-phy-ieee802.3-c45"} > } > }) > > will not be found by fwnode_property_match_string(), because the ACPI > code handling device properties does not regard the single value as a > "list" in that case. > > Namely, fwnode_property_match_string() invoked to match a given > string property value first calls fwnode_property_read_string_array() > with the last two arguments equal to NULL and 0, respectively, in > order to count the items in the value of the given property, with the > assumption that this value may be an array. For ACPI fwnodes, that > operation is carried out by acpi_node_prop_read() which calls > acpi_data_prop_read() for this purpose. However, when the return > (val) pointer is NULL, that function only looks for a property whose > value is a package without checking the single-value case at all. > > To fix that, make acpi_data_prop_read() check the single-value case > regardless of the return pointer value if its return pointer argument > is NULL and modify acpi_data_prop_read_single() handling that case to > attempt to read the value of the property if the return pointer is > NULL and return 1 if that succeeds. > > Fixes: 3708184afc77 ("device property: Move FW type specific functionality to FW specific files") > Reported-by: Calvin Johnson > Cc: 4.13+ # 4.13+ > Signed-off-by: Rafael J. Wysocki Thanks for addressing this. Reviewed-by: Sakari Ailus -- Sakari Ailus