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 4A3ADC43381 for ; Fri, 22 Jan 2021 16:46:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10DB023A79 for ; Fri, 22 Jan 2021 16:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728760AbhAVQmA (ORCPT ); Fri, 22 Jan 2021 11:42:00 -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-Google-Smtp-Source: ABdhPJxNJ2wvRRXdQ/YZlopcgpGZ26D4L7j3Kp5mfxpU0edrQrsmUV3VOk1J3Rk1OEfhRrxRfbJQoDpsNQJvmizZBpw= 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.