Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1408288pxb; Wed, 10 Feb 2021 07:45:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWVNzxlMWuQ13fx7S+wMtU7HpSwBz7iVfTVam7EeX/VqQp+1qrlKAVsV3J6Z57bGBC9Sea X-Received: by 2002:a05:6402:1013:: with SMTP id c19mr3775979edu.86.1612971924322; Wed, 10 Feb 2021 07:45:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612971924; cv=none; d=google.com; s=arc-20160816; b=uwIsLXLGUVUjYjV8FBIWH6wWfXRFTWhu5vZppwqjuru2MLydO/IIJqTZOj114J2fTJ 0O0M8196KNVg9l4aSmsOteOlifHOhw5WkHId59EyU+w7fb6+OLIIb41JPTDEthVV44u6 YZiCTbhrJeDSX/mCFilNYn8C2rWRdI3UDvbDGAu+sAfC41Cc+zH1kZvfCETv0u75OYTV ji0P/L1H1onAozkKpC9JFGCQier7NCYeoOrBTfmbzM082gdI4jhqDYSo+32smCHJgi0u s69B3uPpTplN5y+fjmunigHLfvf3Rz053gLt6MQQl+n0ZbqoDDGBvCJjZrzWRh8HJ9sR kx/g== 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=buFPxUHFzFCxBls6qvQFqNjTfDO8ChbppG3+IomIVgI=; b=rOLB6op6v1dK/XpkhMwMy1nr23MAzvHVGqDdRLwyhnnYaj6pp19XDlfGHm6iNnHfJq 0RsQGR+9unh1AleIUyNZTB6XaXhVJ+gFQ7vNEN93h5ag11nx044fX/DDxKVJkp6qfhHN OboB5ysDy3jobRDqppkRIT7IhixeKpoR/uS25SsEsuxNBLdTnSITnK/K6IU3Y5P32464 1gYcEugmwMWZ75SugAihpvcQY73rUdSVHsJGTc/AdEbAwIQGsWYz90LhakfuSmpf1rGZ etugU0knRl3eETjZ4fFAeoJe7ftLI6NSMkJ5rATP+p70XzKiJZ+g9HmLtzLkVHz/kca3 1/iQ== 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 v12si1526350ejb.566.2021.02.10.07.45.00; Wed, 10 Feb 2021 07:45:24 -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 S231148AbhBJPns (ORCPT + 99 others); Wed, 10 Feb 2021 10:43:48 -0500 Received: from mga11.intel.com ([192.55.52.93]:18202 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbhBJPnr (ORCPT ); Wed, 10 Feb 2021 10:43:47 -0500 IronPort-SDR: EWSDkVU5rB8MQ3t6ScDSvTudtdKCEoveWlz+M5LbKAVzNZFwLC4Es10SaxzY2bj8E7LCQ3Coc9 vjTviL1VzFmg== X-IronPort-AV: E=McAfee;i="6000,8403,9891"; a="178584187" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="178584187" 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 07:42:01 -0800 IronPort-SDR: KqKsFD0pE+N6mm+7R8exlCz3NEjFfZvF+j+UWoqctMedEgvXKpSM0oCx5B31seArcurG+Gvjr5 7aLzwvsxOhuQ== X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="436712855" 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 07:41:59 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1l9rcq-003lGo-M0; Wed, 10 Feb 2021 17:41:56 +0200 Date: Wed, 10 Feb 2021 17:41:56 +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: 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 04:01:16PM +0100, Rafael J. Wysocki wrote: > On Wed, Feb 10, 2021 at 3:48 PM Andy Shevchenko > wrote: > > 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: ... > > > > > > - 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. > > That's my point. Patch 7 should be the first one in the series. Ah, okay. Since you want this let me rebase. > > > > > > 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. > > That is if !val and nval != 0 is regarded as a valid combination of > arguments, but is it? I believe nobody tested that. > If that is the case, the check in acpi_data_prop_read() in the last > patch that I posted needs to be (!val || nval == 1), but that would be > it, no? I think it also needs the conditional at return as in my patch. -- With Best Regards, Andy Shevchenko