Received: by 10.192.165.148 with SMTP id m20csp1756414imm; Sat, 5 May 2018 21:56:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoCuJJGjwJpbJLoCRQB4xd0y+GhExQ0/KooFLBMO7YWenQ+QkMOGNFIeZLbhXrzp90lMMB8 X-Received: by 2002:a63:7c14:: with SMTP id x20-v6mr27011145pgc.161.1525582577925; Sat, 05 May 2018 21:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525582577; cv=none; d=google.com; s=arc-20160816; b=gT6eaiBYEZFFzqjBHGeRj9GTOkIWnDV/FgpHU2CmJv2t2X/srfTEf3rzkhOfq2+d08 HL4U/WuElEvZEHVCyDxfP6iTySqLgA9ubIpBW1YBRyFTgB7sPNucY61I4tuhiL6oHFSx b1JQ82xSFuAX5k4c1ujB/Tuk1kEZi9E6YuKKEfbPoRhD+ZJ7dncctxdY0+UDvHBccZuS eLAFE4zSLDHkgY4zEVOcNAkwbPsmRpdgNV2P8YccBse67y0FmPued3WFxoXfADW9dyBV lA+BSF1ZnrejJmN47Mni4LUWVjkCY5aAinSHBAPG1YBw5lnitkoN1FjOv8ITYZmJf6ax +Hcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=WjMSJWVy8tJsDALHoonqoGs0ys7ig9yGnPzBtG6U/Zo=; b=X8EEFZQiVBr/Zc1W6BxQH02MxbmtSYc/kERhRpOUkNsD7lbHgct1zfo6/Ljau6Gju3 KW7bjmsu+Ok5NdbtoMp5ypN3MLPbAFFPjOTTEDEzemweaP3XQWX8AYNMUwIDeOJsaF3K qgkJZJboAyYvTFUAvDW6vm7+8inT3/jU9OEz8/n0rqwJF8N1gbi2WMhe2oEy3eAUEWWc uHNnGDdizKJkPoh+2t2iAIDQOch4XxFCZEX/Z4r4e4HLmaZsjgdiuU+ieC/PotOShMF1 6LIc5C5zEV0M3BVrBzGz8PeTpoQmFDqxB8PN8/n25BCIt5L2p2HjV6rv2Vn+czD287Zx wq4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PUuU0X0H; 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 p15-v6si15553973pgq.478.2018.05.05.21.56.03; Sat, 05 May 2018 21:56:17 -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=@kernel.org header.s=default header.b=PUuU0X0H; 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 S1751572AbeEFEzn (ORCPT + 99 others); Sun, 6 May 2018 00:55:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:55606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750885AbeEFEzm (ORCPT ); Sun, 6 May 2018 00:55:42 -0400 Received: from localhost (unknown [70.96.146.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE49921783; Sun, 6 May 2018 04:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525582542; bh=uSt7+c1FMDgbmere19+VZLs5vdm5t6GGN1BNcucne0k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PUuU0X0HsI9A6XNA5685Eih9Hz4IOiXalpDZ9sOMq3JRfGm+IwV36nl6bpX0ZkMqi +ReceqbU01gxFApQzqWfqmsKRFGDSTmhEO9ZA52bA8n3P7sk4p7Sl8e+XLkdN69Lh0 Z1QaGXGg2xftDdO+6htqiS+yaNo5qu43shSUxeD8= Date: Sat, 5 May 2018 21:55:30 -0700 From: Greg Kroah-Hartman To: Finn Thain Cc: Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nubus: Unconditionally register bus type Message-ID: <20180506045530.GA5328@kroah.com> References: <5aee5ed3.1c69fb81.19d98.ef06SMTPIN_ADDED_MISSING@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5aee5ed3.1c69fb81.19d98.ef06SMTPIN_ADDED_MISSING@mx.google.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 06, 2018 at 11:47:52AM +1000, 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); Why not just have an "bus is registered" flag in your driver register function that refuses to let drivers register with the driver core if it isn't set? And then fix your linking error, the bus should come first in link order, before your drivers :) thanks, greg k-h