aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/ft1000/ft1000-usb/ft1000_download.c')
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_download.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index ba07d5d8504..1f7c7a67e1d 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -132,69 +132,6 @@ typedef struct _DSP_IMAGE_INFO_V6 {
132 unsigned short pad1; 132 unsigned short pad1;
133} DSP_IMAGE_INFO_V6, *PDSP_IMAGE_INFO_V6; 133} DSP_IMAGE_INFO_V6, *PDSP_IMAGE_INFO_V6;
134 134
135
136//---------------------------------------------------------------------------
137// Function: getfw
138//
139// Parameters: char *fn - input DSP image file name
140// int *pimgsz - output DSP image file size
141// Returns: DSP image buffer
142//
143// Description: Read the DSP image file into a char buffer
144//
145// Notes:
146//
147//---------------------------------------------------------------------------
148char *getfw (char *fn, size_t *pimgsz)
149{
150 struct file *fd;
151 mm_segment_t fs = get_fs();
152 loff_t pos;
153 char *pfwimg;
154 int fwimgsz;
155
156 set_fs(get_ds());
157
158 fd = filp_open(fn, 0, 0);
159 if ( IS_ERR(fd) )
160 {
161 DEBUG("FT1000:%s:can not open dsp image\n", __FUNCTION__);
162 set_fs(fs);
163 return NULL;
164 }
165
166 fwimgsz = i_size_read(fd->f_dentry->d_inode);
167 *pimgsz = fwimgsz;
168
169 if (fwimgsz <= 0)
170 {
171 DEBUG("FT1000:%s:invalid file size\n", __FUNCTION__);
172 filp_close(fd, current->files);
173 set_fs(fs);
174 return NULL;
175 }
176 pfwimg = (char*)vmalloc ( fwimgsz );
177 if (pfwimg == NULL) {
178 DEBUG("FT1000:%s:can not allocate memory for dsp image\n", __FUNCTION__);
179 filp_close(fd, current->files);
180 set_fs(fs);
181 return NULL;
182 }
183 pos = 0;
184 if (vfs_read(fd, (void __user __force*)pfwimg, fwimgsz, &pos) != fwimgsz) {
185 vfree(pfwimg);
186 DEBUG("FT1000:%s:failed to read firmware image\n",__FUNCTION__);
187 filp_close(fd, current->files);
188 set_fs(fs);
189 return NULL;
190 }
191
192 filp_close(fd, current->files);
193 set_fs(fs);
194
195 return pfwimg;
196}
197
198//--------------------------------------------------------------------------- 135//---------------------------------------------------------------------------
199// Function: check_usb_db 136// Function: check_usb_db
200// 137//