From bf62456eb91f3d2ef0736081583d09b0b3c8b7ea Mon Sep 17 00:00:00 2001 From: Eric Rannaud Date: Fri, 30 Mar 2007 22:23:12 -0700 Subject: 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 Signed-off-by: Eric Rannaud Cc: Kay Sievers Cc: Cornelia Huck Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/amba/bus.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'drivers/amba') diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index fd5475071acc..268e301775fc 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -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 -- cgit v1.2.3