Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5965268ybi; Wed, 12 Jun 2019 11:30:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/vqdhVlviAr6XTX7apASTvVUWMWYvVfsKX/png6ZL1nm3HHqNq2j3dPvkO4XCIews7L5b X-Received: by 2002:a65:6210:: with SMTP id d16mr24778730pgv.180.1560364253344; Wed, 12 Jun 2019 11:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560364253; cv=none; d=google.com; s=arc-20160816; b=MgXBZBdUQfi7qcPLyKnvwfCJmUTlGQbgBxc+9BDfphKRPGMROqsirISWpZQ64QsczK eDgEuWNahHqnwnXtHqIs6sCvm8G/txn+oafyc9XF3u6EUeDUcN8q3z3EzqZkaA8XDi84 0kytfo9U1/KrMm/SH5YGPja9js6zhTFK0lRuABkCpcMQXFTKfq8NCsGRAemgAxA5rJBI h1OtTfiI5H5rIwzcbnbrdcGlR6wFxN8v6H9afbb5+LoB1nTr7iutisMrsw1hvla0um80 cL0buYQkqYPnIO6ULRfCXz8yQfOLs7AsI94ojFgzEdWfMDd2na059SBDYzsDSo6xT5fv iMFw== 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=/xh+lRCoBNSUNCnjzBT3gFLnOefy9JtUPnH1Sk9zgEY=; b=KhWXiYW23zySEqlEzGKWzj/bnraZgxax696OQSys3d8j+qpatPfUVrSvP5R7dGO2Ig rLBsaCqsc1uPJogpyhFfz04Sg0vusbz4Dw0JiX1g3n0UWco6PTUBvGSlvle35nmPVUgE cu+5JtU1PxB1r+FwPnrxhQRbRcjUqkTug5DMEcn66TCJORGzgbVd5Ey93A6pAu1lVjbi ToRwcH7FfDcMvv668IZ/FI8pMUasyVilOmyK6kCr+4LRGy+EnqkiwHMIIzDxt8eONx7D ACWC8QI3IaZRrSDa5KOQg70EWP5ZIRUcgEx/uyAeSwpiIo0rkKc4SWKxRY6XXKUOUALN bWzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qScjuueY; 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 j185si443639pfb.107.2019.06.12.11.30.36; Wed, 12 Jun 2019 11:30:53 -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=qScjuueY; 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 S1726948AbfFLS3K (ORCPT + 99 others); Wed, 12 Jun 2019 14:29:10 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35999 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbfFLS3K (ORCPT ); Wed, 12 Jun 2019 14:29:10 -0400 Received: by mail-pf1-f194.google.com with SMTP id r7so4281019pfl.3; Wed, 12 Jun 2019 11:29:09 -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=/xh+lRCoBNSUNCnjzBT3gFLnOefy9JtUPnH1Sk9zgEY=; b=qScjuueY/Y7fAPJLdBsYS3qqBDIRMMmGLaeatFVjunpMbFOrhCu9BNyFsprRA/pMIH M3k+wlQU5Rv+FewVRd5PnagyahVuj+rN7qLWNw3BUkeHMyeY9GFAC2sch2WHjW8O85AP o8iMswHm/gzoWO9p1HakHSni5AdvjWGoU/eTj+UAxRThi0dr7knaSTKgh7gTSLmU7rbj XgP/iSIWpFd6Nzty3ea9R1EawtTpsU83a5AZhUI//q+TrQ3f26dX5a3iAqcFYj1qo7Uy tn/cLFwSG9JBXuNzQXmd0j4/Zmq3+SHhbMfj1hMT2izwsplM7lHOT9RJToTO5clbE523 ZrVA== 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=/xh+lRCoBNSUNCnjzBT3gFLnOefy9JtUPnH1Sk9zgEY=; b=swYnUGK+qhWbBtjwQHDj339xyA6jzPr83QPDkXXsPzz7RjepR7JQ/FCbeSujPQMIDA HZp/ON6ECS0N4iC0uU8l8K+oBvqK4Wv4WtW3Lz2nPwrABTQvn+/OTMtPR4EIYyOJiQai Xs8vdNmhq/tbO2+fV6sSPLHRkkZUZRg2r0mN3HryM3xboMN0m/DPQ+Pnv/A6BGsA69nM 8H1Z70SKY+ovETL1kZrlE5zPPjEL9FdruEH1xN/I5DhDYvFTbh/tKllXLpT8ExLnyEkY AhJ+9N4stj7VuNMESBbmxiR8/8fpy/KhyFin7R6DCzQ3WZcS4YG4+XXSyrBykQ1Gbe1O t3WA== X-Gm-Message-State: APjAAAUxaFLZyt9Yf9P+SD4r0LyHYAi660J9x4vHg5cTH/s3+HYNh2e8 VQrkXFS1CE0f2R23dY8ATik= X-Received: by 2002:a63:7ca:: with SMTP id 193mr26036392pgh.240.1560364149360; Wed, 12 Jun 2019 11:29:09 -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 z14sm174571pgs.79.2019.06.12.11.29.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jun 2019 11:29:08 -0700 (PDT) Subject: Re: [PATCH next] of/fdt: Fix defined but not used compiler warning To: Rob Herring Cc: Kefeng Wang , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Stephen Boyd References: <20190612010011.90185-1-wangkefeng.wang@huawei.com> <0702fa2d-1952-e9fc-8e17-a93f3b90a958@gmail.com> From: Frank Rowand Message-ID: <41acc800-1ab8-c715-2674-c1204d546b4f@gmail.com> Date: Wed, 12 Jun 2019 11:29:07 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/12/19 10:00 AM, Rob Herring wrote: > On Wed, Jun 12, 2019 at 10:45 AM Frank Rowand wrote: >> >> Hi Kefeng, >> >> If Rob agrees, I'd like to see one more change in this patch. >> >> Since the only caller of of_fdt_match() is of_flat_dt_match(), >> can you move the body of of_fdt_match() into of_flat_dt_match() >> and eliminate of_fdt_match()? > > That's fine as long as we think there's never any use for of_fdt_match > after init? Fixup of nodes in an overlay for example. We can always re-expose the functionality as of_fdt_match() in the future if the need arises. But Stephen's recent patch was moving in the opposite direction, removing of_fdt_match() from the header file and making it static. -Frank > > Rob > >> >> (Noting that of_flat_dt_match() consists only of the call to >> of_fdt_match().) >> >> -Frank >> >> >> On 6/11/19 6:00 PM, Kefeng Wang wrote: >>> When CONFIG_OF_EARLY_FLATTREE is disabled, there is a compiler warning, >>> >>> drivers/of/fdt.c:129:19: warning: ‘of_fdt_match’ defined but not used [-Wunused-function] >>> static int __init of_fdt_match(const void *blob, unsigned long node, >>> >>> Move of_fdt_match() and of_fdt_is_compatible() under CONFIG_OF_EARLY_FLATTREE >>> to fix it. >>> >>> Cc: Stephen Boyd >>> Cc: Rob Herring >>> Cc: Frank Rowand >>> Signed-off-by: Kefeng Wang >>> --- >>> drivers/of/fdt.c | 106 +++++++++++++++++++++++------------------------ >>> 1 file changed, 53 insertions(+), 53 deletions(-) >>> >>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c >>> index 3d36b5afd9bd..d6afd5b22940 100644 >>> --- a/drivers/of/fdt.c >>> +++ b/drivers/of/fdt.c >>> @@ -78,38 +78,6 @@ void __init of_fdt_limit_memory(int limit) >>> } >>> } >>> >>> -/** >>> - * of_fdt_is_compatible - Return true if given node from the given blob has >>> - * compat in its compatible list >>> - * @blob: A device tree blob >>> - * @node: node to test >>> - * @compat: compatible string to compare with compatible list. >>> - * >>> - * On match, returns a non-zero value with smaller values returned for more >>> - * specific compatible values. >>> - */ >>> -static int of_fdt_is_compatible(const void *blob, >>> - unsigned long node, const char *compat) >>> -{ >>> - const char *cp; >>> - int cplen; >>> - unsigned long l, score = 0; >>> - >>> - cp = fdt_getprop(blob, node, "compatible", &cplen); >>> - if (cp == NULL) >>> - return 0; >>> - while (cplen > 0) { >>> - score++; >>> - if (of_compat_cmp(cp, compat, strlen(compat)) == 0) >>> - return score; >>> - l = strlen(cp) + 1; >>> - cp += l; >>> - cplen -= l; >>> - } >>> - >>> - return 0; >>> -} >>> - >>> static bool of_fdt_device_is_available(const void *blob, unsigned long node) >>> { >>> const char *status = fdt_getprop(blob, node, "status", NULL); >>> @@ -123,27 +91,6 @@ static bool of_fdt_device_is_available(const void *blob, unsigned long node) >>> return false; >>> } >>> >>> -/** >>> - * of_fdt_match - Return true if node matches a list of compatible values >>> - */ >>> -static int __init of_fdt_match(const void *blob, unsigned long node,> - const char *const *compat) >>> -{ >>> - unsigned int tmp, score = 0; >>> - >>> - if (!compat) >>> - return 0; >>> - >>> - while (*compat) { >>> - tmp = of_fdt_is_compatible(blob, node, *compat); >>> - if (tmp && (score == 0 || (tmp < score))) >>> - score = tmp; >>> - compat++; >>> - } >>> - >>> - return score; >>> -} >>> - >>> static void *unflatten_dt_alloc(void **mem, unsigned long size, >>> unsigned long align) >>> { >>> @@ -764,6 +711,59 @@ const void *__init of_get_flat_dt_prop(unsigned long node, const char *name, >>> return fdt_getprop(initial_boot_params, node, name, size); >>> } >>> >>> +/** >>> + * of_fdt_is_compatible - Return true if given node from the given blob has >>> + * compat in its compatible list >>> + * @blob: A device tree blob >>> + * @node: node to test >>> + * @compat: compatible string to compare with compatible list. >>> + * >>> + * On match, returns a non-zero value with smaller values returned for more >>> + * specific compatible values. >>> + */ >>> +static int of_fdt_is_compatible(const void *blob, >>> + unsigned long node, const char *compat) >>> +{ >>> + const char *cp; >>> + int cplen; >>> + unsigned long l, score = 0; >>> + >>> + cp = fdt_getprop(blob, node, "compatible", &cplen); >>> + if (cp == NULL) >>> + return 0; >>> + while (cplen > 0) { >>> + score++; >>> + if (of_compat_cmp(cp, compat, strlen(compat)) == 0) >>> + return score; >>> + l = strlen(cp) + 1; >>> + cp += l; >>> + cplen -= l; >>> + } >>> + >>> + return 0; >>> +} >>> + >>> +/** >>> + * of_fdt_match - Return true if node matches a list of compatible values >>> + */ >>> +static int __init of_fdt_match(const void *blob, unsigned long node, >>> + const char *const *compat) >>> +{ >>> + unsigned int tmp, score = 0; >>> + >>> + if (!compat) >>> + return 0; >>> + >>> + while (*compat) { >>> + tmp = of_fdt_is_compatible(blob, node, *compat); >>> + if (tmp && (score == 0 || (tmp < score))) >>> + score = tmp; >>> + compat++; >>> + } >>> + >>> + return score; >>> +} >>> + >>> /** >>> * of_flat_dt_is_compatible - Return true if given node has compat in compatible list >>> * @node: node to test >>> >> >