Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2057886imm; Thu, 21 Jun 2018 06:39:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLd3SG0XzVVuBWubwgiJO3cTKYdpTTqMA2B95N5DNaId5R6lctkrAUA963H4uglfNKK0dMJ X-Received: by 2002:a17:902:8549:: with SMTP id d9-v6mr13734162plo.81.1529588341927; Thu, 21 Jun 2018 06:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529588341; cv=none; d=google.com; s=arc-20160816; b=SEAoGRzhtRtOqVsCK2ix42PGJCFDIVYTwr6y6R7ocl/vIFyCK4w6bHvxaFKrBRZ28/ SqthhBGp5zZArlDZwEf/Pmf5KqFY90FtRgH6RR5Sjrpy+mNy26ot8QTTuLv1ssQb5JFz GLCswLtzcL0hoqoIBhkQJQFHfc1kYhH2Su6LYOmJzh1OMsN3mPIo9whPSd9F+ZqqGPb3 PYbndh9zm5sJvn+Wx07b2TpWXE8maSQd2NhKyum/eIsc6+QxT3q0yyKoE7jg4pxMcb52 VEBqPLldu/nMwpemsXfBR54ugPy+yFzuUQ6zqUVUlVhf+31spf77fw7aDOCYbTjmlFmm UQnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=xUKS4bOe3/Pf4ROStcR7mwT9eWsWBVYgBdB7KxRxam4=; b=vCdGgo1ncEYI14BOYiuY4w9+DTrofSTWzbMUkIjoQQaLZ9+XATty2XrqYCl4joDBwk EQS3zRDRYxkdUvmzXwbjFy/DB9bfwZD+sh+ZJZ0AUjuF6hen98g96U+H2bkCOKLwabBQ ReEKK8Ooe3rGXOBcl9FzMfZTGrHxlTYBu26BQfzpgoCl4o5UVNaNoQJS/C9Mbe4XucZ3 y1oSQ+UNbyuLrgMZ/3zsnXyJp5srRs3iTLtyh+mUZUy7Vyd3HbZm72yAfiIg7sXOIK3r XSFeL8U6JZstOHPEZ57aI+zka7+WRlK8LpTxIy/GMVlBpMuDrUDffzKPBspo2YLBwizM W0aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=PsSdvkun; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si5005685pfd.128.2018.06.21.06.38.48; Thu, 21 Jun 2018 06:39:01 -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=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=PsSdvkun; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933119AbeFUNhr (ORCPT + 99 others); Thu, 21 Jun 2018 09:37:47 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50652 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932813AbeFUNhp (ORCPT ); Thu, 21 Jun 2018 09:37:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=LM+ebVZ6Wf/drnJd5RVtHeUuiC8NCYZnWP7Xlwy03Fs=; b=PsSdvkunNvyJK2I0HOEWvMVaR PnCfO18LuxtfCwhHrG0fGhF2GrDOaSTu5sQ4muPnIWLJ3NEG1RnndDszfW9D/P+BeEaN1B49gG/qY dNAaU88el4IxR3zEsxVBq9OO7qBXMI4zoKbgcY7LQKDUeRouVEBHaQOIHreCR60Icarp7e9L8pgu7 5Ou7TRKxW2pvoL0PI+syVhgLYUnOtgAW+Fc6jlUaFdpS3QSp868ebONSWW5IkoJNy/nUW+wPQcPfv 97CnQvCeqAFYrSqIXUcyqUwWWky4+H8WuxFGP+EyP53tVHZTncrvuIogRHnykmkeYmezylnv50y0D n6UyD9UWg==; Received: from 213-225-12-120.nat.highway.a1.net ([213.225.12.120] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVzmP-0000bR-Vr; Thu, 21 Jun 2018 13:37:42 +0000 From: Christoph Hellwig To: gregkh@linuxfoundation.org Cc: mark.rutland@arm.com, frowand.list@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, "Wesley W. Terpstra" Subject: [PATCH] base: fix order of OF initialization Date: Thu, 21 Jun 2018 15:37:37 +0200 Message-Id: <20180621133737.14397-1-hch@lst.de> X-Mailer: git-send-email 2.17.1 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Wesley W. Terpstra" This fixes: [ 0.010000] cpu cpu0: Error -2 creating of_node link ... which you get for every CPU on all architectures that use CONFIG_GENERIC_CPU_DEVICES. In that case, driver_init() calls cpu_dev_init() before calling of_core_init(). Then we get the callchain: cpu_dev_init() -> cpu_dev_register_generic() -> register_cpu(cpu, i) -> device_register(&cpu->dev) -> device_add(dev) -> device_add_class_symlinks(dev) ... in device_add_class_symlinks, we we dev->of_node, and call sysfs_create_link(), which fails because we haven't called of_core_init() to register the sysfs devicetree directory yet. Signed-off-by: Wesley W. Terpstra [hch: updated the changelog based on review feedback] Signed-off-by: Christoph Hellwig Acked-by: Mark Rutland Acked-by: Frank Rowand --- In case anyone is wondering why I send out this patch - I'm digging through the RISC-V tree and trying to the patches required to let a RISC-V kernel boot on qemu upstream. I also got the previously missing signoff from Wes offlist. drivers/base/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/init.c b/drivers/base/init.c index dd85b05a6a16..908e6520e804 100644 --- a/drivers/base/init.c +++ b/drivers/base/init.c @@ -30,9 +30,9 @@ void __init driver_init(void) /* These are also core pieces, but must come after the * core core pieces. */ + of_core_init(); platform_bus_init(); cpu_dev_init(); memory_dev_init(); container_dev_init(); - of_core_init(); } -- 2.17.1