[PATCH 13/14] powerpc: add ps3 platform system bus support

Olaf Hering olaf at aepfle.de
Tue May 1 01:58:23 EST 2007


On Mon, Apr 30, Geoff Levand wrote:

> > The generated modalias files do not match anything.
>  
> Module support is still todo.  I am just now started on it.  David
> Woodhouse sent a few patches, but I just merged them in without
> testing.

This is my version, compile tested.

ps3fb calls into ps3av.
ps3av can be a module, but it does not force ps3fb to be a module as
well. Maybe this can be enforced via some Kconfig tweaks.

---
 arch/powerpc/platforms/ps3/system-bus.c |   30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -167,6 +167,30 @@ static int ps3_system_bus_remove(struct 
 	return 0;
 }
 
+static const char *ps3_system_bus_modalias(enum ps3_match_id match_id)
+{
+	const char *p;
+	switch (match_id) {
+		case PS3_MATCH_ID_EHCI:
+			p = "ps3-ehci";
+			break;
+		case PS3_MATCH_ID_OHCI:
+			p = "ps3-ohci";
+			break;
+		case PS3_MATCH_ID_GELIC:
+			p = "gelic_net";
+			break;
+		case PS3_MATCH_ID_AV_SETTINGS:
+			p = "ps3av";
+			break;
+		case PS3_MATCH_ID_SYSTEM_MANAGER:
+		default:
+			p = "unknown";
+			break;
+	}
+	return p;
+}
+
 static int ps3_system_bus_uevent(struct device *_dev, char **envp,
 				 int num_envp, char *buffer, int buffer_size)
 {
@@ -174,8 +198,8 @@ static int ps3_system_bus_uevent(struct 
 	int i=0, length = 0;
 
 	if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
-			   &length, "MODALIAS=ps3:%d",
-			   dev->match_id))
+			   &length, "MODALIAS=%s",
+			   ps3_system_bus_modalias(dev->match_id)))
 		return -ENOMEM;
 
 	envp[i] = NULL;
@@ -186,7 +210,7 @@ static ssize_t modalias_show(struct devi
 			     char *buf)
 {
 	struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
-        int len = snprintf(buf, PAGE_SIZE, "ps3:%d\n", dev->match_id);
+        int len = snprintf(buf, PAGE_SIZE, "%s\n", ps3_system_bus_modalias(dev->match_id));
 
         return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }



More information about the Linuxppc-dev mailing list