Received: by 10.192.165.148 with SMTP id m20csp3167994imm; Mon, 7 May 2018 07:47:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoEcBlV1y0ZCBYJvczEc5gwB8qo8P9V+fz2MIbKUoyZhIIH9aVK3C3zfoi7c8K89tx3nnZl X-Received: by 2002:aca:851:: with SMTP id 78-v6mr17605047oii.61.1525704446952; Mon, 07 May 2018 07:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525704446; cv=none; d=google.com; s=arc-20160816; b=hBJhCk1qnSmO3e79uKbYCbSjjwdPRNHLq40JCsn0LcNjmMLgT3Gro43QYtLj+SftqD ywtP0WCoE1ZRwCEx4pg6Ac0ncG/9eLkjky7SeV+gvEYkNaH5TwTFVdeGVUKUfFxlOZe+ dzp6bZCfbqYSkDhDOCyh5ftWPS7ZGrna94FsJzFp95bHpqEJ6UFZlJyKYtjaFrTgHXTu dHrUI8vxlEOO7K3yoXcxbpMwxtzVvQ7BjGebY2ROISa1LlifHQRu0B3mDuz45TATDWCb X26uqNvatxjYTn/w8gBK75suaVmOrfgzNxw5VF64kG09uwHBfCbbuktkEy9JeK4J0AET vT2Q== 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=te8vnwQJhwZTzIY8wkXRX7S2c0psuurI/HpkxIU7Tg0=; b=TEnqCFzDYATtUpTZJq6f4UhUnRCEVQGzczjNyBOOeVtpQQiMiRhXTSmKgEHWLXz9VI f1hr4tzw2vZYQkskD+yyMlU9ohB00fmJxWCEDzRWWruByWX6VN+4D9t3HQGvN7l9i1Qb XEGdFFRd8sSQxS4B2NRuhQkagdTA5rcjIEZn7GaEVU0n1ZJ99ARWCNb20lhmReR86rwn 2qNqZgITDn2XYOS2B5aB6/Te6YXRunT7Ygx2jcpO+YUYwY6eIlwCRpV2Y47wv/RHwNt6 V5IMOmdWka+jwgyOvfxPjyQl0NHM39QAKl46CG777lVPZJIC1ycCER34JkeVwL5tm3gL n3zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xk6WjxSG; 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 l21-v6si7501860oig.314.2018.05.07.07.47.13; Mon, 07 May 2018 07:47:26 -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=xk6WjxSG; 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 S1752602AbeEGOp3 (ORCPT + 99 others); Mon, 7 May 2018 10:45:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:45908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752085AbeEGOp1 (ORCPT ); Mon, 7 May 2018 10:45:27 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 D6BBF214D5; Mon, 7 May 2018 14:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525704326; bh=7PVzGTHqhBL0bJtCAW4SoG9ht5yMNTstbzKDq91YcPk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xk6WjxSGVbm+N8QkpmkA08KMnePc9uhiA8XhVqdZKL3gWDSbDs87lFRe5mg0cnmSX K6CliaG2IbxTbg6I/qYhPSlGsgI2LCwsPIbxCMOkhAEQbNuCJ3uUZxad4JXisZg1ai zNrGUkpdqo2/6l7FS0joUEGw1j1sTjSN6Zg4Mpmk= Date: Mon, 7 May 2018 16:45:11 +0200 From: Greg Kroah-Hartman To: Geert Uytterhoeven Cc: Finn Thain , linux-m68k , Linux Kernel Mailing List Subject: Re: [PATCH] nubus: Unconditionally register bus type Message-ID: <20180507144511.GA22694@kroah.com> 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 Content-Disposition: inline In-Reply-To: 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 Mon, May 07, 2018 at 02:53:13PM +0200, Geert Uytterhoeven wrote: > Hi Finn, > > (responding immediately to patches doing non-kosher things ;-) > > On Mon, May 7, 2018 at 1:57 AM, Finn Thain wrote: > > On Sun, 6 May 2018, Greg Kroah-Hartman wrote: > >> > > 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? > >> > > >> > Perhaps that should happen in the core driver_register() function. > >> > BUG_ON is frowned upon, after all. Would that be acceptable? > >> > >> I don't understand what you mean here, perhaps make a patch to show it? > >> > > > > As an alternative to your suggestion (add flag to avoid the BUG_ON): > > > > --- a/drivers/base/driver.c > > +++ b/drivers/base/driver.c > > @@ -148,7 +148,10 @@ int driver_register(struct device_driver *drv) > > int ret; > > struct device_driver *other; > > > > - BUG_ON(!drv->bus->p); > > + if (!drv->bus->p) { > > + WARN_ONCE(1, "Cannot register driver with invalid bus\n"); > > + return -EPROBE_DEFER; > > + } > > > > if ((drv->bus->probe && drv->probe) || > > (drv->bus->remove && drv->remove) || > > > > I'm not actually proposing this change; just responding to your question. > > The bus_type.p field may be unused by some bus drivers, hence this > would prevent their drivers from being registered. bus_type.p is an internal-to-the-driver-core structure, no bus driver should ever be touching it. This is a catch to see if someone is using the driver core incorrectly. thanks, greg k-h