Commit 8070c61b authored by Alessandro Rubini's avatar Alessandro Rubini

spec: reprogram() goes golden on NULL, as documented

parent 61446875
......@@ -32,3 +32,4 @@ struct sdb_array {
extern int fmc_scan_sdb_tree(struct fmc_device *fmc, unsigned long address);
extern void fmc_show_sdb_tree(struct fmc_device *fmc);
extern unsigned long fmc_find_sdb_device(struct sdb_array *tree);
extern int fmc_free_sdb_tree(struct fmc_device *fmc);
......@@ -11,6 +11,7 @@
#include <linux/fmc.h>
#include <linux/interrupt.h>
#include <linux/moduleparam.h>
#include <linux/fmc-sdb.h>
#include "spec.h"
static int spec_test_irq;
......@@ -26,7 +27,7 @@ static int spec_reprogram(struct fmc_device *fmc, char *gw)
int ret;
if (!gw)
return 0;
gw = spec_fw_name;
if (!strlen(gw)) {
/* FIXME: use module parameters */
......@@ -38,6 +39,7 @@ static int spec_reprogram(struct fmc_device *fmc, char *gw)
dev_warn(dev, "request firmware \"%s\": error %i\n", gw, ret);
goto out;
}
fmc_free_sdb_tree(fmc);
ret = spec_load_fpga(spec, fw->data, fw->size);
if (ret <0) {
dev_err(dev, "write firmware \"%s\": error %i\n", gw, ret);
......
......@@ -24,7 +24,7 @@
#include "spec.h"
#include "loader-ll.h"
static char *spec_fw_name = "fmc/spec-init.bin";
char *spec_fw_name = "fmc/spec-init.bin";
module_param_named(fw_name, spec_fw_name, charp, 0444);
/* Load the FPGA. This bases on loader-ll.c, a kernel/user space thing */
......
......@@ -118,6 +118,7 @@ static inline void gennum_mask_val(struct spec_dev *spec,
/* Functions in spec-pci.c */
extern int spec_load_fpga(struct spec_dev *spec, const void *data, int size);
extern int spec_load_fpga_file(struct spec_dev *spec, char *name);
extern char *spec_fw_name;
/* Functions in spec-fmc.c, used by spec-pci.c */
extern int spec_fmc_create(struct spec_dev *spec);
......
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