Received: by 10.192.165.148 with SMTP id m20csp3992059imm; Tue, 8 May 2018 00:39:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqmDeLxB7z/PtYb3qV02EsSPBA/KEMgY5zGWnOG/YXoipjnf0d1UoFx9+KINDTcer8bXgK5 X-Received: by 2002:a17:902:74c9:: with SMTP id f9-v6mr41108613plt.385.1525765194179; Tue, 08 May 2018 00:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525765194; cv=none; d=google.com; s=arc-20160816; b=PhxMOLZRN2geWIhg9EsQnYLeYZ1CuI/mdbMjeJ6PG63/z1+OFuiYpcdQtisR+fThXZ u5c+N1VyzNWLSBTYd/bW7SRFKmsp5ofPQ4IDQGqRR4HQOfZ1OuPfrhqIj9Na2aHt5816 vwaAO++nmgTpt6jemhz47znoi21IWxI1dxHDJj249D38Ftq+yqLi3ewrAYqMizxgg4Gt re0BTbihAHR1xKkvRLew7thK3Y21C8bTcTEUn+5JHDRGZgsNeEepSKHTCzPedJV5AMSf iFINhm4+ZHrU+3ncc5DYV3IWoTQ6Ea6XbhtQaz9WZXl1/gwcR6KFM0bdIALIpdgszmwb 3Odg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=bv7+DC1aViuyw3GPQZ/EsRb9rQNS+iDtCTSf6+poOC8=; b=KGusDdHvWCaS896i0tIEc1IoqsobRpzRDA0WXt0FCpxTt0VQX6OQ8sgyL5ub+MzSkS k0INKw98TwL/ebPcOUjQluqOiHzygjuKu2U686aSmGAU9KTnbRfFih9ykzZizMAX+U8U RE0VxObhNd52wpLRpBdGGRoybfTenjO+bat3nKaBYkTOgRtoqS04kgdvEJevbWPZSjQG KDLrkW6KIryROteVwLT/X9z4XsEYWAlwqRXV4+FGYuOo7kyK0VoNCN2Gk9+X2EH9jgo2 l3LkPf4a+S1c4od0QXobSxj94r3Car06M3fx65A2Ymq4xIevtau9UUO6P2cV0I38Dihc fKCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=NAtoHmdl; 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 e11-v6si12814840pgu.274.2018.05.08.00.39.38; Tue, 08 May 2018 00:39: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=fail header.i=@gmail.com header.s=20161025 header.b=NAtoHmdl; 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 S1754779AbeEHHjZ (ORCPT + 99 others); Tue, 8 May 2018 03:39:25 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:42870 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754743AbeEHHjV (ORCPT ); Tue, 8 May 2018 03:39:21 -0400 Received: by mail-ua0-f196.google.com with SMTP id f3so20074677uan.9 for ; Tue, 08 May 2018 00:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=bv7+DC1aViuyw3GPQZ/EsRb9rQNS+iDtCTSf6+poOC8=; b=NAtoHmdlOqlaBlbq7qxsDP7DwNOxkS05o0udyFm24DlHpusjfG7qmISrM7i4nCT5zI idv4xtM7GdPf+nNHeSSCE0cbyLQhnwPFm8ROwj8NoFaV1i+KcqChx8nOTSn0Nin6fh1A HhucipWuTiYTExMEm6QQ71oTKIZad4QYB+bx/MCT3mxeXl2RnvrbAb2L2tda+zFqy9vF oE9W+D7GcLQSyGuZEHw0daAKLczE3zuMlH28q2T9jPAz7J5G4jMy0qtaZLv3uZJLZc2+ XcjUXnuPnJ2YrIUXHjzYIlL8DLS0gux1LYlFAxCjK6tQk4MHTuN0PXfZNHOaXl3Bu73k dYHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=bv7+DC1aViuyw3GPQZ/EsRb9rQNS+iDtCTSf6+poOC8=; b=lVQEIhnWSa8OAqRfXDJwnB851NEOmehnA10y6MxktBwlBVIirCcdPQ6Nuiz+fbw6N5 QVFUbcSqLWYR0GMDuRA+64xK/58YzA61WxSZgbCHwIJTizi52pWsggE2XkaiIaQc1vTT qdhHOtJKSGrTB2Wj0lttQ5j1PZYWDLn0vKIvzPrrXwZl2Y2+GY8VHQwqw7roytG/FybB tRm7A8ArKon9vhLm19NSfcUqVj43eqYr6Ir8ua6DQwhTH8reXjPWLJ+X7l6mYcTLqtcF plCfg92LxHlUlTFXEoBguf0grxAAG8c4n0bdPr/CFDBxptxJY7S9JfX/IFuulCSUAGQg zGkQ== X-Gm-Message-State: ALQs6tCStzzzKlyoQaD5IvBCyFrERElQ6J7X/5K51lig2wFtoKuDkOxZ nJtkg5ixC5l8emKx5/Rcrl5QznAxz9lXV9OnXdE= X-Received: by 10.176.36.147 with SMTP id i19mr34109101uan.180.1525765160827; Tue, 08 May 2018 00:39:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.122.10 with HTTP; Tue, 8 May 2018 00:39:20 -0700 (PDT) In-Reply-To: <5aee5ede.1c69fb81.353b4.5021SMTPIN_ADDED_MISSING@mx.google.com> References: <5aee5ede.1c69fb81.353b4.5021SMTPIN_ADDED_MISSING@mx.google.com> From: Geert Uytterhoeven Date: Tue, 8 May 2018 09:39:20 +0200 X-Google-Sender-Auth: 6bC3FzKkL3LfDPL9MP0g4FlTP-E Message-ID: Subject: Re: [PATCH] nubus: Unconditionally register bus type To: Finn Thain Cc: Greg Kroah-Hartman , linux-m68k , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Finn, On Sun, May 6, 2018 at 3:47 AM, Finn Thain wrote: > Loading a NuBus driver module on a non-NuBus machine triggers the > BUG_ON(!drv->bus->p) in driver_register() because the bus does not get > registered unless MACH_IS_MAC(). Avoid this by registering the bus > unconditionally using postcore_initcall(). > > Cc: Greg Kroah-Hartman > Reported-by: Michael Schmitz > Tested-by: Stan Johnson > Fixes: 7f86c765a6a2 ("nubus: Add support for the driver model") > Signed-off-by: Finn Thain > --- > drivers/nubus/bus.c | 3 ++- > drivers/nubus/nubus.c | 5 ----- > include/linux/nubus.h | 1 - > 3 files changed, 2 insertions(+), 7 deletions(-) > > diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c > index d306c348c857..27ca9f1a281b 100644 > --- a/drivers/nubus/bus.c > +++ b/drivers/nubus/bus.c > @@ -63,7 +63,7 @@ static struct device nubus_parent = { > .init_name = "nubus", > }; > > -int __init nubus_bus_register(void) > +static int __init nubus_bus_register(void) > { > int err; > > @@ -78,6 +78,7 @@ int __init nubus_bus_register(void) > device_unregister(&nubus_parent); > return err; > } > +postcore_initcall(nubus_bus_register); nubus_bus_register() two things: 1. Register the NuBus parent device, which represents the bus host, 2. Register the NuBus bus, which represents the bus type. I think this should be split in two, and only the latter should be done regardless of the presence of NuBus host hardware, to fix the crash. > > static void nubus_device_release(struct device *dev) > { > diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c > index 4621ff98138c..f6bab483f4cb 100644 > --- a/drivers/nubus/nubus.c > +++ b/drivers/nubus/nubus.c > @@ -869,15 +869,10 @@ static void __init nubus_scan_bus(void) > > static int __init nubus_init(void) > { > - int err; > - > if (!MACH_IS_MAC) > return 0; > > nubus_proc_init(); > - err = nubus_bus_register(); > - if (err) > - return err; Hence you should still register the NuBus parent device here. > nubus_scan_bus(); > return 0; > } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds