public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@steeleye.com>
To: mochel@osdl.org
Cc: linux-kernel@vger.kernel.org, James.Bottomley@SteelEye.com
Subject: [BKPATCH] bus notifiers for the generic device model
Date: Wed, 04 Dec 2002 11:09:21 -0600	[thread overview]
Message-ID: <200212041709.gB4H9LA02808@localhost.localdomain> (raw)

There are certain bus types (notably MCA and parisc internal ones) that like 
to do generic houskeeping operations (claim slots, claim uniform resources 
etc.) when drivers are attached to devices.

I've added a fairly generic notifier callback to the bus_type so that these 
busses can intercept and process the events they're interested in.

At the moment, the only events are attachment and detachment of drivers but in 
principle, more could be added.

James

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


ChangeSet@1.928, 2002-12-04 10:21:28-06:00, jejb@raven.il.steeleye.com
  make bus notify events more general in generic device model

ChangeSet@1.927, 2002-12-03 14:16:53-06:00, jejb@raven.il.steeleye.com
  add device model bus notifier
  
  This adds a bus notifier (per bus type) which is called after a device
  driver successfully attaches to a device.  The idea behind this is
  that there are certain operations that need to be performed globally
  after driver attachment (bus resource claiming etc.).  This notifier
  is set by the bus so that it can do these.


 drivers/base/bus.c     |    4 ++++
 include/linux/device.h |    9 +++++++++
 2 files changed, 13 insertions(+)


diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c	Wed Dec  4 11:05:18 2002
+++ b/drivers/base/bus.c	Wed Dec  4 11:05:18 2002
@@ -145,6 +145,8 @@
 		 dev->bus_id,dev->driver->name);
 	list_add_tail(&dev->driver_list,&dev->driver->devices);
 	sysfs_create_link(&dev->driver->kobj,&dev->kobj,dev->kobj.name);
+	if(dev->bus && dev->bus->notify)
+		dev->bus->notify(dev, BUS_NOTIFIER_DRIVER_ATTACHED);
 }
 
 
@@ -260,6 +262,8 @@
 		if (drv->remove)
 			drv->remove(dev);
 		dev->driver = NULL;
+		if(dev->bus && dev->bus->notify)
+			dev->bus->notify(dev, BUS_NOTIFIER_DRIVER_DETACHED);
 	}
 }
 
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h	Wed Dec  4 11:05:18 2002
+++ b/include/linux/device.h	Wed Dec  4 11:05:18 2002
@@ -58,6 +58,13 @@
 	DEVICE_GONE		= 3,
 };
 
+/* bus notifier events: events that the bus type may choose to be notified
+ * about */
+enum bus_notifier {
+	BUS_NOTIFIER_DRIVER_ATTACHED,
+	BUS_NOTIFIER_DRIVER_DETACHED,
+};
+
 struct device;
 struct device_driver;
 struct device_class;
@@ -75,6 +82,8 @@
 	struct device * (*add)	(struct device * parent, char * bus_id);
 	int		(*hotplug) (struct device *dev, char **envp, 
 				    int num_envp, char *buffer, int buffer_size);
+	/* notify the bus that something happened */
+	void		(*notify)(struct device *dev, enum bus_notifier event);
 };
 
 

===================================================================


This BitKeeper patch contains the following changesets:
1.927..1.928
## Wrapped with gzip_uu ##


begin 664 bkpatch486
M'XL(`,\U[CT``]57:T_C.!3]7/^**XTT`I8\[#S;$8A'F9V*U0YB8#^MA)S$
M;3*3)E7L,E-M]K_O==*4!3I=0"#8-F_;U\?WG'MMOX-+*:I![ZOX&I%W\*F4
M:M"K^+4HS"PWI1(B%PMAQN442\_+$DNMM)P*2S>PCDXMN9!C:41S:12ERL:9
MJ*3!3,_T;((MSKB*4[C&CX,>-9W5%[68B4'O_.37R]\.SPG9VX/CE!<3\44H
MV-LCJJRN>9[(`Z[2O"Q,5?%"3H7B&DB]JEHSVV;X]VC@V)Y?4]]V@SJF":7<
MI2*QF1OZ[HTU#7RC+4I9P)CC>&%MA[;#R!"HV6<!V,RBS+(=H.Z`^@//,6Q_
M8-N@O7"PUEWP"P/#)D?PO&,Y)C'P)(%$7&>Q@&F9B!S0^]!Y'\OQN$@SJ>OA
MY58I;,WPHK]H!K;A>YHA&U@WYGDN$N!CA>5\:1X-)56&[(&<Q[&0<CS/\P5P
MI7B<"K11KJJ:@'T*R!*!'8HT*Q)0&D,FT8A*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overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-04 17:09 James Bottomley [this message]
2002-12-04 17:56 ` [BKPATCH] bus notifiers for the generic device model Greg KH
2002-12-04 18:04   ` James Bottomley
2002-12-04 18:04     ` Patrick Mochel
2002-12-04 18:42       ` Jeff Garzik
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=200212041709.gB4H9LA02808@localhost.localdomain \
    --to=james.bottomley@steeleye.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