From patchwork Sat Feb 4 05:51:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Dunlap X-Patchwork-Id: 52737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1221225wrn; Fri, 3 Feb 2023 22:11:08 -0800 (PST) X-Google-Smtp-Source: AK7set/wktk13H41HeZT5DL6M+OtMppnkP8FPFLMgQSSm6gR/tCgqwkNY7ACskrjGLDH4j7hUKAg X-Received: by 2002:a17:902:e1c1:b0:198:e1bc:9035 with SMTP id t1-20020a170902e1c100b00198e1bc9035mr3526620pla.63.1675491068314; Fri, 03 Feb 2023 22:11:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675491068; cv=none; d=google.com; s=arc-20160816; b=fbjH+ADHURWRGXEiFnXvvMNeRdSwUUb1FFIQ16P6sZjxPo5WkKVV1Oi81wRIjpfw0e NpZg5r0DgAT9t+O+M21fuVCAnblbeThUnLzxnh8MfnNCQwhL0YNYg4QhdZZ9gKp3KHTb /JLCIeTpkOjH/fHRXNLewyOsNuWCca1r3kTHRTddBv8WnQkz2VkFztesfJaABp6zotl2 KJY/0m33o+GdfVg/Zs5LPjqZIsTKSmuoq6lYLYmSct85vDWKopcTLbgo3mkbH/GN2Wto YmMk4wAFGYkOoChqJ5MZWvzxm/WHBDLS8pGUmoytW80sLINWi+cdAhA3k/o4g+M9M3a/ Sg6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=WzpIxsrWjep5l9VShHrZUT54iLqm1bC6ykl3lav0knk=; b=M1mwpxPi2MHWdSmnkWrmCyL38Pc6gtUoxW8q9LXbum0BcSXu+ljMlDC1HxP/2Jf3xf pXtox75LvPB/FbNciU+PWpsjN6qLLrOdns9WtELFPPhIgZi9gNZzNsicawgXvgKuIiHG rvjan9A1xhwbe7tQNiURaXfc/xUzgBMM3j/dSCWefuS8jhAE68C86RW7rkIey9xdY6bm J7brQ7DOuWkgi/XOxWZizV9JWkw2dxotPYoCfPZVvDYIOucgBLErhHtrMeIViYoR9lnp PfvksMDSa4YEFqoxizu0jXRJGF36ZdOFE0BPKpKhs1N+OIuf3lxoOrNoCAhs2zo+vbcf 1s0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=emr5gnXb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a63b909000000b004df53d66e34si5225916pge.613.2023.02.03.22.10.55; Fri, 03 Feb 2023 22:11:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=emr5gnXb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231148AbjBDFvY (ORCPT + 99 others); Sat, 4 Feb 2023 00:51:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjBDFvX (ORCPT ); Sat, 4 Feb 2023 00:51:23 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B866C29409; Fri, 3 Feb 2023 21:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=WzpIxsrWjep5l9VShHrZUT54iLqm1bC6ykl3lav0knk=; b=emr5gnXb1sREZaf84kRlK6cbBm NyogKclSfv6CdjSd/ifA5lRTwyYZbd0889UyglbItrkilaHJNOiq6AiCPv6RxPK9ie4ks/pYTQtWJ r6NnmDTPmQ9Ud8trc+D/5Im+GyqBGbfTn6L60eDz8Rt+iZqCHOhQU2C4m5tKKsD2YmEje60C03SSk E+fu76mhYuZeL+pyfyT2Yz1dQYNHd5sLNusgaH9GM7Z2VXjwM+9pvLhSCri2dCe4y7iCkxs2uXONw Z32EwqeYdM66qKx1CwGp/CLryo/LLUgknVqbeFQLuSRbThFKHZCxkYE7XubKdELSSoKfDUM4Fkogj frPoNscA==; Received: from [2601:1c2:d00:6a60::9526] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pOBSI-004WUA-PT; Sat, 04 Feb 2023 05:51:18 +0000 From: Randy Dunlap To: linux-kernel@vger.kernel.org Cc: Randy Dunlap , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, Rich Felker , Yoshinori Sato , Arnd Bergmann , Geert Uytterhoeven , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org Subject: [PATCH v2] sh: init: use OF_EARLY_FLATTREE for early init Date: Fri, 3 Feb 2023 21:51:16 -0800 Message-Id: <20230204055116.22591-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756879722510233800?= X-GMAIL-MSGID: =?utf-8?q?1756879722510233800?= When CONFIG_OF_EARLY_FLATTREE and CONFIG_SH_DEVICE_TREE are not set, SH3 build fails with a call to early_init_dt_scan(), so in arch/sh/kernel/setup.c and arch/sh/kernel/head_32.S, use CONFIG_OF_EARLY_FLATTREE instead of CONFIG_OF_FLATTREE. Fixes this build error: ../arch/sh/kernel/setup.c: In function 'sh_fdt_init': ../arch/sh/kernel/setup.c:262:26: error: implicit declaration of function 'early_init_dt_scan' [-Werror=implicit-function-declaration] 262 | if (!dt_virt || !early_init_dt_scan(dt_virt)) { Fixes: 03767daa1387 ("sh: fix build regression with CONFIG_OF && !CONFIG_OF_FLATTREE") Fixes: eb6b6930a70f ("sh: fix memory corruption of unflattened device tree") Signed-off-by: Randy Dunlap Suggested-by: Rob Herring Cc: Frank Rowand Cc: devicetree@vger.kernel.org Cc: Rich Felker Cc: Yoshinori Sato Cc: Arnd Bergmann Cc: Geert Uytterhoeven Cc: John Paul Adrian Glaubitz Cc: linux-sh@vger.kernel.org --- v2: use Suggested-by: for Rob. add more Cc's. arch/sh/kernel/head_32.S | 6 +++--- arch/sh/kernel/setup.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff arch/sh/kernel/setup.c arch/sh/kernel/setup.c diff -- a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -244,7 +244,7 @@ void __init __weak plat_early_device_set { } -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE void __ref sh_fdt_init(phys_addr_t dt_phys) { static int done = 0; @@ -326,7 +326,7 @@ void __init setup_arch(char **cmdline_p) /* Let earlyprintk output early console messages */ sh_early_platform_driver_probe("earlyprintk", 1, 1); -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE #ifdef CONFIG_USE_BUILTIN_DTB unflatten_and_copy_device_tree(); #else diff -- a/arch/sh/kernel/head_32.S b/arch/sh/kernel/head_32.S --- a/arch/sh/kernel/head_32.S +++ b/arch/sh/kernel/head_32.S @@ -64,7 +64,7 @@ ENTRY(_stext) ldc r0, r6_bank #endif -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE mov r4, r12 ! Store device tree blob pointer in r12 #endif @@ -315,7 +315,7 @@ ENTRY(_stext) 10: #endif -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE mov.l 8f, r0 ! Make flat device tree available early. jsr @r0 mov r12, r4 @@ -346,7 +346,7 @@ ENTRY(stack_start) 5: .long start_kernel 6: .long cpu_init 7: .long init_thread_union -#if defined(CONFIG_OF_FLATTREE) +#if defined(CONFIG_OF_EARLY_FLATTREE) 8: .long sh_fdt_init #endif