From ee80880eb11a52e82e12c616d2b3c106657388ec Mon Sep 17 00:00:00 2001 From: Jens Taprogge Date: Tue, 4 Sep 2012 17:01:21 +0200 Subject: [PATCH] --- yaml --- r: 324803 b: refs/heads/master c: 5d72c848d2a3b4af7f8f32d89af02a486d321bd6 h: refs/heads/master i: 324801: 5a93a95a9d2df706a7f691f7d23c6456d5864b1e 324799: d3a6042e450bf385cc56bc86e6e93a9a72fe6e92 v: v3 --- [refs] | 2 +- trunk/drivers/staging/ipack/ipack.c | 31 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d7b10d2f4b50..e8be480c3eff 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 35eb97bb67e7581ba1372ffc8c28770ca0568404 +refs/heads/master: 5d72c848d2a3b4af7f8f32d89af02a486d321bd6 diff --git a/trunk/drivers/staging/ipack/ipack.c b/trunk/drivers/staging/ipack/ipack.c index a5ef28f82f7a..ff907facc005 100644 --- a/trunk/drivers/staging/ipack/ipack.c +++ b/trunk/drivers/staging/ipack/ipack.c @@ -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) { @@ -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),