Received: by 10.192.165.148 with SMTP id m20csp3938061imm; Mon, 7 May 2018 23:29:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrgKrMr5zFDsKKLpk3vascHa/wSvPtUHcJI/JFQAjbkxVv/5jGCm94PRbWK/iNbh59V+FI7 X-Received: by 2002:a17:902:9a90:: with SMTP id w16-v6mr40166393plp.390.1525760969526; Mon, 07 May 2018 23:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525760969; cv=none; d=google.com; s=arc-20160816; b=n7NaN8ObgTbCDgXGcTunqAg0sJHVgtDmWGjhWP5F9Lg4afX6CzoHBRXIK/iiXisffs 1oGy/V1JlARmqPg5tptuvZ3B4ytSvy+xI2cCM5IPK9yUa39XWLh0/kgUL6o1aL+3P9BU JVRQNmhNQmazpF/JpVZZHlBjLuuvhAkqLVI+0hm9A40JORXsx5CzhqM7fTaaWw5CeJrv 4zGqi93nPPaxjuEwc9V6tleUBIcrI52WLqZXgxtXPfDHjoRMax7GeaqiPvvusj0Z3z7z gSXRbQ/paK/E1mjG2d+u5w9Qi2ldFzphacpCYNIhqUXYr7mFbuQFUtZQONtbuhYdB0KK DVzQ== 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=TaJiNpZ4n2Bw4LZCYU4pHKSya4UNpJJVNTR0XEgwqmc=; b=RThQ9JPIZxeIpSYcH+meHz6L9bm8nSgko5R4qmFI6LlLa+14Hvgc3d12rFi5IQQJ7M DBkuQvz6bMBJaQDGpWHNdJUBv9BNJ4yYTBhDRi70+zWWg7sn79bU0ozLKkx7gMf7Zc5+ 4khG35EZkwgcaYMtjYM5PQkTQXqD7jnZDnRhXnM/6Kb9ds83s3+SdKRzeJuxGLOGdyS4 Xx14IAOUfG7ymmreopRo/VBB3PA5gEDiMahQMruNIrhbZlz46Mx8nMLcDEJM1DIO19Vn 9D4rC+kS7+lTdYxx64jiCJZ2G9Xvuat/vUW3M4jE7fxSbhKLY/XxvjWCt9NjHTNF2+vS mO/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=AC27Ed2r; 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 m37-v6si23466341pla.346.2018.05.07.23.29.03; Mon, 07 May 2018 23:29: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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=AC27Ed2r; 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 S1754081AbeEHG2k (ORCPT + 99 others); Tue, 8 May 2018 02:28:40 -0400 Received: from mail-ua0-f193.google.com ([209.85.217.193]:33395 "EHLO mail-ua0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752214AbeEHG2i (ORCPT ); Tue, 8 May 2018 02:28:38 -0400 Received: by mail-ua0-f193.google.com with SMTP id i2so19999962uah.0 for ; Mon, 07 May 2018 23:28:38 -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=TaJiNpZ4n2Bw4LZCYU4pHKSya4UNpJJVNTR0XEgwqmc=; b=AC27Ed2rJFWpal3/y5QY1g0efjlzvSvvwLELCi5BgNA2S0UtBiGBvTo3jaKTxnICrJ hxmILRpEmCr4b1uQ8NPQ3SljmXP8VHB/g/qOVSjDd4x9wfkiJ+zOqhDFgBTR/praaXKH AuR45CI9bCOIkTBqsiwi2VjDMX2rBZA7/L0JNZluoSevJ9inC25aJiQozV7Y+x0T7y1L 2onOGQuKedFsKAIA/sgWL2TLK3KszHBbpFLAG2NoZh9OKJmzx02NCAodaCNJF6X+HSFL UI7A+OgUf+Thrngg0tOtBSXZqC5m2ruv9wQzEh+iHmYaCEwb2SCHvcsFOgbPSnugGyy2 cEnQ== 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=TaJiNpZ4n2Bw4LZCYU4pHKSya4UNpJJVNTR0XEgwqmc=; b=hYi1Un/D7K8SF4uUWkEUpWuBDHcya1nu1BTCVVttuwpQZsyKkq7/tBzW0WzPWcpDB0 eBbsKX/Y//3PZmJQnQ2+iQv679P8sD0f1BVSpN+q0ETMGlyOeJFbfn7D9vBNJpwzTPX9 VIPPIjJ7QtD1XhZVcbkZTvnKRExFKlnp4NNRLwbconDowzk/buyX421oPC/3xsaVpNOs 5KBIqFMzxqLN5RbESISwPGZW9w+gNnFgCLRrWNJ7OwdjC4S+ssCK+PHrPw99x57NsZf5 HlxfMW6nFfPSjdZSUA/ng5gPlQgmFwRQW3zkISJ/Y95xFQJFDCse/0QwJs2a9b3PcuoM RMEQ== X-Gm-Message-State: ALQs6tAjiZmuQNGyESjWjg/n6K7wAZWmD+oqQuEy4CqXcvQUaNbvd6Yh O5YwyzUhZPqtwzaulGBf7kwukS9ztImp06hB/us= X-Received: by 10.176.26.146 with SMTP id j18mr30205411uai.4.1525760917638; Mon, 07 May 2018 23:28:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.122.10 with HTTP; Mon, 7 May 2018 23:28:37 -0700 (PDT) In-Reply-To: <20180507144511.GA22694@kroah.com> References: <5aee5ed3.1c69fb81.19d98.ef06SMTPIN_ADDED_MISSING@mx.google.com> <20180506045530.GA5328@kroah.com> <20180506202018.GC8924@kroah.com> <20180507144511.GA22694@kroah.com> From: Geert Uytterhoeven Date: Tue, 8 May 2018 08:28:37 +0200 X-Google-Sender-Auth: o49Z92gWKvOh2W1hJjfo1_l75ic Message-ID: Subject: Re: [PATCH] nubus: Unconditionally register bus type To: Greg Kroah-Hartman Cc: Finn Thain , 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 Greg, On Mon, May 7, 2018 at 4:45 PM, Greg Kroah-Hartman wrote: > On Mon, May 07, 2018 at 02:53:13PM +0200, Geert Uytterhoeven wrote: >> 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, I stand corrected. 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