From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD3B0C433E9 for ; Wed, 20 Jan 2021 19:17:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67BBD233EB for ; Wed, 20 Jan 2021 19:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392568AbhATTR3 (ORCPT ); Wed, 20 Jan 2021 14:17:29 -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-Google-Smtp-Source: ABdhPJyexTqRRTbwmp5/VB7u2r9ewojCoOLJc1IwN0xo2pOgQvUAZjYUoeFY1P2UQebC0YljtpVYXf80ZqCQK1BVKYU= 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.