Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a5d54a321 |
+1
-1
@@ -66,7 +66,7 @@ BES2600_DRV_VERSION := bes2600_0.3.5_2024.0116
|
||||
ifeq ($(CONFIG_BES2600_CALIB_FROM_LINUX),y)
|
||||
FACTORY_CRC_CHECK ?= n
|
||||
STANDARD_FACTORY_EFUSE_FLAG ?= y
|
||||
FACTORY_PATH ?= /lib/firmware/bes2600_factory.txt
|
||||
FACTORY_PATH ?= bes2600/bes2600_factory.txt
|
||||
endif
|
||||
|
||||
# basic function
|
||||
|
||||
+14
-19
@@ -12,6 +12,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/crc32.h>
|
||||
@@ -137,38 +138,32 @@ static int bes2600_factory_crc_check(struct factory_t *factory_data)
|
||||
*/
|
||||
static int factory_section_read_file(char *path, void *buffer)
|
||||
{
|
||||
int ret = 0;
|
||||
struct file *fp;
|
||||
const struct firmware *fw;
|
||||
int ret;
|
||||
|
||||
if (!path || !buffer) {
|
||||
bes_err("%s NULL pointer err\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
bes_devel("reading %s \n", path);
|
||||
bes_devel("requesting firmware-class %s\n", path);
|
||||
|
||||
fp = filp_open(path, O_RDONLY, 0); //S_IRUSR
|
||||
if (IS_ERR(fp)) {
|
||||
bes_devel("BES2600 : can't open %s\n",path);
|
||||
ret = request_firmware(&fw, path, NULL);
|
||||
if (ret) {
|
||||
bes_devel("BES2600: request_firmware(%s) failed: %d\n", path, ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fp->f_inode->i_size <= 0 || fp->f_inode->i_size > FACTORY_MAX_SIZE) {
|
||||
bes_err( "bes2600_factory.txt size check failed, read_size: %lld max_size: %d\n",
|
||||
fp->f_inode->i_size, FACTORY_MAX_SIZE);
|
||||
filp_close(fp, NULL);
|
||||
if (fw->size == 0 || fw->size > FACTORY_MAX_SIZE) {
|
||||
bes_err("bes2600_factory.txt size check failed, read_size: %zu max_size: %d\n",
|
||||
fw->size, FACTORY_MAX_SIZE);
|
||||
release_firmware(fw);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = kernel_read(fp, buffer, fp->f_inode->i_size, &fp->f_pos);
|
||||
|
||||
filp_close(fp, NULL);
|
||||
|
||||
if (ret != fp->f_inode->i_size) {
|
||||
bes_err("bes2600_factory.txt read fail\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
memcpy(buffer, fw->data, fw->size);
|
||||
ret = (int)fw->size;
|
||||
release_firmware(fw);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user