From: Paul Mackerras Date: Mon, 30 Apr 2007 02:38:01 +0000 (+1000) Subject: Merge branch 'linux-2.6' into for-2.6.22 X-Git-Tag: MMI-PSA29.97-13-9~44252^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=49e1900d4cc2e7bcecb681fe60f0990bec2dcce8;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git Merge branch 'linux-2.6' into for-2.6.22 --- 49e1900d4cc2e7bcecb681fe60f0990bec2dcce8 diff --cc sound/aoa/soundbus/core.c index 6f004f70e308,418a98a10c73..8b2e9b905cda --- a/sound/aoa/soundbus/core.c +++ b/sound/aoa/soundbus/core.c @@@ -61,10 -61,9 +61,9 @@@ static int soundbus_uevent(struct devic { struct soundbus_dev * soundbus_dev; struct of_device * of; - char *scratch; - char *compat; + const char *compat; - int i = 0; - int length, cplen, seen = 0; + int retval = 0, i = 0, length = 0; + int cplen, seen = 0; if (!dev) return -ENODEV; @@@ -96,37 -91,27 +91,27 @@@ * it's not really legal to split it out with commas. We split it * up using a number of environment variables instead. */ - compat = (char *) get_property(of->node, "compatible", &cplen); + compat = of_get_property(of->node, "compatible", &cplen); while (compat && cplen > 0) { - envp[i++] = scratch; - length = scnprintf (scratch, buffer_size, - "OF_COMPATIBLE_%d=%s", seen, compat); - ++length; - buffer_size -= length; - if ((buffer_size <= 0) || (i >= num_envp)) - return -ENOMEM; - scratch += length; - length = strlen (compat) + 1; - compat += length; - cplen -= length; - seen++; + int tmp = length; + retval = add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "OF_COMPATIBLE_%d=%s", seen, compat); + if (retval) + return retval; + compat += length - tmp; + cplen -= length - tmp; + seen += 1; } - envp[i++] = scratch; - length = scnprintf (scratch, buffer_size, "OF_COMPATIBLE_N=%d", seen); - ++length; - buffer_size -= length; - if ((buffer_size <= 0) || (i >= num_envp)) - return -ENOMEM; - scratch += length; - - envp[i++] = scratch; - length = scnprintf (scratch, buffer_size, "MODALIAS=%s", - soundbus_dev->modalias); - - buffer_size -= length; - if ((buffer_size <= 0) || (i >= num_envp)) - return -ENOMEM; + retval = add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "OF_COMPATIBLE_N=%d", seen); + if (retval) + return retval; + retval = add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "MODALIAS=%s", soundbus_dev->modalias); envp[i] = NULL;