Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320958
b: refs/heads/master
c: 32aecdd
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Jul 29, 2012
1 parent afdac98 commit 7311ef2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e4fad8e5d220e3dfb1050eee752ee5058f29a232
refs/heads/master: 32aecdd36528449cec34e6e63dcd5f0221ca7b43
31 changes: 5 additions & 26 deletions trunk/drivers/staging/bcm/Misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@ static int create_worker_threads(PMINI_ADAPTER psAdapter)

static struct file *open_firmware_file(PMINI_ADAPTER Adapter, const char *path)
{
struct file *flp = NULL;
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(get_ds());
flp = filp_open(path, O_RDONLY, S_IRWXU);
set_fs(oldfs);
struct file *flp = filp_open(path, O_RDONLY, S_IRWXU);
if (IS_ERR(flp)) {
pr_err(DRV_NAME "Unable To Open File %s, err %ld", path, PTR_ERR(flp));
flp = NULL;
Expand All @@ -183,14 +178,12 @@ static int BcmFileDownload(PMINI_ADAPTER Adapter, const char *path, unsigned int
{
int errorno = 0;
struct file *flp = NULL;
mm_segment_t oldfs;
struct timeval tv = {0};

flp = open_firmware_file(Adapter, path);
if (!flp) {
errorno = -ENOENT;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path);
goto exit_download;
return -ENOENT;
}
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path, (unsigned long)flp->f_dentry->d_inode->i_size, loc);
do_gettimeofday(&tv);
Expand All @@ -201,23 +194,15 @@ static int BcmFileDownload(PMINI_ADAPTER Adapter, const char *path, unsigned int
errorno = -EIO;
goto exit_download;
}
oldfs = get_fs();
set_fs(get_ds());
vfs_llseek(flp, 0, 0);
set_fs(oldfs);
if (Adapter->bcm_file_readback_from_chip(Adapter->pvInterfaceAdapter, flp, loc)) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to read back firmware!");
errorno = -EIO;
goto exit_download;
}

exit_download:
oldfs = get_fs();
set_fs(get_ds());
if (flp && !(IS_ERR(flp)))
filp_close(flp, current->files);
set_fs(oldfs);

filp_close(flp, NULL);
return errorno;
}

Expand Down Expand Up @@ -1080,10 +1065,8 @@ int InitCardAndDownloadFirmware(PMINI_ADAPTER ps_adapter)
static int bcm_parse_target_params(PMINI_ADAPTER Adapter)
{
struct file *flp = NULL;
mm_segment_t oldfs = {0};
char *buff;
int len = 0;
loff_t pos = 0;

buff = kmalloc(BUFFER_1K, GFP_KERNEL);
if (!buff)
Expand All @@ -1103,20 +1086,16 @@ static int bcm_parse_target_params(PMINI_ADAPTER Adapter)
Adapter->pstargetparams = NULL;
return -ENOENT;
}
oldfs = get_fs();
set_fs(get_ds());
len = vfs_read(flp, (void __user __force *)buff, BUFFER_1K, &pos);
set_fs(oldfs);
len = kernel_read(flp, 0, buff, BUFFER_1K);
filp_close(flp, NULL);

if (len != sizeof(STARGETPARAMS)) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Mismatch in Target Param Structure!\n");
kfree(buff);
kfree(Adapter->pstargetparams);
Adapter->pstargetparams = NULL;
filp_close(flp, current->files);
return -ENOENT;
}
filp_close(flp, current->files);

/* Check for autolink in config params */
/*
Expand Down

0 comments on commit 7311ef2

Please sign in to comment.