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