Received: by 10.192.165.148 with SMTP id m20csp4006431imm; Tue, 8 May 2018 01:00:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpxW6imPVXVT7gGhIdpYg2z4MbD62vcFuQ661bBkwElJoTeJm1TpeuNriIwtGDOpCCklMCO X-Received: by 10.167.133.15 with SMTP id v15mr25209055pfn.144.1525766429501; Tue, 08 May 2018 01:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525766429; cv=none; d=google.com; s=arc-20160816; b=YILDYunNEX4AxAI40SBI+XqAZaQE67bBpYfOUJ6MeasJtJe1LF8b2VDdQsbStwPKOr adu+e+5HtubBmtxzM4WSFyKoZy31AXVYOrYpWpLgE2tRPCvxg6zU4dOTeUNQZka7oH0q ahxL4fGbXcNSqGeHQHNIFu5QNjzsdML5BLlJuQiQVA4uBzuO3ZewIFKEX/dr2Avdya0+ smsXqR+ihB7wqDRjunEx9EqLr4bk11YWwEEgQwXGweQXeybnrWEReRgtgHCw9VyfZMve uizF9AffXPLfObcgE3SLtG76sNsudyOhmFvZBR0HwjfX8zgVKzHSBsbxjn1+a9F7K2mc LQEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:arc-authentication-results; bh=QriWg46DPFNw5k+CwxrcwviWfYW71mWTzfPt2gz+j30=; b=I9XlRrUMQD+t7k95R6JP0APNs4TgzRlPHaPPhAztfv2lkAJSfMF/VhOtWy0Xi7kBqf HAlUmdMClY6pcwDazcmI4N9vIMkNd9gpuLM64UReI9E8w6GiCxmUnuV7JrA3uevwQyk4 gDrs9f310PMWupMweEfaNzIO3D/8jVc4jRCIO2KQkgtkMG0VMY6etxFolP1WPvlb2OMD hPgPYCjJuI57XDvd0iivpSaSLphEGpnR8DlMu3AkdtWf99Ute9UGSplefuAqMdHPB5Ee mD4Ecfv8nnTTFrwJSbFLzfJ2SVwv1PkGxXgmX6Eh8eQlxE8F2pftE8/6N9g3HQLFZIlw KZAw== 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 z3-v6si11831002plb.228.2018.05.08.01.00.15; Tue, 08 May 2018 01:00:29 -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 S1754459AbeEHH7u (ORCPT + 99 others); Tue, 8 May 2018 03:59:50 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:54190 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754413AbeEHH7t (ORCPT ); Tue, 8 May 2018 03:59:49 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 0CB4F28E51; Tue, 8 May 2018 03:59:46 -0400 (EDT) Date: Tue, 8 May 2018 17:59:52 +1000 (AEST) From: Finn Thain To: Geert Uytterhoeven cc: Greg Kroah-Hartman , linux-m68k , Linux Kernel Mailing List Subject: Re: [PATCH] nubus: Unconditionally register bus type In-Reply-To: Message-ID: References: <5aee5ed3.1c69fb81.19d98.ef06SMTPIN_ADDED_MISSING@mx.google.com> <20180506045530.GA5328@kroah.com> <20180506202018.GC8924@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 May 2018, Geert Uytterhoeven wrote: > > This example is the sort of flag removal that I had in mind -- > > > > diff --git a/drivers/base/driver.c b/drivers/base/driver.c > > index ba912558a510..4ee22fb3db92 100644 > > --- a/drivers/base/driver.c > > +++ b/drivers/base/driver.c > > @@ -148,7 +148,8 @@ int driver_register(struct device_driver *drv) > > int ret; > > struct device_driver *other; > > > > - BUG_ON(!drv->bus->p); > > + if (!drv->bus->p) > > + return -ENODEV; > > If this is meant to handle the case where the device driver is registered > before the bus is registered, while the latter can still happen later, > then you want to return -EPROBE_DEFER. > Returning -EAGAIN might be appropriate if driver_register() could reasonably expect the bus to come into existence. However, a separation of concerns would seem to imply that the driver core has no way of knowing whether that might happen. Anyway, this discussion is academic. The patch was only meant to illustrate a way to remove code instead of adding it, while achieving the same goal. I'm not proposing this patch. I don't claim to understand all of the considerations that apply here. I'm certain there are situations where BUG_ON is appropriate. This may be one of those situations. -- > Gr{oetje,eeting}s, > > Geert > >