diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-01 23:13:21 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-01 23:13:21 (GMT) |
commit | 675c354a95d5375153b8bb80a0448cab916c7991 (patch) | |
tree | 88cbc5a5a31dd1c1016271006a8d56cfe0abf7bd /drivers/fmc | |
parent | c70929147a10fa4538886cb23b934b509c4c0e49 (diff) | |
parent | 1b3fa22e0234d613df967445cd34807e10fa54fa (diff) | |
download | linux-675c354a95d5375153b8bb80a0448cab916c7991.tar.xz |
Merge tag 'char-misc-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver patches from Greg KH:
"Here's the big char/misc driver updates for 3.15-rc1.
Lots of various things here, including the new mcb driver subsystem.
All of these have been in linux-next for a while"
* tag 'char-misc-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (118 commits)
extcon: Move OF helper function to extcon core and change function name
extcon: of: Remove unnecessary function call by using the name of device_node
extcon: gpio: Use SIMPLE_DEV_PM_OPS macro
extcon: palmas: Use SIMPLE_DEV_PM_OPS macro
mei: don't use deprecated DEFINE_PCI_DEVICE_TABLE macro
mei: amthif: fix checkpatch error
mei: client.h fix checkpatch errors
mei: use cl_dbg where appropriate
mei: fix Unnecessary space after function pointer name
mei: report consistently copy_from/to_user failures
mei: drop pr_fmt macros
mei: make me hw headers private to me hw.
mei: fix memory leak of pending write cb objects
mei: me: do not reset when less than expected data is received
drivers: mcb: Fix build error discovered by 0-day bot
cs5535-mfgpt: Simplify dependencies
spmi: pm: drop bus-level PM suspend/resume routines
spmi: pmic_arb: make selectable on ARCH_QCOM
Drivers: hv: vmbus: Increase the limit on the number of pfns we can handle
pch_phub: Report error writing MAC back to user
...
Diffstat (limited to 'drivers/fmc')
-rw-r--r-- | drivers/fmc/fmc-core.c | 22 | ||||
-rw-r--r-- | drivers/fmc/fmc-sdb.c | 41 |
2 files changed, 47 insertions, 16 deletions
diff --git a/drivers/fmc/fmc-core.c b/drivers/fmc/fmc-core.c index 24d5249..353fc54 100644 --- a/drivers/fmc/fmc-core.c +++ b/drivers/fmc/fmc-core.c @@ -99,10 +99,23 @@ static ssize_t fmc_read_eeprom(struct file *file, struct kobject *kobj, return count; } +static ssize_t fmc_write_eeprom(struct file *file, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct device *dev; + struct fmc_device *fmc; + + dev = container_of(kobj, struct device, kobj); + fmc = container_of(dev, struct fmc_device, dev); + return fmc->op->write_ee(fmc, off, buf, count); +} + static struct bin_attribute fmc_eeprom_attr = { - .attr = { .name = "eeprom", .mode = S_IRUGO, }, + .attr = { .name = "eeprom", .mode = S_IRUGO | S_IWUSR, }, .size = 8192, /* more or less standard */ .read = fmc_read_eeprom, + .write = fmc_write_eeprom, }; /* @@ -154,7 +167,7 @@ int fmc_device_register_n(struct fmc_device **devs, int n) ret = -EINVAL; break; } - if (fmc->flags == FMC_DEVICE_NO_MEZZANINE) { + if (fmc->flags & FMC_DEVICE_NO_MEZZANINE) { dev_info(fmc->hwdev, "absent mezzanine in slot %d\n", fmc->slot_id); continue; @@ -189,9 +202,6 @@ int fmc_device_register_n(struct fmc_device **devs, int n) for (i = 0; i < n; i++) { fmc = devarray[i]; - if (fmc->flags == FMC_DEVICE_NO_MEZZANINE) - continue; /* dev_info already done above */ - fmc->nr_slots = n; /* each slot must know how many are there */ fmc->devarray = devarray; @@ -263,8 +273,6 @@ void fmc_device_unregister_n(struct fmc_device **devs, int n) kfree(devs[0]->devarray); for (i = 0; i < n; i++) { - if (devs[i]->flags == FMC_DEVICE_NO_MEZZANINE) - continue; sysfs_remove_bin_file(&devs[i]->dev.kobj, &fmc_eeprom_attr); device_del(&devs[i]->dev); fmc_free_id_info(devs[i]); diff --git a/drivers/fmc/fmc-sdb.c b/drivers/fmc/fmc-sdb.c index 79adc39..4603fdb 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"); |