Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1168415pxb; Fri, 22 Jan 2021 08:43:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJziFvSXyQkOez5lEbj8jmZ/ONSiK7nprWZzOBGvs68KJBNuny7Az5gOdIRp3VHMjq5+rs4J X-Received: by 2002:aa7:c9cf:: with SMTP id i15mr3831935edt.296.1611333802882; Fri, 22 Jan 2021 08:43:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611333802; cv=none; d=google.com; s=arc-20160816; b=pjX7Bho96JlbuN3sat0HeOtxKjINoPABm71IwgLzjqxpIvpt7NX27jTIv9sExYth9D xR+G/L4JFJayMYNV/WvWgmSrbuA/iB8K9BcT9apXPb6uKt4hL7ljFFSHDnhY+bXVhpLU Pg2QG9qBszGH5eL7cpE3yNXCAky18gX5rqYFVlzyzt5RpbGvKPfXY/5T/HXeT2Yf0gRs Ql7FIsHntmTHD/ftVGEyNzg65mx20N4u+75McfD+/RYFUwS6w0x5JdaIu1PBtxmZBHrg mHcs2a5/9oazmM4tJBsC0dpCbBpci6UfAnAEPXnPG19/VKeKm/L/reavG0YvjF2FxJhq oZRg== 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=7ziah0gDgjxW52q7hTGscqUGRQaHkOp440j+Y21a5So=; b=Ng/HkFr0iVvH0SS24oswaHpaSQjKWeEbjJDAj/YizmAE+pmEpMDH+MxP2OiZJTz3EY IIC76Yr62jUtyvzGdcUsOGEd9kJiJhHbTdiiDIj0Yego3IqOxQ+uP9uXjjN1RZtlYaaZ vZYNL6UWevBbVJrQmSDtzftdNe9qiVsjanS+qLMIfK4c9iI67l3FnYHHQjE87M8nrOBn NZAAXQgCEO2sVaZ7GEC9tv4DeJw7TseO61SXTruqU4GVIVW1NvahWryRxY+SYqMG4GvG Tr4XHrPIi71dVlvO0V847cJiKpXeRTcrNp/Shr4/Yt8ZWKLUPtm3nokZNHTY2enQ0PF6 aH2Q== 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 oz26si3113149ejb.181.2021.01.22.08.42.45; Fri, 22 Jan 2021 08:43:22 -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 S1728018AbhAVQkx (ORCPT + 99 others); Fri, 22 Jan 2021 11:40:53 -0500 Received: from mail-ot1-f42.google.com ([209.85.210.42]:45440 "EHLO mail-ot1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729681AbhAVQhz (ORCPT ); Fri, 22 Jan 2021 11:37:55 -0500 Received: by mail-ot1-f42.google.com with SMTP id n42so5600744ota.12; Fri, 22 Jan 2021 08:37:14 -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=7ziah0gDgjxW52q7hTGscqUGRQaHkOp440j+Y21a5So=; b=V7wRvj/6ti3ImPdHhBG2RS7aurp3AKeyeNJoxspfVqhm9s7yuSCgQRslUN+01/93l/ YpoUfEEtHniTHjYdHbMapN8t+n0AyiaCOPn+2W4MXJphIsgUkdQf1n020jFaI0zQrqyH 4OTUSaAgX9CUaZztj1XLE7FleXXipW7l99W6HP7XCGpEQIlsWkVv0mbV66irUy4mxrjk naK1YwB73BLOuKn7m6r3t3CQ9qR0carnLEQ5JBxyayxBKCIhGtxWP14OTSYPN1TnrARS Aoi16dcFBMOhZxZTu4NqJqWiBYuq7xH5Ef4+eSp61kFNYsSyVoKE/Nx/D8c//aQ2Ypnt VANg== X-Gm-Message-State: AOAM530Pf1in5AFmxcHeVZyIblV4DMgsF6FAdx3h28MHVIdRR4zFDjs0 KfoaI6m+zvv18Es96TR3tEurBu/R0PtZvK68PEPuxsaa X-Received: by 2002:a9d:1710:: with SMTP id i16mr3885403ota.260.1611333263819; Fri, 22 Jan 2021 08:34:23 -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: Fri, 22 Jan 2021 17:34:12 +0100 Message-ID: Subject: Re: [net-next PATCH v3 09/15] device property: Introduce fwnode_get_id() To: Saravana Kannan Cc: "Rafael J. Wysocki" , Andy Shevchenko , 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 9:01 PM Saravana Kannan wrote: > > On Wed, Jan 20, 2021 at 11:15 AM Rafael J. Wysocki wrote: > > > > 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. > > Rafael, > > I'd rather this new function be an ops instead of a bunch of #ifdef or > if (acpi) checks. Thoughts? Well, it looks more like a helper function than like an op and I'm not even sure how many potential users of it will expect that _ADR should be evaluated in the absence of the "reg" property. It's just that the "reg" property happens to be kind of an _ADR equivalent in this particular binding AFAICS.