Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3562153pxu; Tue, 15 Dec 2020 09:47:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/ZxL70F+4XSYuH0qjkII4oxic1EPE8YkzJUehVu1mAT/EeDI5WnqN7v53TxrR9JUFhBCu X-Received: by 2002:a17:906:edc8:: with SMTP id sb8mr28244146ejb.247.1608054458160; Tue, 15 Dec 2020 09:47:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608054458; cv=none; d=google.com; s=arc-20160816; b=nKCCT0p0VRU2nJpXNVIqKL+57OnHgqDIxuPzo1UkDqwjXUtDRyNI/Fi5m7kIyDWAfW GWclinu6RtgjIBC9Huvg0cYyusRwTNoaU+hAFeMlGBafMiFGlDVdS2JWu023CY6pvNkY T0vI6Uu9zfCRMJc/JRm52pi2CiQzqQ+05PCHuphAXM/DZ9t2MC95i24SNoOpjrgUoOKc X7JCEglRQ/HEhAxEPIOKFvWfkhPYswZPRoiply+J9N3RBYpkiswGzWJlN0lOFA6uqt25 8+ueRhkI6FfpUl1EaVrGMzEUk2KdZCUDmpq3cNTtluPQfCQRQInG0jXHaqJw/61mtRqO mqFA== 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=8ThQTZX/xY0rNYysmJ/qm+hVZ2miL/UxBMa/A766wd0=; b=GBtLUSAki/JpYdXLN/ygAjeG45TCBtDQzHEEp1bsDTOk+BxivocKJqlEfvR8SOzD9p 0+Pyv+cRdT/JtirRHSjHYikOzpDUatvbA9WQKiz2OJLddRsrEZ1G108Ksfh6UwdK/cQY hpS0IlgsZhL0UXPXa6kc87LE1QWXy+mohmul09+/Ka4HICa/Yj4eXbfTNl0k6popI00D t7mOern8D1N7k2uoKmg4se/whEuWJKqbDrH1DLTrYVdVwTE4mxMQReulWPDIs7oYot3w oaDUoK1bqp4hVbJDHy4vduogPPgvNPG+JsqEC2afEQ4t5PqUm8OgVySGYzBWZH7HyBuj obpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W9ukwTxh; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s6si1277033ejb.276.2020.12.15.09.47.14; Tue, 15 Dec 2020 09:47:38 -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=@gmail.com header.s=20161025 header.b=W9ukwTxh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731420AbgLORpT (ORCPT + 99 others); Tue, 15 Dec 2020 12:45:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731231AbgLORpI (ORCPT ); Tue, 15 Dec 2020 12:45:08 -0500 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADABC06179C; Tue, 15 Dec 2020 09:44:28 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id iq13so11732pjb.3; Tue, 15 Dec 2020 09:44:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8ThQTZX/xY0rNYysmJ/qm+hVZ2miL/UxBMa/A766wd0=; b=W9ukwTxhJN/hsc4JcxP4IpiUTw4T9UdUDs32QWwUYzNyit2T1akC7c4Rh3BWmUww8c xBk0VPPh24NUJk65PPcBmckI7wSLSYSXyn9AHfP69veD0ECeHF5bGlWRs4vi/305Zgna 2mMfFoXPTwuRn0DsnYA04pwUU+EAOplP73lRXP8yhYqWJ9G2GT6JHD6XmCPxb5lysyfV svpYyhwFziWOgo/BW9tNqymqMmXr6iYXhhA+nHX9m5xYEe8zFYTr+EjXtykqjxouZfF3 SLSpXzS7w931hFtmhy68S2Dfh9Sr+vnYv9sBVNZBzE7PklLknBplRKoHtZ/ZWqisVrBM /JFQ== 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=8ThQTZX/xY0rNYysmJ/qm+hVZ2miL/UxBMa/A766wd0=; b=IPA9tzDQpFvDG71fVzXppB1aoX9kZlO5BddPpQD6J90/Qi1oqCiw73MlYH2GMUU9Yq 9MhZHv06imxNYqpki0tfK7Eg2dibOV+jOKUi09ZrtPfCT6Ijbjp2x6mY/ATccbuMcxgE uJDxtLG/1SNqiKbgZwhe12eEqIycag2BEF+ju0bsnJBjkgVnwTFL8OCum0S0Nct5zqE6 R6wvLwFmzW8Cut/JNRk7WbvoLbEhPtnln5dT5tT47AnGPA41Iv0fzVtUBb5vO1dhayFf hf8AO+x4AqkNfWG+h+Esapy35TMn1DXGO3WsQR98gmUh+OGEAwrDdx3hGnDwR2i2D59k qP3Q== X-Gm-Message-State: AOAM531C5TCwjoJ0es92WR2UMRGPIU2Hb/Z/z3wI7U8utRR9AappQHEM AazhXUVTzxmMt8raUBS9AI0rNF/OuUfka7I2wz8= X-Received: by 2002:a17:90a:c592:: with SMTP id l18mr3019pjt.228.1608054267894; Tue, 15 Dec 2020 09:44:27 -0800 (PST) MIME-Version: 1.0 References: <20201215164315.3666-1-calvin.johnson@oss.nxp.com> <20201215164315.3666-11-calvin.johnson@oss.nxp.com> In-Reply-To: <20201215164315.3666-11-calvin.johnson@oss.nxp.com> From: Andy Shevchenko Date: Tue, 15 Dec 2020 19:45:16 +0200 Message-ID: Subject: Re: [net-next PATCH v2 10/14] device property: Introduce fwnode_get_id() To: Calvin Johnson Cc: Grant Likely , "Rafael J . Wysocki" , 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 , "linux.cj" , Laurentiu Tudor , Diana Madalina Craciun , ACPI Devel Maling List , Linux Kernel Mailing List , linux-arm Mailing List , netdev , Andy Shevchenko , 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 Tue, Dec 15, 2020 at 6:44 PM Calvin Johnson wrote: > > Using fwnode_get_id(), get the reg property value for DT node > and get the _ADR object value for ACPI node. and -> or ... > +/** > + * fwnode_get_id - Get the id of a fwnode. > + * @fwnode: firmware node > + * @id: id of the fwnode > + * > + * Returns 0 on success or a negative errno. > + */ > +int fwnode_get_id(struct fwnode_handle *fwnode, u32 *id) > +{ > + unsigned long long adr; > + acpi_status status; > + > + if (is_of_node(fwnode)) { > + return of_property_read_u32(to_of_node(fwnode), "reg", id); ACPI nodes can hold reg property as well. I would rather think about ret = fwnode_property_read_u32(fwnode, "reg", id) if (!(ret && is_acpi_node(fwnode))) return ret; > + } else if (is_acpi_node(fwnode)) { Redundant 'else' > + status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(fwnode), > + METHOD_NAME__ADR, NULL, &adr); > + if (ACPI_FAILURE(status)) > + return -ENODATA; I'm wondering if it compiles when CONFIG_ACPI=n. > + *id = (u32)adr; > + return 0; > + } > + return -EINVAL; > +} -- With Best Regards, Andy Shevchenko