lkml.org 
[lkml]   [2005]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] openfirmware: adds sysfs nodes for openfirmware devices
From
Date
On Tue, 2005-03-01 at 16:18 -0500, Jeffrey Mahoney wrote:
> This patch adds sysfs nodes that the hotplug userspace can use to load the
> appropriate modules.
>
> In order for hotplug to work with macio devices, patches to module-init-tools
> and hotplug must be applied. Those patches are available at:
>
> ftp://ftp.suse.com/pub/people/jeffm/linux/macio-hotplug/
>
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>

> +static ssize_t
> +compatible_show (struct device *dev, char *buf)
> +{
> + struct of_device *of;
> + char *compat;
> + int cplen;
> + int length = 0;
> +
> + of = &to_macio_device (dev)->ofdev;
> + compat = (char *) get_property(of->node, "compatible", &cplen);
> + if (!compat) {
> + *buf = '\0';
> + return 0;
> + }
> + while (cplen > 0) {
> + int l;
> + length += sprintf (buf, "%s%s", length ? "," : "", compat);
> + buf += length;
> + l = strlen (compat) + 1;
> + compat += l;
> + cplen -= l;
> + }
> +
> + return length;
> +}
> +

There is a problem here. "," is a valid character within a "compatible"
property, and is actually regulary used. Normally, "compatible" is a
list, with '\0' beeing the separator. I suggest using CRLF instead.

Ben.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.096 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site