uevent: use add_uevent_var() instead of open coding it

Make use of add_uevent_var() instead of (often incorrectly) open coding it.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Eric Rannaud <eric.rannaud@gmail.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Eric Rannaud
2007-03-30 22:23:12 -07:00
committed by Greg Kroah-Hartman
parent bdc4960a0b
commit bf62456eb9
6 changed files with 77 additions and 109 deletions

View File

@ -47,14 +47,13 @@ static int amba_match(struct device *dev, struct device_driver *drv)
static int amba_uevent(struct device *dev, char **envp, int nr_env, char *buf, int bufsz)
{
struct amba_device *pcdev = to_amba_device(dev);
int retval = 0, i = 0, len = 0;
if (nr_env < 2)
return -ENOMEM;
snprintf(buf, bufsz, "AMBA_ID=%08x", pcdev->periphid);
*envp++ = buf;
*envp++ = NULL;
return 0;
retval = add_uevent_var(envp, nr_env, &i,
buf, bufsz, &len,
"AMBA_ID=%08x", pcdev->periphid);
envp[i] = NULL;
return retval;
}
#else
#define amba_uevent NULL