diff options
author | James Morris <james.l.morris@oracle.com> | 2014-06-24 18:46:07 +1000 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2014-06-24 18:46:07 +1000 |
commit | f01387d2693813eb5271a3448e6a082322c7d75d (patch) | |
tree | b591ca73c85276bae53d7db57ff1565be45a29da /drivers/fmc/fmc-core.c | |
parent | 92953ff38ba59b4f7b1a54ab28b84be35fafaecc (diff) | |
parent | 1860e379875dfe7271c649058aeddffe5afd9d0d (diff) |
Merge commit 'v3.15' into next
Diffstat (limited to 'drivers/fmc/fmc-core.c')
-rw-r--r-- | drivers/fmc/fmc-core.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/fmc/fmc-core.c b/drivers/fmc/fmc-core.c index 24d52497524d..353fc546fb08 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]); |