Received: by 10.192.165.148 with SMTP id m20csp1664372imm; Sat, 5 May 2018 18:49:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpXVuxSDFWJYfVQhJDezx7WcT53eCQVn00uWOHZ8/LuzaYogHoO9rrdA08AqQOEna7V9znm X-Received: by 10.98.210.134 with SMTP id c128mr32244326pfg.240.1525571371582; Sat, 05 May 2018 18:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525571371; cv=none; d=google.com; s=arc-20160816; b=bi5YBCfyG/e6VcAitesvCwhKzDK7GcMYRYjPywRBQOLkbHov4Z9dfJm3o893lEMvQY cRCW7Vrr3eyjptZGtCuaIhoXQ4JEHYZFBolMuGVaIj9r8mJ2fmiCLlLkN5fmuuYBQniG 6iKM7loVKbc1o1JQowMowIBj7D+ct+aGMYesZe4/0ZqvPKlSE+3sJEscN2cYtOhkebjG 2r3dsmlbhtxJ0HZYgzhD3VpvnzJUX7bNBlhfjeaKeiiEwROmSrLYlG0dtgs0tvhcE54g yx0D+WhEx40D1wdhN04/KzFl2lf22c7m7MflipqqDoAZP2WOOAdPUYcJmqeY3J4nhPTR jSYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:list-id:precedence:sender:subject:from:cc:to:date :arc-authentication-results; bh=WeSWOiqEqr67GwqutDFrI/fvhPidIwHAQjnS9BNZSWI=; b=G9mw7cKrLQa/4/piKxp3wtd10jllptkuLrPKNINIm3m784QJIKa7/Gx5Mu/AZFHTiz wRlBowBGbAVm4sW0k3luK7yycqYkA8bDZLerep0PYAChqSg25eC25uLJ3lQ0HFzmiycL IFc+sLsDmtoCMDCdRl67yy6Uscbt2xJYn1bMsFzNbxrYir4tdtgoD8mdx1u7C597SA79 QOAsGz5T1ZUAogOW2XlT4tqhHlPMD2hnOLjU51LaoY/nB86pu7Gn0spDAxaWsfClw1aA tRWI28z4N9BIlSAptcsbrJkOe+H9iIvuf1iE8pAXOCOrGEWNltggxgiS1NwfZsKGDvu6 eSWA== ARC-Authentication-Results: i=1; mx.google.com; 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 3-v6si19140253plv.323.2018.05.05.18.48.45; Sat, 05 May 2018 18:49:31 -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; 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 S1751923AbeEFBsG (ORCPT + 99 others); Sat, 5 May 2018 21:48:06 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:47586 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751791AbeEFBsD (ORCPT ); Sat, 5 May 2018 21:48:03 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 53AB722877; Sat, 5 May 2018 21:47:50 -0400 (EDT) Date: Sun, 06 May 2018 11:47:52 +1000 To: Geert Uytterhoeven Cc: Greg Kroah-Hartman , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org From: Finn Thain Subject: [PATCH] nubus: Unconditionally register bus type Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Message-Id: 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); 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; nubus_scan_bus(); return 0; } diff --git a/include/linux/nubus.h b/include/linux/nubus.h index 6e8200215321..f01e7f4bcff8 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h @@ -163,7 +163,6 @@ void nubus_seq_write_rsrc_mem(struct seq_file *m, unsigned char *nubus_dirptr(const struct nubus_dirent *nd); /* Declarations relating to driver model objects */ -int nubus_bus_register(void); int nubus_device_register(struct nubus_board *board); int nubus_driver_register(struct nubus_driver *ndrv); void nubus_driver_unregister(struct nubus_driver *ndrv); -- 2.16.1