Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2833522pxb; Fri, 12 Feb 2021 02:31:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVVy0kBDlInIzSXjp9vxv3HghKAu/h3pVs/HFg75ORvWBi+HuDqiCfCVfirVe15tGCsMkB X-Received: by 2002:aa7:cac6:: with SMTP id l6mr2630377edt.357.1613125897503; Fri, 12 Feb 2021 02:31:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613125897; cv=none; d=google.com; s=arc-20160816; b=GNXIufq/7BCR5XNXxhj5N7NcrpalQ9I51tGCgth8VoNM03PECQgGwv4xoIljI4MSDW uiN+Kp5Emyhs5bODK7D/zAsYjBrWdad4WIBZzq2Rxc8royHdz3ovIK6gXoSjUfiC1Gaw 2RA/qugXK2G916QIJHl66wtUTreiLB3bskoJ1itffCXYMvRY2yUnOHGkniisnN5yzcNp vC2nVKhcwj7CH3KMhCBiKKuX+/QgO0MII/Numb52KAJ0JJy+4nFN0NnMcbX8TfA0DOeb A0VLdk32kq/9EjYcug3Wb9oK0ivGwkv+vWGN+wfidhIbg2urP1COdgHQCet1okegqA2K Od1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=d7G+xZnSM6iY2eA/jLKtxC88VUxGOMsGrVFNuO4Qj5A=; b=ppJvpsN/jANAYWBKCEfUpJg/GO5YZR+NN/dCou7gXCcSr1zNmyi4jh4hDHjXdHGrwp Js9xhIfk80xALvPRyvcOCGU3WzlS+NnQUX9ZVK1C4FxnZxazUrgKmGiSUFn0WnjfmrWv Uc+csV9jLYPaf0BhhOtZiCzauBEX31D3ArcTqCyo7W/S/GsLmMMy17KZ9w585NgtDXhV nspGG/RDWq5+3DO8QmhMl0Q2ipZ9viX2UR+j/Te6NFx4lD3WM6VAYW8EKgd41CMtx3tR /eRXrek/7GDCkjvrVv2qXccqni1r4VAZPlloiePaB7PBhe2vlU+qSQdQo1yDxQLPx+gg uEgA== 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 y1si3232449ejm.229.2021.02.12.02.31.14; Fri, 12 Feb 2021 02:31:37 -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 S230372AbhBLKah (ORCPT + 99 others); Fri, 12 Feb 2021 05:30:37 -0500 Received: from mga03.intel.com ([134.134.136.65]:16175 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbhBLKag (ORCPT ); Fri, 12 Feb 2021 05:30:36 -0500 IronPort-SDR: lQIF3U+6oD7htNhN0ECriiXMTyLRJVQtK3PjYTLnhZ8fJ6jkbHLBuBtIVAHi7lrtaynZL3YfVw Y+WdFtJc45DQ== X-IronPort-AV: E=McAfee;i="6000,8403,9892"; a="182463613" X-IronPort-AV: E=Sophos;i="5.81,173,1610438400"; d="scan'208";a="182463613" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2021 02:28:50 -0800 IronPort-SDR: xMPymEm/e9YiMmihnEa5y2rtorDhIH6vzmGuFw0mnx8OWCamCc/cc+om/C7EASKmVNaAbxnsS3 YHzGRLsBHvBw== X-IronPort-AV: E=Sophos;i="5.81,173,1610438400"; d="scan'208";a="397927633" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.163]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2021 02:28:47 -0800 Received: by lahna (sSMTP sendmail emulation); Fri, 12 Feb 2021 12:28:44 +0200 Date: Fri, 12 Feb 2021 12:28:44 +0200 From: Mika Westerberg To: "Rafael J. Wysocki" Cc: Andy Shevchenko , Linux ACPI , LKML , Calvin Johnson , Sakari Ailus Subject: Re: [PATCH] ACPI: property: Fix fwnode string properties matching Message-ID: <20210212102844.GN2542@lahna.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> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Mika Westerberg