Merge branch 'dock' into release
authorLen Brown <len.brown@intel.com>
Wed, 16 Dec 2009 08:33:28 +0000 (03:33 -0500)
committerLen Brown <len.brown@intel.com>
Wed, 16 Dec 2009 08:33:28 +0000 (03:33 -0500)
Conflicts:
drivers/acpi/dock.c

Signed-off-by: Len Brown <len.brown@intel.com>
1  2 
drivers/acpi/dock.c

index 30be3c148f7eadd29f7ab67338d3953054b9f323,d4c3d82bef3fc438a57e77116ba342ba8fd62d8e..bbc2c1315c473ca7c7e8ff3770506ba645f16f0f
@@@ -986,62 -962,18 +962,19 @@@ static int dock_add(acpi_handle handle
        if (is_battery(handle))
                dock_station->flags |= DOCK_IS_BAT;
  
-       ret = device_create_file(&dock_device->dev, &dev_attr_docked);
-       if (ret) {
-               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
-               platform_device_unregister(dock_device);
-               kfree(dock_station);
-               dock_station = NULL;
-               return ret;
-       }
-       ret = device_create_file(&dock_device->dev, &dev_attr_undock);
-       if (ret) {
-               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
-               device_remove_file(&dock_device->dev, &dev_attr_docked);
-               platform_device_unregister(dock_device);
-               kfree(dock_station);
-               dock_station = NULL;
-               return ret;
-       }
-       ret = device_create_file(&dock_device->dev, &dev_attr_uid);
-       if (ret) {
-               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
-               device_remove_file(&dock_device->dev, &dev_attr_docked);
-               device_remove_file(&dock_device->dev, &dev_attr_undock);
-               platform_device_unregister(dock_device);
-               kfree(dock_station);
-               dock_station = NULL;
-               return ret;
-       }
-       ret = device_create_file(&dock_device->dev, &dev_attr_flags);
-       if (ret) {
-               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
-               device_remove_file(&dock_device->dev, &dev_attr_docked);
-               device_remove_file(&dock_device->dev, &dev_attr_undock);
-               device_remove_file(&dock_device->dev, &dev_attr_uid);
-               platform_device_unregister(dock_device);
-               kfree(dock_station);
-               dock_station = NULL;
-               return ret;
-       }
-       ret = device_create_file(&dock_device->dev, &dev_attr_type);
+       ret = sysfs_create_group(&dd->dev.kobj, &dock_attribute_group);
        if (ret)
-               printk(KERN_ERR"Error %d adding sysfs file\n", ret);
+               goto err_unregister;
  
        /* Find dependent devices */
 -      acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
 -                          find_dock_devices, dock_station, NULL);
 +      acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
 +                          ACPI_UINT32_MAX, find_dock_devices, NULL,
 +                          dock_station, NULL);
  
        /* add the dock station as a device dependent on itself */
-       dd = alloc_dock_dependent_device(handle);
-       if (!dd) {
-               kfree(dock_station);
-               dock_station = NULL;
-               ret = -ENOMEM;
-               goto dock_add_err_unregister;
-       }
-       add_dock_dependent_device(dock_station, dd);
+       ret = add_dock_dependent_device(dock_station, handle);
+       if (ret)
+               goto err_rmgroup;
  
        dock_station_count++;
        list_add(&dock_station->sibling, &dock_stations);