Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp492577pxb; Wed, 20 Jan 2021 12:04:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQ64zhASg3/w9dwbZNAdwdfscHFP22BS4WxlVw/isZucCGHLgtQCjFGTwnIjs4jaivLBgu X-Received: by 2002:a17:906:8057:: with SMTP id x23mr7306794ejw.179.1611173073581; Wed, 20 Jan 2021 12:04:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611173073; cv=none; d=google.com; s=arc-20160816; b=fIB+DLxY7ZMpu67CY18TijtU5IEmmH21hINUTP+hRLWCsH+72p+uC7VJdq0lRwdIKA 8TxSmsYlUXvBxMzEKpCHNtKv8C60cbqB3G+PtMaRMTmGw85M5+OANsZRSRfHGXvRQEt6 g2IfEFYB30xPNWojv+ACskVqPvJ6uNQeY6wNcElhTNGsMoo5IX2guA0qpFiLDaLHaZeF VvDVhEpsEJGFnp7Jst0t5EJXcxCYvmffhGzqADDz7/38EaENmSAPPQjn4amC4CIaDP+Q t92bsYwj/XkpB8aGM2TilRoCO3ipwyTMAiIGoYW26LB4pD8S2gaTT2A/dI8AYR8DTfth 4WRQ== 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:dkim-signature; bh=iIQkHFua75zKVFsuhL/YtTgWQYbFphkYUNhcmtte7cI=; b=qQJTfdQm6ERysZJgbHcQ13/SdHE/ZS3iEL8ZXTzDxhTqHOTV3LIRgLM+xIIaO5vk1X CDaX0eZVPr+PqqRWFfA8G4dW6qF/2YKAvdwrB3jE9mvJRAf6kDKzahCFngd27aXzrJVV htlY6bdAxwj83nA96KkbEYsLa+f/KY3G/ngAaEydIpraTDFVQsWaaYn8/EPjDpZ8gSeo dhnP7HaWNdYPoFb2uEL/EQNSw7ZxvkDgjVMWFn6HdrMU30SwsKScyWoOnv9oNLTFB/5h 4qRcXZ06jE5kE0H07qbwG8HsMehOgf0FK4lZv9aR2TUJwEGzyzZIbmlGLWOcCt0Xhhxz MBbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FntrFOmo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id br22si1010156ejb.431.2021.01.20.12.04.08; Wed, 20 Jan 2021 12:04:33 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=FntrFOmo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392842AbhATUC7 (ORCPT + 99 others); Wed, 20 Jan 2021 15:02:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392751AbhATUCf (ORCPT ); Wed, 20 Jan 2021 15:02:35 -0500 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81020C061757 for ; Wed, 20 Jan 2021 12:01:55 -0800 (PST) Received: by mail-yb1-xb2c.google.com with SMTP id k132so13489518ybf.2 for ; Wed, 20 Jan 2021 12:01:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iIQkHFua75zKVFsuhL/YtTgWQYbFphkYUNhcmtte7cI=; b=FntrFOmogvKLljoXUn9c934WUcHRtUiQRvpd1ZiGtPRYhNn82GXlOUvaDhdrrnSMIs 9Y5JZD0vzWwnq/qt6P/x4m8XCD3c4JaDLhhQQvpq+mIrJu8eaSyfvCUZJI1uTdCBxari OTNusp/ISB2xalHx2ROzznYLKWsUj+QxxDT7fbyyzi3UmgYYTBzZ1Q8jdSVvtUUMM0se 55WaSuNRYtQwtFrFedV9mbw+cArjqgUI8Obcm6DTpaPL+L97/TIxH8G00S/T9jFIkzb5 itak5MGLNjY70QgK/jGBN8hl+0aXCaMC5HOmtrRRDnXlCc1tx4zfFyv2alxKW0w2PViZ 3bdQ== 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=iIQkHFua75zKVFsuhL/YtTgWQYbFphkYUNhcmtte7cI=; b=K2Jl243cz2i6yAvRXiWr3brvg3WlJCO0w0EOMF+foDGuItPdnYulQxeiUbdkDmtVT+ lrY7tZrv+FHkg+GrD0SFnIGHmLapsnGR/zTMFbJLBlRy+GU4uzZfc6dXOWfCFUcA+35L Rtvjzw39QO9/ObBflKRvtIXZKN6q+pSXgmXUZiBobYt9A8cCLCLOBmwBnq0TKd+3EG+Y aZd5jgXlgk8J35EqaXKcLvpGj9wUazxSOMHCymoueWxTBUxsMatsvRaFzE2ViaImEpmI 9DNzUSMSL+9EKGuCJ4pSVp1IpXeEYX29XbXWjErjDx51fGUdFcIh3zknUkQs3+pDPh83 PfWg== X-Gm-Message-State: AOAM532A3r38jN7ezCKH6zWjLrSN2BRvc7n2Z4EiF1PSRZtqqt9ys3/R PJuAwl5dnwPeczf9IceVg1LcufT6Zavpk6k37olhAQ== X-Received: by 2002:a25:c343:: with SMTP id t64mr15648975ybf.228.1611172914565; Wed, 20 Jan 2021 12:01:54 -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: Saravana Kannan Date: Wed, 20 Jan 2021 12:01:18 -0800 Message-ID: Subject: Re: [net-next PATCH v3 09/15] device property: Introduce fwnode_get_id() To: "Rafael J. Wysocki" Cc: 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 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? -Saravana