diff options
author | Eric Rannaud <eric.rannaud@gmail.com> | 2007-03-31 01:23:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-27 13:57:29 -0400 |
commit | bf62456eb91f3d2ef0736081583d09b0b3c8b7ea (patch) | |
tree | 851c2559ae11835e19763b7c7c54393f0ae0d5f6 /drivers/ieee1394 | |
parent | bdc4960a0b4831a24276b65f1f7afdfc57f2f5cf (diff) |
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>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/nodemgr.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index c5ace190bfe6..1644e6fd2c89 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -1163,6 +1163,7 @@ static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, | |||
1163 | struct unit_directory *ud; | 1163 | struct unit_directory *ud; |
1164 | int i = 0; | 1164 | int i = 0; |
1165 | int length = 0; | 1165 | int length = 0; |
1166 | int retval = 0; | ||
1166 | /* ieee1394:venNmoNspNverN */ | 1167 | /* ieee1394:venNmoNspNverN */ |
1167 | char buf[8 + 1 + 3 + 8 + 2 + 8 + 2 + 8 + 3 + 8 + 1]; | 1168 | char buf[8 + 1 + 3 + 8 + 2 + 8 + 2 + 8 + 3 + 8 + 1]; |
1168 | 1169 | ||
@@ -1176,14 +1177,11 @@ static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, | |||
1176 | 1177 | ||
1177 | #define PUT_ENVP(fmt,val) \ | 1178 | #define PUT_ENVP(fmt,val) \ |
1178 | do { \ | 1179 | do { \ |
1179 | int printed; \ | 1180 | retval = add_uevent_var(envp, num_envp, &i, \ |
1180 | envp[i++] = buffer; \ | 1181 | buffer, buffer_size, &length, \ |
1181 | printed = snprintf(buffer, buffer_size - length, \ | 1182 | fmt, val); \ |
1182 | fmt, val); \ | 1183 | if (retval) \ |
1183 | if ((buffer_size - (length+printed) <= 0) || (i >= num_envp)) \ | 1184 | return retval; \ |
1184 | return -ENOMEM; \ | ||
1185 | length += printed+1; \ | ||
1186 | buffer += printed+1; \ | ||
1187 | } while (0) | 1185 | } while (0) |
1188 | 1186 | ||
1189 | PUT_ENVP("VENDOR_ID=%06x", ud->vendor_id); | 1187 | PUT_ENVP("VENDOR_ID=%06x", ud->vendor_id); |