[Cbe-oss-dev] [PATCH] uevent support for ps3_system_bus

David Woodhouse dwmw2 at infradead.org
Sat Mar 31 05:45:47 EST 2007


To allow userspace to automatically load modules, we need to hook up
uevent for ps3_system_bus devices. I've used the form 'ps3:%d' with the
ps3_match_id, since that's what we use for matching drivers. Is there
any point in adding the bus_id and dev_id too?

Signed-off-by: David Woodhouse <dwmw2 at infradead.org>

--- linux-2.6.20.ppc64/arch/powerpc/platforms/ps3/system-bus.c	2007-03-30 20:14:44.000000000 +0100
+++ linux-2.6.20.ps3/arch/powerpc/platforms/ps3/system-bus.c	2007-03-30 20:27:41.000000000 +0100
@@ -163,11 +163,27 @@ static int ps3_system_bus_remove(struct 
 	return 0;
 }
 
+static int ps3_system_bus_uevent(struct device *_dev, char **envp,
+				 int num_envp, char *buffer, int buffer_size)
+{
+	struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
+	int i=0, length = 0;
+
+	if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
+			   &length, "MODALIAS=ps3:%d",
+			   dev->match_id))
+		return -ENOMEM;
+
+	envp[i] = NULL;
+	return 0;
+}
+
 struct bus_type ps3_system_bus_type = {
 	.name = "ps3_system_bus",
 	.match = ps3_system_bus_match,
 	.probe = ps3_system_bus_probe,
 	.remove = ps3_system_bus_remove,
+	.uevent = ps3_system_bus_uevent,
 };
 
 int __init ps3_system_bus_init(void)

-- 
dwmw2




More information about the cbe-oss-dev mailing list