Commit a923be64 authored by Alessandro Rubini's avatar Alessandro Rubini

kernel: add fmc_reprogram() helper function

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 23544aea
......@@ -124,6 +124,30 @@ int fmc_free_sdb_tree(struct fmc_device *fmc)
}
EXPORT_SYMBOL(fmc_free_sdb_tree);
/* This helper calls reprogram and inizialized sdb as well */
int fmc_reprogram(struct fmc_device *fmc, struct fmc_driver *d, char *gw,
int sdb_entry)
{
int ret;
ret = fmc->op->reprogram(fmc, d, gw);
if (ret < 0)
return ret;
if (sdb_entry < 0)
return ret;
/* We are required to find SDB at a given offset */
ret = fmc_scan_sdb_tree(fmc, sdb_entry);
if (ret < 0) {
dev_err(fmc->hwdev, "Can't find SDB at address 0x%x\n",
sdb_entry);
return -ENODEV;
}
fmc_dump_sdb(fmc);
return 0;
}
EXPORT_SYMBOL(fmc_reprogram);
static void __fmc_show_sdb_tree(struct fmc_device *fmc, struct sdb_array *arr)
{
int i, j, n = arr->len, level = arr->level;
......
......@@ -142,6 +142,10 @@ struct fmc_operations {
int (*write_ee)(struct fmc_device *fmc, int pos, const void *d, int l);
};
/* Prefer this helper trather than calling of fmc->reprogram directly */
extern int fmc_reprogram(struct fmc_device *f, struct fmc_driver *d, char *gw,
int sdb_entry);
/*
* The device reports all information needed to access hw.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment