]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/scan.c
Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
[linux-2.6-omap-h63xx.git] / drivers / acpi / scan.c
index be74347d135435e5c5b4508b8144528bc58a0459..5b4d462117cf915c6e1f2a89d7604ec9ddaa712b 100644 (file)
@@ -35,8 +35,9 @@ struct acpi_device_bus_id{
  * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get:
  * char *modalias: "acpi:IBM0001:ACPI0001"
 */
-int create_modalias(struct acpi_device *acpi_dev, char *modalias, int size){
-
+static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
+                          int size)
+{
        int len;
 
        if (!acpi_dev->flags.hardware_id)
@@ -318,16 +319,18 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv)
        return !acpi_match_device_ids(acpi_dev, acpi_drv->ids);
 }
 
-static int acpi_device_uevent(struct device *dev, char **envp, int num_envp,
-                             char *buffer, int buffer_size)
+static int acpi_device_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
        struct acpi_device *acpi_dev = to_acpi_device(dev);
+       int len;
 
-       strcpy(buffer, "MODALIAS=");
-       if (create_modalias(acpi_dev, buffer + 9, buffer_size - 9) > 0) {
-               envp[0] = buffer;
-               envp[1] = NULL;
-       }
+       if (add_uevent_var(env, "MODALIAS="))
+               return -ENOMEM;
+       len = create_modalias(acpi_dev, &env->buf[env->buflen - 1],
+                             sizeof(env->buf) - env->buflen);
+       if (len >= (sizeof(env->buf) - env->buflen))
+               return -ENOMEM;
+       env->buflen += len;
        return 0;
 }