aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto
diff options
context:
space:
mode:
authorEric Rannaud <eric.rannaud@gmail.com>2007-03-31 01:23:12 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 13:57:29 -0400
commitbf62456eb91f3d2ef0736081583d09b0b3c8b7ea (patch)
tree851c2559ae11835e19763b7c7c54393f0ae0d5f6 /drivers/s390/crypto
parentbdc4960a0b4831a24276b65f1f7afdfc57f2f5cf (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/s390/crypto')
-rw-r--r--drivers/s390/crypto/ap_bus.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index bf37cdf43fae..5aac0ec36368 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -423,27 +423,25 @@ static int ap_uevent (struct device *dev, char **envp, int num_envp,
423 char *buffer, int buffer_size) 423 char *buffer, int buffer_size)
424{ 424{
425 struct ap_device *ap_dev = to_ap_dev(dev); 425 struct ap_device *ap_dev = to_ap_dev(dev);
426 int length; 426 int retval = 0, length = 0, i = 0;
427 427
428 if (!ap_dev) 428 if (!ap_dev)
429 return -ENODEV; 429 return -ENODEV;
430 430
431 /* Set up DEV_TYPE environment variable. */ 431 /* Set up DEV_TYPE environment variable. */
432 envp[0] = buffer; 432 retval = add_uevent_var(envp, num_envp, &i,
433 length = scnprintf(buffer, buffer_size, "DEV_TYPE=%04X", 433 buffer, buffer_size, &length,
434 ap_dev->device_type); 434 "DEV_TYPE=%04X", ap_dev->device_type);
435 if (buffer_size - length <= 0) 435 if (retval)
436 return -ENOMEM; 436 return retval;
437 buffer += length; 437
438 buffer_size -= length;
439 /* Add MODALIAS= */ 438 /* Add MODALIAS= */
440 envp[1] = buffer; 439 retval = add_uevent_var(envp, num_envp, &i,
441 length = scnprintf(buffer, buffer_size, "MODALIAS=ap:t%02X", 440 buffer, buffer_size, &length,
442 ap_dev->device_type); 441 "MODALIAS=ap:t%02X", ap_dev->device_type);
443 if (buffer_size - length <= 0) 442
444 return -ENOMEM; 443 envp[i] = NULL;
445 envp[2] = NULL; 444 return retval;
446 return 0;
447} 445}
448 446
449static struct bus_type ap_bus_type = { 447static struct bus_type ap_bus_type = {