]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Move of_device_get_modalias to drivers/of
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 16 May 2008 01:57:45 +0000 (11:57 +1000)
committerPaul Mackerras <paulus@samba.org>
Fri, 16 May 2008 13:22:28 +0000 (23:22 +1000)
Commit 140b932f8cb6cced10b96860651a198b1b89cbb9 ("Create modalias file
in sysfs for of_platform bus") needs this to avoid breaking the sparc
builds.

Just move the code and add whitespace around some binary operators.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/of_device.c
drivers/of/device.c
include/asm-powerpc/of_device.h
include/linux/of_device.h

index 5748ddb47d9f82fc332b844e56613d3a6e84a07b..e9be908f199b6fa46ee4ec2226316db2ad1702c6 100644 (file)
@@ -89,54 +89,6 @@ struct of_device *of_device_alloc(struct device_node *np,
 }
 EXPORT_SYMBOL(of_device_alloc);
 
-ssize_t of_device_get_modalias(struct of_device *ofdev,
-                               char *str, ssize_t len)
-{
-       const char *compat;
-       int cplen, i;
-       ssize_t tsize, csize, repend;
-
-       /* Name & Type */
-       csize = snprintf(str, len, "of:N%sT%s",
-                               ofdev->node->name, ofdev->node->type);
-
-       /* Get compatible property if any */
-       compat = of_get_property(ofdev->node, "compatible", &cplen);
-       if (!compat)
-               return csize;
-
-       /* Find true end (we tolerate multiple \0 at the end */
-       for (i=(cplen-1); i>=0 && !compat[i]; i--)
-               cplen--;
-       if (!cplen)
-               return csize;
-       cplen++;
-
-       /* Check space (need cplen+1 chars including final \0) */
-       tsize = csize + cplen;
-       repend = tsize;
-
-       if (csize>=len)         /* @ the limit, all is already filled */
-               return tsize;
-
-       if (tsize>=len) {               /* limit compat list */
-               cplen = len-csize-1;
-               repend = len;
-       }
-
-       /* Copy and do char replacement */
-       memcpy(&str[csize+1], compat, cplen);
-       for (i=csize; i<repend; i++) {
-               char c = str[i];
-               if (c=='\0')
-                       str[i] = 'C';
-               else if (c==' ')
-                       str[i] = '_';
-       }
-
-       return tsize;
-}
-
 int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
        struct of_device *ofdev;
index 8fbfeee53c1e30841e9558c61fb04202bbf1688b..8a1d93a2bb815c380bb18710369912834c2d2f06 100644 (file)
@@ -104,3 +104,51 @@ void of_device_unregister(struct of_device *ofdev)
        device_unregister(&ofdev->dev);
 }
 EXPORT_SYMBOL(of_device_unregister);
+
+ssize_t of_device_get_modalias(struct of_device *ofdev,
+                               char *str, ssize_t len)
+{
+       const char *compat;
+       int cplen, i;
+       ssize_t tsize, csize, repend;
+
+       /* Name & Type */
+       csize = snprintf(str, len, "of:N%sT%s",
+                               ofdev->node->name, ofdev->node->type);
+
+       /* Get compatible property if any */
+       compat = of_get_property(ofdev->node, "compatible", &cplen);
+       if (!compat)
+               return csize;
+
+       /* Find true end (we tolerate multiple \0 at the end */
+       for (i = (cplen - 1); i >= 0 && !compat[i]; i--)
+               cplen--;
+       if (!cplen)
+               return csize;
+       cplen++;
+
+       /* Check space (need cplen+1 chars including final \0) */
+       tsize = csize + cplen;
+       repend = tsize;
+
+       if (csize >= len)               /* @ the limit, all is already filled */
+               return tsize;
+
+       if (tsize >= len) {             /* limit compat list */
+               cplen = len - csize - 1;
+               repend = len;
+       }
+
+       /* Copy and do char replacement */
+       memcpy(&str[csize + 1], compat, cplen);
+       for (i = csize; i < repend; i++) {
+               char c = str[i];
+               if (c == '\0')
+                       str[i] = 'C';
+               else if (c == ' ')
+                       str[i] = '_';
+       }
+
+       return tsize;
+}
index 6526e139a4636783959ee2820c078881c57b33c8..3c123990ca2e0f3db95b03c939e62a6e6050df30 100644 (file)
@@ -21,8 +21,6 @@ extern struct of_device *of_device_alloc(struct device_node *np,
                                         const char *bus_id,
                                         struct device *parent);
 
-extern ssize_t of_device_get_modalias(struct of_device *ofdev,
-                                       char *str, ssize_t len);
 extern int of_device_uevent(struct device *dev,
                            struct kobj_uevent_env *env);
 
index afe338217d91cc0b3e0166c0d9511970f4401871..d3a74e00a3e13455b7ad7f6eec81d58727e40386 100644 (file)
@@ -24,4 +24,7 @@ static inline void of_device_free(struct of_device *dev)
        of_release_dev(&dev->dev);
 }
 
+extern ssize_t of_device_get_modalias(struct of_device *ofdev,
+                                       char *str, ssize_t len);
+
 #endif /* _LINUX_OF_DEVICE_H */