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 16205C433E6 for ; Fri, 22 Jan 2021 16:38:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D19F8239EE for ; Fri, 22 Jan 2021 16:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729229AbhAVQic (ORCPT ); Fri, 22 Jan 2021 11:38:32 -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-acpi@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. 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.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 8D9A0C433DB for ; Fri, 22 Jan 2021 16:36:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4E255239EE for ; Fri, 22 Jan 2021 16:36:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E255239EE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XqlpwouJR76bZOGUZ36YmD+nf0wt/4Z9lMAhuwwf63w=; b=vMG94z+x50jD04YSrCKHpFzdJ r2nzjaAV1UfEZVEwoZD+EEt+10cPzcs5VKKLnxuIIUtY/OqvIz6Cy5E8Y+61am2D767zITst6J1LR Le/oQ28y7dSfM+hZGhfFWrj8TJdlFfj27zq6e8FpryPARsRKCUr0YMKOEex30tM4hPcegkrfi6VpF H7Ibu+lmxpBfZOmhXYrT5qgMBYm90451CTwUZLlnsz8hDYzBDZsDt7UYoqGnT7rhF8zwk0o3Qvkuh s00agM6XFEQsBEBjF7o14r6ElHFDC7mg/KkMpxGS1P/VOhdO9E/QDmb8Qipmac3WWJ4V+UhfffDIV gaejIlvjA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2zOH-0006U7-FM; Fri, 22 Jan 2021 16:34:29 +0000 Received: from mail-ot1-f50.google.com ([209.85.210.50]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2zOE-0006Qg-Ey for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 16:34:27 +0000 Received: by mail-ot1-f50.google.com with SMTP id k8so5611735otr.8 for ; Fri, 22 Jan 2021 08:34:24 -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=InJaexnW9wyNQ8tRguUI8dXukYrvFjOT2/Tu/7Aj6RD6BWvDxCK6H9Mq34iWclpjvX GckKTZ8FC2Sooa+Z612Ck5tWvUwOGBFVrw/tKAeP1ijr5Um/fm6g1sDQ1SGz0BgxY3dD gEDFElGlOsquPb9M1TYy8I6g/0/KGqNYz0hXr3K+QNrJeWyu17mlx/DjGmRARYMksUIw ElzQJHTrd1T1WgPMgtKFy3QvK3NZesxgHD4d4bgZSfPpZ/+R+TLQXTQeS918vl8KrfyY 4X4BMnPiBA81/wLre4eE6SoB4pBoz3QyF55fb2lyuGxEKifcbqu66y9GmLxMu9L2iBOs JHsg== X-Gm-Message-State: AOAM531jglQF+pzgq9ZFLrqmAHbt7YstE1Orx+9LHi+8kEisZ99SysNO Xly21uFzuvaumWZZety7NozwNJzZYNcsAqHkcyk= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_113426_506018_8C30EC79 X-CRM114-Status: GOOD ( 23.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Heikki Krogerus , "Rafael J. Wysocki" , Grant Likely , Calvin Johnson , Ioana Ciornei , Florian Fainelli , Bartosz Golaszewski , Jon , Russell King - ARM Linux admin , Diana Madalina Craciun , ACPI Devel Maling List , Andy Shevchenko , Florin Laurentiu Chiculita , Madalin Bucur , Pieter Jansen Van Vuuren , Laurent Pinchart , Marcin Wojtas , linux-arm-kernel , Laurentiu Tudor , netdev , Randy Dunlap , LKML , Jeremy Linton , Cristi Sovaiala , "linux.cj" , Greg Kroah-Hartman Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel