diff options
author | Alex Dubov <oakad@yahoo.com> | 2008-03-10 14:43:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-03-10 21:01:18 -0400 |
commit | 251cc9b9df065cb2c170ea45f566c0d9456186c2 (patch) | |
tree | a78aa48f730faaeef8cf8fb5dcde27c75ac49e6f /drivers/memstick/core | |
parent | efb2742e5ddd03197fcf066e2d2a75d36cf04fd1 (diff) |
memstick: fix parsing of "assembly_date" attribute field
Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/memstick/core')
-rw-r--r-- | drivers/memstick/core/mspro_block.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 2381c5d7275b..62b913ba9b97 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -303,6 +303,20 @@ static ssize_t mspro_block_attr_show_sysinfo(struct device *dev, | |||
303 | dev_attr); | 303 | dev_attr); |
304 | struct mspro_sys_info *x_sys = x_attr->data; | 304 | struct mspro_sys_info *x_sys = x_attr->data; |
305 | ssize_t rc = 0; | 305 | ssize_t rc = 0; |
306 | int date_tz = 0, date_tz_f = 0; | ||
307 | |||
308 | if (x_sys->assembly_date[0] > 0x80U) { | ||
309 | date_tz = (~x_sys->assembly_date[0]) + 1; | ||
310 | date_tz_f = date_tz & 3; | ||
311 | date_tz >>= 2; | ||
312 | date_tz = -date_tz; | ||
313 | date_tz_f *= 15; | ||
314 | } else if (x_sys->assembly_date[0] < 0x80U) { | ||
315 | date_tz = x_sys->assembly_date[0]; | ||
316 | date_tz_f = date_tz & 3; | ||
317 | date_tz >>= 2; | ||
318 | date_tz_f *= 15; | ||
319 | } | ||
306 | 320 | ||
307 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "class: %x\n", | 321 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "class: %x\n", |
308 | x_sys->class); | 322 | x_sys->class); |
@@ -315,8 +329,8 @@ static ssize_t mspro_block_attr_show_sysinfo(struct device *dev, | |||
315 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "page size: %x\n", | 329 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "page size: %x\n", |
316 | be16_to_cpu(x_sys->page_size)); | 330 | be16_to_cpu(x_sys->page_size)); |
317 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly date: " | 331 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly date: " |
318 | "%d %04u-%02u-%02u %02u:%02u:%02u\n", | 332 | "GMT%+d:%d %04u-%02u-%02u %02u:%02u:%02u\n", |
319 | x_sys->assembly_date[0], | 333 | date_tz, date_tz_f, |
320 | be16_to_cpu(*(unsigned short *) | 334 | be16_to_cpu(*(unsigned short *) |
321 | &x_sys->assembly_date[1]), | 335 | &x_sys->assembly_date[1]), |
322 | x_sys->assembly_date[3], x_sys->assembly_date[4], | 336 | x_sys->assembly_date[3], x_sys->assembly_date[4], |