From owner-freebsd-current@freebsd.org Tue Apr 19 15:42:50 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C31A4B143DA for ; Tue, 19 Apr 2016 15:42:50 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F4AC1C1F; Tue, 19 Apr 2016 15:42:50 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: by mail-io0-x236.google.com with SMTP id u185so22738955iod.3; Tue, 19 Apr 2016 08:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=+DYwLR23g26P37YfvBYNKRU1TqAXVF0yRtfzte8MOD4=; b=FeagdeWrNRDcKstrQ79ZtNlWgGE9bt6Gs3+yIoilPeY8/gxk2srbCCo4niBBnxEK0M qspFVw9netWneKW0rLaHLsPlA6Y8V6iSFUo2cwHasCMWSPEkVSqkbA5aD8gO3kQf1Ycu jxOmKShOPMfRCsGMcnl5GKC0ihDtSyA6JOzEdkNlFcUh3xwxcehseFdGE3osuFH9DU5I /szwCjfck4Cg5gCblgN6SmkvSMGQPaHIcQCb6Uy7y8z3NQfEEsLGOehzeLD0QfXNZz6Z Rc/tN0MKKssUposbg++Pbw04JqQQNvIJQLQN3UR+hYxt/qpA5OQ224l+hL/zHIR0FaKi H3dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=+DYwLR23g26P37YfvBYNKRU1TqAXVF0yRtfzte8MOD4=; b=fc5rIFoWEGTePDItlLRxq2/3L1sQ2MrQCq+TZKfhC3Df9BuUHAVBvv7T/C69Gd8BYL Eh9I9x0a1MwRbSa9T6oDUo0sh2TQA2qWFTawig0G3uo8h/rLy1PrL/OgojOwWG8aYwtS A1uTysBQUny6IrAUaNpakx9agdLApPkUKQrz0c6w5gutCtL48+EryoktSPffCmTmJuNA mHODXUHsrF0IwTJvMgrXlWGRQpG6kpUUu+mKYu+FL+/Y2tq+J7PZDUk8CobAI7Pmv2lz RD3DfWhoJiBCVX0czyozlvhYoiydwMh6IFa/VuhctBJ6XrrEpoQrk1WxRCJ0GWFNDSBg poYA== X-Gm-Message-State: AOPr4FVzVfANSfkiPs4Xhug1RzbrMgPGtMYAVIydOa63DJFvgeYSJ36fXkJBx/T+joWSmbKMgteoEd5lqxX6LA== X-Received: by 10.107.136.69 with SMTP id k66mr5170829iod.0.1461080569949; Tue, 19 Apr 2016 08:42:49 -0700 (PDT) MIME-Version: 1.0 References: <1611132.EbTME86UTe@ralph.baldwin.cx> In-Reply-To: <1611132.EbTME86UTe@ralph.baldwin.cx> From: Howard Su Date: Tue, 19 Apr 2016 15:42:40 +0000 Message-ID: Subject: Re: Mis-use of BUS_PASS_ORDER_MIDDLE To: John Baldwin , freebsd-current@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 15:42:50 -0000 On Tue, Apr 19, 2016 at 2:53 AM John Baldwin wrote: > On Monday, April 18, 2016 11:10:12 PM Howard Su wrote: > > I noticed several places there are code like this, especially in some a= rm > > low level drivers. > > EARLY_DRIVER_MODULE(aw_ccu, simplebus, aw_ccu_driver, aw_ccu_devclass, > > 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); > > > > =E2=80=8BI feel the usage of BUS_PASS_ORDER_MIDDLE is misused. There ar= e another > > macro EARLY_DRIVER_MODULE_ORDERED, which take an additional parameter > > "order". I believe BUS_PASS_ORDER_xxx is used for that parameter. > > No, this is actually correct. The _ORDERED variants actually accept a > SI_ORDER_* value to determine how drivers contained in a single .ko file > are registered (in particular if you have several drivers in a .ko file > you typically want the "top-most" driver to attach last so that all the > other drivers are ready once the actual device is attached). > Why not use _ORDERED here to achieve same thing? _ORDERED(...., SI_ORDER_LAST, BUS_PASS_BUS)? I am thinking to add some macro like BUS_DRIVER_MODULE, INT_DRIVER_MODULE, TIMER_DRIVER_MODULE, so that the driver can declare itself in such way. If we can avoid usage of BUS_PASS_ORDER_XXX, the macro is much cleaner. I am plan to do is: in autoconf phase, first load timer, int and some bus, etc low level drivers first, then set cold=3D0, then load other driver to work around the problem that driver needs special handling on cold which is not necessary. of course, this may depends on your change of ap_startup. thoughts? > -- > John Baldwin > --=20 -Howard