diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-05-14 16:49:19 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-05-14 16:49:19 -0700 |
commit | 879f99ef2c4c05d9a7f0a67a05f1415663119825 (patch) | |
tree | 0399664761f675eef741f8b08b92635069586151 /drivers/fmc/fmc-sdb.c | |
parent | 70a26071f8552a0f193cf442f424decfe0f2e569 (diff) | |
parent | d6d211db37e75de2ddc3a4f979038c40df7cc79c (diff) |
Merge tag 'v3.15-rc5' into next
Merge with Linux 3.15-rc5 to sync up Wacom and other changes.
Diffstat (limited to 'drivers/fmc/fmc-sdb.c')
-rw-r--r-- | drivers/fmc/fmc-sdb.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/drivers/fmc/fmc-sdb.c b/drivers/fmc/fmc-sdb.c index 79adc39221e..4603fdb7446 100644 --- a/drivers/fmc/fmc-sdb.c +++ b/drivers/fmc/fmc-sdb.c @@ -150,23 +150,36 @@ int fmc_reprogram(struct fmc_device *fmc, struct fmc_driver *d, char *gw, } EXPORT_SYMBOL(fmc_reprogram); +static char *__strip_trailing_space(char *buf, char *str, int len) +{ + int i = len - 1; + + memcpy(buf, str, len); + while(i >= 0 && buf[i] == ' ') + buf[i--] = '\0'; + return buf; +} + +#define __sdb_string(buf, field) ({ \ + BUILD_BUG_ON(sizeof(buf) < sizeof(field)); \ + __strip_trailing_space(buf, (void *)(field), sizeof(field)); \ + }) + static void __fmc_show_sdb_tree(const struct fmc_device *fmc, const struct sdb_array *arr) { + unsigned long base = arr->baseaddr; int i, j, n = arr->len, level = arr->level; - const struct sdb_array *ap; + char buf[64]; for (i = 0; i < n; i++) { - unsigned long base; union sdb_record *r; struct sdb_product *p; struct sdb_component *c; r = &arr->record[i]; c = &r->dev.sdb_component; p = &c->product; - base = 0; - for (ap = arr; ap; ap = ap->parent) - base += ap->baseaddr; + dev_info(&fmc->dev, "SDB: "); for (j = 0; j < level; j++) @@ -193,8 +206,8 @@ static void __fmc_show_sdb_tree(const struct fmc_device *fmc, p->name, __be64_to_cpu(c->addr_first) + base); if (IS_ERR(arr->subtree[i])) { - printk(KERN_CONT "(bridge error %li)\n", - PTR_ERR(arr->subtree[i])); + dev_info(&fmc->dev, "SDB: (bridge error %li)\n", + PTR_ERR(arr->subtree[i])); break; } __fmc_show_sdb_tree(fmc, arr->subtree[i]); @@ -203,10 +216,20 @@ static void __fmc_show_sdb_tree(const struct fmc_device *fmc, printk(KERN_CONT "integration\n"); break; case sdb_type_repo_url: - printk(KERN_CONT "repo-url\n"); + printk(KERN_CONT "Synthesis repository: %s\n", + __sdb_string(buf, r->repo_url.repo_url)); break; case sdb_type_synthesis: - printk(KERN_CONT "synthesis-info\n"); + printk(KERN_CONT "Bitstream '%s' ", + __sdb_string(buf, r->synthesis.syn_name)); + printk(KERN_CONT "synthesized %08x by %s ", + __be32_to_cpu(r->synthesis.date), + __sdb_string(buf, r->synthesis.user_name)); + printk(KERN_CONT "(%s version %x), ", + __sdb_string(buf, r->synthesis.tool_name), + __be32_to_cpu(r->synthesis.tool_version)); + printk(KERN_CONT "commit %pm\n", + r->synthesis.commit_id); break; case sdb_type_empty: printk(KERN_CONT "empty\n"); |