Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1364412pxb; Wed, 10 Feb 2021 06:52:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBmA9NjYTn1RaC460u8L2ig3lpuhyLMe3Wgl4jMUyk+QwFMx2eEoUDFKJq/sIypTy4Rewe X-Received: by 2002:a17:906:980b:: with SMTP id lm11mr3374435ejb.46.1612968771980; Wed, 10 Feb 2021 06:52:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612968771; cv=none; d=google.com; s=arc-20160816; b=dR4n5Q/BdNOSeRi3eKciUuw8b9LKJS+K/85AQ2fcJmDDJM4hjSNFlU3iDrVvuqEr7I GpPEyHLmvXGYdvN0Vi/8Aabuhteomd44iowH7p7ppLAW9NzacEbJKyaUZpDhoOXrHQZi ailVFrVOAFJLitB5a3p5QJqo9/ljI9P5JgStiu4R31qythFzIKitZmIvTJXpcS954a43 zV2ZHrEhhnyqQhkEjAaAnwvufRe64wgcl5mWK5KTJBNrtD3OoE0o6RLmZc5FbcBF+Rtb r4/xDrbCtuDTmwPvqdBwni33GSPohdSPiKwqI0eofiZkugVvChiLiTFnxwcM5KazZT81 wWlw== 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=Ks9q+0nTMAjGlYnAOmC0TM7cdW2O0aJXMk7e8yxWg50=; b=ZgOj6jGPDC1U5mwP/EGO1NOCtGdZM/4oJ/4dx7xZpqU6Uq1FmnEGzTNalYY9wkslf0 /EDKFQknNmHSsCAW7gWK2CuX2e4zvrj0EaGC3P0HPvFdK8pj5qK72NXJrSXNtPletAIe jv3TwgP4ZDNuYaexwbgwppMnPsE2dmaOPzCQwT34icsUmDd9Atn2MkDVywlm99rgoqTR BlsSTemJI1YtOF/VmIG/ySMk5rNzpOj9Ps9oYSWdH0Cc50E81pGEX/b12OvHGJHPxVu8 0P/2qDEW9mczA2+T0v8T2xCDfxw30i0XJHPupmsvWjboubkc28tIpFvraqxLghG8hKYE WNog== 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 hc41si1355498ejc.381.2021.02.10.06.52.26; Wed, 10 Feb 2021 06:52:51 -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 S230394AbhBJOuD (ORCPT + 99 others); Wed, 10 Feb 2021 09:50:03 -0500 Received: from mga11.intel.com ([192.55.52.93]:13533 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230028AbhBJOuC (ORCPT ); Wed, 10 Feb 2021 09:50:02 -0500 IronPort-SDR: xvWYcWCc+ABBAU9n+CTk/O48wMYVAFUzmW+n7F3pc0Yl4eGj54ztMO1m+87BP6k5DXGwQdixpU bqFZgeF+T9NA== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="178573131" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="178573131" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 06:48:14 -0800 IronPort-SDR: Fz0huz8BxvaKkQQkanZeVSu1UIU6Bo+Wu0wJVcXCJ0Pjnmyd43g1oBvY+jOVmOuS7MjfRsgyyo 4lzoiv+3soVw== X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="436696420" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 06:48:12 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1l9qmo-003kft-6W; Wed, 10 Feb 2021 16:48:10 +0200 Date: Wed, 10 Feb 2021 16:48:10 +0200 From: Andy Shevchenko To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , ACPI Devel Maling List , Linux Kernel Mailing List , Len Brown , Calvin Johnson Subject: Re: [PATCH v1 7/7] ACPI: property: Allow counting a single value as an array of 1 element Message-ID: References: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> <3881654.NPl3a4M0kB@kreacher> <1946478.1QpZic6vku@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1946478.1QpZic6vku@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 Wed, Feb 10, 2021 at 02:48:09PM +0100, Rafael J. Wysocki wrote: > On Wednesday, February 10, 2021 2:31:48 PM CET Rafael J. Wysocki wrote: > > On Wednesday, February 10, 2021 1:36:00 PM CET Rafael J. Wysocki wrote: > > > On Wed, Feb 10, 2021 at 12:51 PM Andy Shevchenko > > > wrote: Rafael, thanks for the review, my answers below. > > > > We allow to read the single value as a first element in the array. > > > > Unfortunately the counting doesn't work in this case and we can't > > > > call fwnode_property_count_*() API without getting an error. > > > > > > It would be good to mention what the symptom of the issue is here. fwnode_property_match_string() is not working as reported by Calvin. > > > > Modify acpi_data_prop_read() to always try the single value read > > > > and thus allow counting the single value as an array of 1 element. > > > > > > > > Reported-by: Calvin Johnson > > > > Signed-off-by: Andy Shevchenko > > > > > > This is a bug fix, so it should go in before the cleanups in this series IMO. Seems it was never worked, hence neither Fixes tag nor... > > > Also it looks like stable@vger material. ...Cc to stable@. > > > > - if (val && nval == 1) { > > > > + /* Try to read as a single value first */ > > > > + if (!val || nval == 1) { > > > > ret = acpi_data_prop_read_single(data, propname, proptype, val); > > > > > > This returns -EINVAL if val is NULL. Nope. That's why it's a patch 7. Patch 6 solves this. > > > > if (ret >= 0) > > > > - return ret; > > > > + return val ? ret : 1; > > > > > > So val cannot be NULL here. Why not? I have changed conditional. > > > > } > > > To me, acpi_fwnode_property_read_string_array() needs to special-case > > > val == NULL and nval == 0. nval can be anything in the case of val==NULL. So far neither of your proposals conform this. -- With Best Regards, Andy Shevchenko