Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324803
b: refs/heads/master
c: 5d72c84
h: refs/heads/master
i:
  324801: 5a93a95
  324799: d3a6042
v: v3
  • Loading branch information
Jens Taprogge authored and Greg Kroah-Hartman committed Sep 4, 2012
1 parent 89a2cfa commit ee80880
Show file tree
Hide file tree
Showing 2 changed files with 32 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: 35eb97bb67e7581ba1372ffc8c28770ca0568404
refs/heads/master: 5d72c848d2a3b4af7f8f32d89af02a486d321bd6
31 changes: 31 additions & 0 deletions trunk/drivers/staging/ipack/ipack.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,36 @@ field##_show(struct device *dev, struct device_attribute *attr, \
return sprintf(buf, format_string, idev->field); \
}

static ssize_t id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
unsigned int i, c, l, s;
struct ipack_device *idev = to_ipack_dev(dev);


switch (idev->id_format) {
case IPACK_ID_VERSION_1:
l = 0x7; s = 1; break;
case IPACK_ID_VERSION_2:
l = 0xf; s = 2; break;
default:
return -EIO;
}
c = 0;
for (i = 0; i < idev->id_avail; i++) {
if (i > 0) {
if ((i & l) == 0)
buf[c++] = '\n';
else if ((i & s) == 0)
buf[c++] = ' ';
}
sprintf(&buf[c], "%02x", idev->id[i]);
c += 2;
}
buf[c++] = '\n';
return c;
}

static ssize_t
id_vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -160,6 +190,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
ipack_device_attr(id_format, "0x%hhu\n");

static struct device_attribute ipack_dev_attrs[] = {
__ATTR_RO(id),
__ATTR_RO(id_device),
__ATTR_RO(id_format),
__ATTR_RO(id_vendor),
Expand Down

0 comments on commit ee80880

Please sign in to comment.