Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp465353pxb; Wed, 20 Jan 2021 11:19:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBaswh/Xx79xNh4tCZLixz79FwWuFP5SkImllc0RsHhC9Blf1+7wfH9o/pYl08R62xTOG1 X-Received: by 2002:a05:6402:40c4:: with SMTP id z4mr8390716edb.233.1611170360452; Wed, 20 Jan 2021 11:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611170360; cv=none; d=google.com; s=arc-20160816; b=gVnjmCZNFu9jsNRHBf4CIeWY4e+dg02+pWlTwS1qpiy5dCXJ2h9bhjVHPn9BxmBm+K mh5NcB4qnnIqu+fzRXDcajXSFcVy/pr2aUKsbFb0Nh8O9UEON/RZX90IZMmWJ55aaiPM O1bN3dmjE218s69hKasAPcJ2RMRqUwRiU8B0N0FJZtQ7KJr2LIF+kOx6XNVtjcutmTKn FhgEwQnebPkj8XOw6dXFE9YW4bYm9eAvuf9pLPFveXPC4Gat5dropE5aAOBcqqFtB36J xW87if/ZZSWHnFlunRGtrb1QrDUUaKI1OlM7aeTOB5eXscjvUrsBezMky1xsMpE3QHRJ KRng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=lHHjUnuoF9CRFeUi11DuMAFbrNISTZnauEeaO/iF4Jo=; b=UfHcW1x0nt87AltAFCZEsR3AbJWcAhAOSqx66BWyEPRZm7fsNcAaeZ8iriXP7w0l/R OfGWt20IlxvsSOBUEfA9iV0TLsWxb35Wyu1ler0FD617wNkLOgmwArd3QsWEF7588P5B WiFQT5l81ooFfnzCZMxY80kS5w7M8AbpMRAAWcVuM2lFPj1vHEyBnor9v1g1M7gozu8G RC4LAdNzbeOzmhczHDaYEUF7KPreI28DE9G16EFWIqIgIs6ju9GMUMyUla2PJUk+7c8Y VMp2M2cV9BSTa+KtT40uwA2AQTHGOTHaX+huOUcIF7e02C0EUou8o1VTW+KhhHA7M++N lh4g== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq36si968081ejc.590.2021.01.20.11.18.55; Wed, 20 Jan 2021 11:19:20 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392474AbhATTRY (ORCPT + 99 others); Wed, 20 Jan 2021 14:17:24 -0500 Received: from mail-wr1-f42.google.com ([209.85.221.42]:42693 "EHLO mail-wr1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392477AbhATTQ1 (ORCPT ); Wed, 20 Jan 2021 14:16:27 -0500 Received: by mail-wr1-f42.google.com with SMTP id m4so24132955wrx.9; Wed, 20 Jan 2021 11:16:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lHHjUnuoF9CRFeUi11DuMAFbrNISTZnauEeaO/iF4Jo=; b=gydQBAMjjbyyqKKDl48HIROuG5msARAyfNgGuuLgrRw1je8qxy5j7qp8I7H+vjt3z3 B4CeHfbox6JOPOkPyMc9PRL9TnIfuXaBuilT9nVrsIO4fDDYKYT2hIWDxm0f46Mwuvpq 9qEM0jv70FDCE5TV7ZJSrSoNmucN9AaRpR7EN+4hRaIeffIFELYgYYoXPMQ6RIDEz5z3 HTXzvQ2vfy3W9F719uCEECVUw/hAtQJXCgecZWXaTYW6CRqa8iG9L6ke0lkXqvsx3KNq zeUAxtub+t8LXvbFA+ZhJGIYpb2W/zQS6Fry87RE8Z6YKZWMlS6kRpak1Iy7+J4IaqnN 1YzA== X-Gm-Message-State: AOAM530aBsTGj7Q/Nb8E1GE0uaNrbiVMGn2ANh9BTOyVOYjfiUMZS20R j1y4qDUjE31/sO594uEB3tMQWTy0f2U6T+jrac8= X-Received: by 2002:adf:ce84:: with SMTP id r4mr10662902wrn.91.1611170141586; Wed, 20 Jan 2021 11:15:41 -0800 (PST) MIME-Version: 1.0 References: <20210112134054.342-1-calvin.johnson@oss.nxp.com> <20210112134054.342-10-calvin.johnson@oss.nxp.com> <20210112180343.GI4077@smile.fi.intel.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 20 Jan 2021 20:15:30 +0100 Message-ID: Subject: Re: [net-next PATCH v3 09/15] device property: Introduce fwnode_get_id() To: Andy Shevchenko Cc: "Rafael J. Wysocki" , Saravana Kannan , Calvin Johnson , Grant Likely , Jeremy Linton , Andrew Lunn , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Diana Madalina Craciun , LKML , netdev , Laurentiu Tudor , ACPI Devel Maling List , "linux.cj" , linux-arm-kernel , Bartosz Golaszewski , Greg Kroah-Hartman , Laurent Pinchart , Randy Dunlap Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 7:51 PM Andy Shevchenko wrote: > > On Wed, Jan 20, 2021 at 8:18 PM Rafael J. Wysocki wrote: > > On Tue, Jan 12, 2021 at 7:02 PM Andy Shevchenko > > wrote: > > > On Tue, Jan 12, 2021 at 09:30:31AM -0800, Saravana Kannan wrote: > > > > On Tue, Jan 12, 2021 at 5:42 AM Calvin Johnson > > > > wrote: > > ... > > > > > > + ret = fwnode_property_read_u32(fwnode, "reg", id); > > > > > + if (!(ret && is_acpi_node(fwnode))) > > > > > + return ret; > > > > > + > > > > > +#ifdef CONFIG_ACPI > > > > > + status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(fwnode), > > > > > + METHOD_NAME__ADR, NULL, &adr); > > > > > + if (ACPI_FAILURE(status)) > > > > > + return -EINVAL; > > > > > + *id = (u32)adr; > > > > > +#endif > > > > > + return 0; > > > > > Also ACPI and DT > > > > aren't mutually exclusive if I'm not mistaken. > > > > > > That's why we try 'reg' property for both cases first. > > > > > > is_acpi_fwnode() conditional is that what I don't like though. > > > > I'm not sure what you mean here, care to elaborate? > > I meant is_acpi_node(fwnode) in the conditional. > > I think it's redundant and we can simple do something like this: > > if (ret) { > #ifdef ACPI > ... > #else > return ret; > #endif > } > return 0; > > -- Right, that should work. And I'd prefer it too.