public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Patrick Mochel <mochel@osdl.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>,
	Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [BKPATCH] bus notifiers for the generic device model
Date: Wed, 04 Dec 2002 13:42:12 -0500	[thread overview]
Message-ID: <3DEE4C84.9000507@pobox.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0212041156080.924-100000@localhost.localdomain>

Patrick Mochel wrote:
> ===== drivers/base/bus.c 1.26 vs edited =====
> --- 1.26/drivers/base/bus.c	Sun Dec  1 23:22:04 2002
> +++ edited/drivers/base/bus.c	Wed Dec  4 12:02:41 2002
> @@ -228,6 +228,10 @@
>  {
>  	pr_debug("bound device '%s' to driver '%s'\n",
>  		 dev->bus_id,dev->driver->name);
> +
> +	if (dev->driver->start)
> +		dev->driver->start(dev);
> +
>  	list_add_tail(&dev->driver_list,&dev->driver->devices);
>  	sysfs_create_link(&dev->driver->kobj,&dev->kobj,dev->kobj.name);
>  }
> 
> I don't recall why the change was never done. Perhaps because of other 
> distractions, or it seemed like it would be too much of a PITA to convert 
> drivers to a two-step init sequence (though I think it could be done in a 
> compatible manner).


Possibly because of the "do it in open(2)" rule?

Ignoring the device model entirely, if a driver does a lot of 
talking-to-the-hardware in its probe phase, I consider it buggy, in 2.4 
or 2.5.

The network driver and chardev ones typically follow this rule quite 
well... probe is simple, just registering interfaces with the kernel. 
dev->open is where the driver should (and usually does) power-up the 
hardware, [re-]initialize it, etc.

So each time you come upon a driver that wants dev->driver->start(), 
look closely at the code and wonder why it can't perform the 
dev->driver->start() code in its interface's dev->open member.

	Jeff



  reply	other threads:[~2002-12-04 18:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-04 17:09 [BKPATCH] bus notifiers for the generic device model James Bottomley
2002-12-04 17:56 ` Greg KH
2002-12-04 18:04   ` James Bottomley
2002-12-04 18:04     ` Patrick Mochel
2002-12-04 18:42       ` Jeff Garzik [this message]
2002-12-05  3:33         ` Patrick Mochel
2002-12-04 18:13     ` Greg KH
2002-12-04 19:35       ` James Bottomley
2002-12-04 22:29         ` Greg KH
2002-12-05  3:50           ` Patrick Mochel
2002-12-05 16:14             ` James Bottomley
2002-12-05 16:57               ` Jeff Garzik
2002-12-06 19:10               ` Patrick Mochel
2002-12-04 18:10   ` Mike Anderson
2002-12-04 18:52     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DEE4C84.9000507@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox