Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117348
b: refs/heads/master
c: 8652b00
h: refs/heads/master
v: v3
  • Loading branch information
Shaohua Li authored and Len Brown committed Sep 24, 2008
1 parent 8dc9760 commit 29f115c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61b836958371c717d1e6d4fea1d2c512969ad20b
refs/heads/master: 8652b00fd6416773f113dab3dfa0d4509def825b
25 changes: 25 additions & 0 deletions trunk/drivers/acpi/dock.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,26 @@ static ssize_t show_dock_uid(struct device *dev,
}
static DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL);

static ssize_t show_dock_type(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct dock_station *dock_station = *((struct dock_station **)
dev->platform_data);
char *type;

if (dock_station->flags & DOCK_IS_DOCK)
type = "dock_station";
else if (dock_station->flags & DOCK_IS_ATA)
type = "ata_bay";
else if (dock_station->flags & DOCK_IS_BAT)
type = "battery_bay";
else
type = "unknown";

return snprintf(buf, PAGE_SIZE, "%s\n", type);
}
static DEVICE_ATTR(type, S_IRUGO, show_dock_type, NULL);

/**
* dock_add - add a new dock station
* @handle: the dock station handle
Expand Down Expand Up @@ -999,6 +1019,9 @@ static int dock_add(acpi_handle handle)
dock_station = NULL;
return ret;
}
ret = device_create_file(&dock_device->dev, &dev_attr_type);
if (ret)
printk(KERN_ERR"Error %d adding sysfs file\n", ret);

/* Find dependent devices */
acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
Expand All @@ -1020,6 +1043,7 @@ static int dock_add(acpi_handle handle)
return 0;

dock_add_err_unregister:
device_remove_file(&dock_device->dev, &dev_attr_type);
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);
Expand Down Expand Up @@ -1047,6 +1071,7 @@ static int dock_remove(struct dock_station *dock_station)
kfree(dd);

/* cleanup sysfs */
device_remove_file(&dock_device->dev, &dev_attr_type);
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);
Expand Down

0 comments on commit 29f115c

Please sign in to comment.