Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318295
b: refs/heads/master
c: 43a91d5
h: refs/heads/master
i:
  318293: 9cbe4c3
  318291: 847af32
  318287: 65dae6d
v: v3
  • Loading branch information
Daniel Kurtz authored and Henrik Rydberg committed Jun 29, 2012
1 parent cc675f2 commit e2b3c37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9c67b789e051449d3914d683ba3604c5babc4dd9
refs/heads/master: 43a91d51d3750dd9d5a6e5d14e9250a51f01f3c1
35 changes: 15 additions & 20 deletions trunk/drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,20 +479,6 @@ static int mxt_read_message(struct mxt_data *data,
sizeof(struct mxt_message), message);
}

static int mxt_read_object(struct mxt_data *data,
u8 type, u8 offset, u8 *val)
{
struct mxt_object *object;
u16 reg;

object = mxt_get_object(data, type);
if (!object)
return -EINVAL;

reg = object->start_address;
return __mxt_read_reg(data->client, reg + offset, 1, val);
}

static int mxt_write_object(struct mxt_data *data,
u8 type, u8 offset, u8 val)
{
Expand Down Expand Up @@ -900,7 +886,14 @@ static ssize_t mxt_object_show(struct device *dev,
int i, j;
int error;
u8 val;
u8 *obuf;

/* Pre-allocate buffer large enough to hold max sized object. */
obuf = kmalloc(256, GFP_KERNEL);
if (!obuf)
return -ENOMEM;

error = 0;
for (i = 0; i < data->info.object_num; i++) {
object = data->object_table + i;

Expand All @@ -914,20 +907,22 @@ static ssize_t mxt_object_show(struct device *dev,
continue;
}

error = __mxt_read_reg(data->client, object->start_address,
object->size + 1, obuf);
if (error)
break;

for (j = 0; j < object->size + 1; j++) {
error = mxt_read_object(data,
object->type, j, &val);
if (error)
return error;
val = obuf[j];

count += scnprintf(buf + count, PAGE_SIZE - count,
"\t[%2d]: %02x (%d)\n", j, val, val);
}

count += scnprintf(buf + count, PAGE_SIZE - count, "\n");
}

return count;
kfree(obuf);
return error ?: count;
}

static int mxt_load_fw(struct device *dev, const char *fn)
Expand Down

0 comments on commit e2b3c37

Please sign in to comment.