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 0ACA4C433E0 for ; Wed, 20 Jan 2021 19:14:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5C2C23403 for ; Wed, 20 Jan 2021 19:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392375AbhATTOV (ORCPT ); Wed, 20 Jan 2021 14:14:21 -0500 Received: from mail-wm1-f42.google.com ([209.85.128.42]:38206 "EHLO mail-wm1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388578AbhATTNo (ORCPT ); Wed, 20 Jan 2021 14:13:44 -0500 Received: by mail-wm1-f42.google.com with SMTP id y187so3807021wmd.3; Wed, 20 Jan 2021 11:13:28 -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=MBnGinpLx/odbS3fMalb2PzzBTxTBoYrscYbO4dcTx4=; b=jQK8KsomxkfnpfpF06mYjwHfydEhZZRMxmpaztn9NkUx54MfEK9fn9wocyoa1BbVzt YW1La+uX/oiAQCLmr5ZpNZTpmySgblUJyuYpmkTnGe4aPM2U2mvXFgElHDqlyct2V45U cjMAPCbch1jICD3HqdjgveCuw+VxZ+YxfgZo55fPPxszNNPJwZtotvt5nwbZCWAde9Ol hx8RpgaMedSXfmYUbMhgGob4A13g177bHE8J8Vw6twC2ooBArPUfeQChlazn/3dZxXSz VitUO0K8ej/iG/7nelG33ZTHKLN1cEJmqXjoW97xnM47laEPY5Oi+uEBprMlFZL526k/ sOEg== X-Gm-Message-State: AOAM5307vz7dJHGgOy4N5jjq62h1jE3cNC+rwzPAQOZwZb/yo9YQe9yy ot5MPwJ1miARJQIO0jJvUMblkqNS6zD2489tiq8= X-Google-Smtp-Source: ABdhPJw8c6qlkHR9iOkx8qE2vXeyMZs0yuZj2aqvZqkBYp8IXyAbHDidFzxsbIm2t+aeBTe9BpPR7HOZC2oOs1VO7wQ= X-Received: by 2002:a1c:a593:: with SMTP id o141mr5723964wme.92.1611169982589; Wed, 20 Jan 2021 11:13:02 -0800 (PST) MIME-Version: 1.0 References: <20210112134054.342-1-calvin.johnson@oss.nxp.com> <20210112134054.342-10-calvin.johnson@oss.nxp.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 20 Jan 2021 20:12:26 +0100 Message-ID: Subject: Re: [net-next PATCH v3 09/15] device property: Introduce fwnode_get_id() To: Andy Shevchenko Cc: "Rafael J. Wysocki" , 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 , Linux Kernel Mailing List , netdev , Laurentiu Tudor , ACPI Devel Maling List , "linux.cj" , linux-arm Mailing List , Andy Shevchenko , Bartosz Golaszewski , Greg Kroah-Hartman , Laurent Pinchart , Randy Dunlap , Saravana Kannan 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:44 PM Andy Shevchenko wrote: > > On Wed, Jan 20, 2021 at 8:18 PM Rafael J. Wysocki wrote: > > On Tue, Jan 12, 2021 at 4:47 PM Andy Shevchenko > > wrote: > > > On Tue, Jan 12, 2021 at 3:42 PM Calvin Johnson > > > wrote: > > ... > > > > > +int fwnode_get_id(struct fwnode_handle *fwnode, u32 *id) > > > > +{ > > > > +#ifdef CONFIG_ACPI > > > > + unsigned long long adr; > > > > + acpi_status status; > > > > +#endif > > > > + int ret; > > > > + > > > > + 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; > > > > > > Shouldn't be > > > > > > return 0; > > > #else > > > return -EINVAL; > > > #endif > > > > > > ? > > > > > > Yes, it's a theoretical case when is_acpi_node() returns true when > > > CONFIG_ACPI=n. > > > > How so? is_acpi_node() is defined as a static inline returning false then. > > I understand that, that's why it's pure theoretical when, for example, > the semantics is changed. But I believe it's unlucky to happen. Changing the definition of it for CONFIG_ACPI=n would be a regression given the current usage of it.