Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3327059imm; Tue, 4 Sep 2018 20:57:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaFE9uF3jjt5b4PdOaUWLcKc1L0Qf/ZkgNcYVg4LHkBBOOVoNgUKAY5V4JM0wHH7XzqtDOH X-Received: by 2002:a63:1865:: with SMTP id 37-v6mr19644790pgy.313.1536119845397; Tue, 04 Sep 2018 20:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536119845; cv=none; d=google.com; s=arc-20160816; b=e5Ec3MowYaPhkBipkMbrzvv8nvbYiMtUGhPo8SPLKjxprnmvYriVW/CskvLtbRVwwN Gh24KLZvyz5iGXjlqPvZfyt+eAUQ5ZGQ+PHenAzVPoAA/utdADhF4XUaPAuum5qyRdbd 2GUIRfShhZLC4QrZfbY9OVZ/3n3e5xXA+toKQRC77oDSU2zjyG8Hq+AqnxkYaZ25FnVI hLGkbGzwASHD3GwHbQnZDJDA3Fy1o5GTGExQ1mg/0dLBP/mSr4L25/yt4STh7EL1cWEh qqMcvu5sLk2Y8j3OsMGE/ZzqshgOYt+AVRk3xhuOz7jQw3k7sJUcSd2t+cbRx5HdHYkG H1Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ciAwn3IIVv6+wuAF5k9PHA/y8ixxUAE4cv4B+WenSow=; b=rvlT00YdOa3A6RhADQ+XRU9HjIBOptc5dIqmMw1LCpIWd9u/UznW0oU9vKrsx/zTmw XhXIc8wBJI37oYFkkePDmXNN+94mKlZhAdCRAoKWZG9c/C0s9RI5SQMa5FCFeiNG5Pe7 GwTwJvD7CVQRKRXsXpjMIbV6xM3RafoE6tPUVxHHSW+fH8bHGQ3i8l0WZh2bG53aZkdF LVDPshDuo6EimRJd0SxELKbtVhSmEapMoPErTv8VcYjHvukaIr702qruvuZuROhFSoWv eWzEE3d99ZaafLtcOKHHcBcMzNNhiiHVvCmb0fMkgdz0k879g/5tLYEUQHyxAgNos5b9 B2Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MHUsro75; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id r22-v6si813884pgm.258.2018.09.04.20.57.09; Tue, 04 Sep 2018 20:57:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MHUsro75; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727307AbeIEIYC (ORCPT + 99 others); Wed, 5 Sep 2018 04:24:02 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34126 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbeIEIYC (ORCPT ); Wed, 5 Sep 2018 04:24:02 -0400 Received: by mail-pl1-f195.google.com with SMTP id f6-v6so2632982plo.1; Tue, 04 Sep 2018 20:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ciAwn3IIVv6+wuAF5k9PHA/y8ixxUAE4cv4B+WenSow=; b=MHUsro75lJPcPAdxQwkPGnpZMyq96daNfVnoIHJ+kK/ZQaXLp9XRZ/Oa2NUf7pc23h okwNlfJx2t6+fOPCoBUFEsD3pAe+ZESUfeblkM4qx+1WEzcBfGS/A3S2R1B/ROiCtLTZ vWrnOK6L9kDjamydWtcl8APCDcTuSbKenGYpm7vVoOEWgqLtybWox7vr6ckOQtNFPVNd Jlt4RRWldOUtKm0ovX8MN/nyBuCIFGfH9BtpyMyQ3Hkcme5QjNzCIdMmceWtmr6NFRoa ntL/m/s7YU67E/6DcNd74qyxfYU5Ed9bavRPVBR1Vg+VpLwUidyczJBTjmAPKkBCsoIF 9RPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ciAwn3IIVv6+wuAF5k9PHA/y8ixxUAE4cv4B+WenSow=; b=DSd5dohNatWVNy0ItJFCLt3sPerR7fRCe+atKveQqDYHb3Temrx+DMbKnT2WRiudlT xIo1ttYyjYH0le+rZKdsqqUdtykXIH1otwLHs7lKnrCxYaxSZ9KPF1E7gyQRcX8LsoCh 7rGHUO7VkGFlddRk9/fIvtcBiprOEGIZBdqZo6SBsIQZjbLEhOju2aUv5w/M1XXNdgIy uYsjVCHDYu0Y9E6qRULLsE8Izm+L5KZc2u9jCzDjwfLTLewXAKXNVELA384FPCejH5t2 /43+3tFMqtikmX6yVl8qQX6mdErXeGACGgoxtSCoLBU6/sbdcXO+siOk0zLH5ECVzVbn 7hxQ== X-Gm-Message-State: APzg51DIo85IoYLyTztxVMvXza88ugRbhgzNzwpNeVakV6qO0RUxJKND 5jzEGswGw6dn/8/6i0tUFCOe4Nrq X-Received: by 2002:a17:902:b702:: with SMTP id d2-v6mr37313884pls.12.1536119751074; Tue, 04 Sep 2018 20:55:51 -0700 (PDT) Received: from [192.168.1.70] (c-24-6-192-50.hsd1.ca.comcast.net. [24.6.192.50]) by smtp.gmail.com with ESMTPSA id n22-v6sm778321pfj.68.2018.09.04.20.55.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 20:55:50 -0700 (PDT) Subject: Re: [PATCH] of: Add device_type access helper functions To: Rob Herring , devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20180830185229.20393-1-robh@kernel.org> From: Frank Rowand Message-ID: <4253073f-5ddf-a01c-4d3e-5c6a13068903@gmail.com> Date: Tue, 4 Sep 2018 20:55:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180830185229.20393-1-robh@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/30/18 11:52, Rob Herring wrote: > In preparation to remove direct access to device_node.type, add > of_node_is_type() and of_node_get_device_type() helpers to check and > retrieve the device type. > > Cc: Frank Rowand > Signed-off-by: Rob Herring > --- > include/linux/of.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/include/linux/of.h b/include/linux/of.h > index a40f63a36afa..506beca9588d 100644 > --- a/include/linux/of.h > +++ b/include/linux/of.h > @@ -980,6 +980,18 @@ static inline struct device_node *of_find_matching_node( > return of_find_matching_node_and_match(from, matches, NULL); > } > > +static inline const char *of_node_get_device_type(const struct device_node *np) > +{ > + return of_get_property(np, "type", NULL); I'm a little confused. The patch comment says "remove direct access to device_node.type. device_node.type is set to the value of the property "device_type" in populate_node(), but of_node_get_device_type() is looking for property "type". > +}> + > +static inline bool of_node_is_type(const struct device_node *np, const char *type) > +{ > + const char *match = of_node_get_device_type(np); > + > + return np && match && type && !of_prop_cmp(match, type); > +} > + > /** > * of_property_count_u8_elems - Count the number of u8 elements in a property > * > I'd like to see one or two examples of how you plan to use of_node_get_device_type() (outside of of_node_is_type()) and examples of planned use of of_node_is_type() so I can better understand anticipated usage. Complete, clean patches not needed for the examples, just enough text for me to see the resulting code change where the helpers are used. -Frank