diff options
Diffstat (limited to 'drivers/media/pci')
-rw-r--r-- | drivers/media/pci/cx25821/cx25821-audio-upstream.c | 179 | ||||
-rw-r--r-- | drivers/media/pci/ttpci/av7110_ir.c | 2 | ||||
-rw-r--r-- | drivers/media/pci/zoran/zoran_procfs.c | 4 |
3 files changed, 56 insertions, 129 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-audio-upstream.c b/drivers/media/pci/cx25821/cx25821-audio-upstream.c index b9be535e32b8..68dbc2dbc982 100644 --- a/drivers/media/pci/cx25821/cx25821-audio-upstream.c +++ b/drivers/media/pci/cx25821/cx25821-audio-upstream.c | |||
@@ -259,79 +259,46 @@ void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev) | |||
259 | static int cx25821_get_audio_data(struct cx25821_dev *dev, | 259 | static int cx25821_get_audio_data(struct cx25821_dev *dev, |
260 | const struct sram_channel *sram_ch) | 260 | const struct sram_channel *sram_ch) |
261 | { | 261 | { |
262 | struct file *myfile; | 262 | struct file *file; |
263 | int frame_index_temp = dev->_audioframe_index; | 263 | int frame_index_temp = dev->_audioframe_index; |
264 | int i = 0; | 264 | int i = 0; |
265 | int line_size = AUDIO_LINE_SIZE; | ||
266 | int frame_size = AUDIO_DATA_BUF_SZ; | 265 | int frame_size = AUDIO_DATA_BUF_SZ; |
267 | int frame_offset = frame_size * frame_index_temp; | 266 | int frame_offset = frame_size * frame_index_temp; |
268 | ssize_t vfs_read_retval = 0; | 267 | char mybuf[AUDIO_LINE_SIZE]; |
269 | char mybuf[line_size]; | ||
270 | loff_t file_offset = dev->_audioframe_count * frame_size; | 268 | loff_t file_offset = dev->_audioframe_count * frame_size; |
271 | loff_t pos; | 269 | char *p = NULL; |
272 | mm_segment_t old_fs; | ||
273 | 270 | ||
274 | if (dev->_audiofile_status == END_OF_FILE) | 271 | if (dev->_audiofile_status == END_OF_FILE) |
275 | return 0; | 272 | return 0; |
276 | 273 | ||
277 | myfile = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); | 274 | file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); |
275 | if (IS_ERR(file)) { | ||
276 | pr_err("%s(): ERROR opening file(%s) with errno = %ld!\n", | ||
277 | __func__, dev->_audiofilename, -PTR_ERR(file)); | ||
278 | return PTR_ERR(file); | ||
279 | } | ||
278 | 280 | ||
279 | if (IS_ERR(myfile)) { | 281 | if (dev->_audiodata_buf_virt_addr) |
280 | const int open_errno = -PTR_ERR(myfile); | 282 | p = (char *)dev->_audiodata_buf_virt_addr + frame_offset; |
281 | pr_err("%s(): ERROR opening file(%s) with errno = %d!\n", | ||
282 | __func__, dev->_audiofilename, open_errno); | ||
283 | return PTR_ERR(myfile); | ||
284 | } else { | ||
285 | if (!(myfile->f_op)) { | ||
286 | pr_err("%s(): File has no file operations registered!\n", | ||
287 | __func__); | ||
288 | filp_close(myfile, NULL); | ||
289 | return -EIO; | ||
290 | } | ||
291 | 283 | ||
292 | if (!myfile->f_op->read) { | 284 | for (i = 0; i < dev->_audio_lines_count; i++) { |
293 | pr_err("%s(): File has no READ operations registered!\n", | 285 | int n = kernel_read(file, file_offset, mybuf, AUDIO_LINE_SIZE); |
286 | if (n < AUDIO_LINE_SIZE) { | ||
287 | pr_info("Done: exit %s() since no more bytes to read from Audio file\n", | ||
294 | __func__); | 288 | __func__); |
295 | filp_close(myfile, NULL); | 289 | dev->_audiofile_status = END_OF_FILE; |
296 | return -EIO; | 290 | fput(file); |
291 | return 0; | ||
297 | } | 292 | } |
298 | 293 | dev->_audiofile_status = IN_PROGRESS; | |
299 | pos = myfile->f_pos; | 294 | if (p) { |
300 | old_fs = get_fs(); | 295 | memcpy(p, mybuf, n); |
301 | set_fs(KERNEL_DS); | 296 | p += n; |
302 | |||
303 | for (i = 0; i < dev->_audio_lines_count; i++) { | ||
304 | pos = file_offset; | ||
305 | |||
306 | vfs_read_retval = vfs_read(myfile, mybuf, line_size, | ||
307 | &pos); | ||
308 | |||
309 | if (vfs_read_retval > 0 && vfs_read_retval == line_size | ||
310 | && dev->_audiodata_buf_virt_addr != NULL) { | ||
311 | memcpy((void *)(dev->_audiodata_buf_virt_addr + | ||
312 | frame_offset / 4), mybuf, | ||
313 | vfs_read_retval); | ||
314 | } | ||
315 | |||
316 | file_offset += vfs_read_retval; | ||
317 | frame_offset += vfs_read_retval; | ||
318 | |||
319 | if (vfs_read_retval < line_size) { | ||
320 | pr_info("Done: exit %s() since no more bytes to read from Audio file\n", | ||
321 | __func__); | ||
322 | break; | ||
323 | } | ||
324 | } | 297 | } |
325 | 298 | file_offset += n; | |
326 | if (i > 0) | ||
327 | dev->_audioframe_count++; | ||
328 | |||
329 | dev->_audiofile_status = (vfs_read_retval == line_size) ? | ||
330 | IN_PROGRESS : END_OF_FILE; | ||
331 | |||
332 | set_fs(old_fs); | ||
333 | filp_close(myfile, NULL); | ||
334 | } | 299 | } |
300 | dev->_audioframe_count++; | ||
301 | fput(file); | ||
335 | 302 | ||
336 | return 0; | 303 | return 0; |
337 | } | 304 | } |
@@ -354,81 +321,41 @@ static void cx25821_audioups_handler(struct work_struct *work) | |||
354 | static int cx25821_openfile_audio(struct cx25821_dev *dev, | 321 | static int cx25821_openfile_audio(struct cx25821_dev *dev, |
355 | const struct sram_channel *sram_ch) | 322 | const struct sram_channel *sram_ch) |
356 | { | 323 | { |
357 | struct file *myfile; | 324 | char *p = (void *)dev->_audiodata_buf_virt_addr; |
358 | int i = 0, j = 0; | 325 | struct file *file; |
359 | int line_size = AUDIO_LINE_SIZE; | 326 | loff_t offset; |
360 | ssize_t vfs_read_retval = 0; | 327 | int i, j; |
361 | char mybuf[line_size]; | 328 | |
362 | loff_t pos; | 329 | file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); |
363 | loff_t offset = (unsigned long)0; | 330 | if (IS_ERR(file)) { |
364 | mm_segment_t old_fs; | 331 | pr_err("%s(): ERROR opening file(%s) with errno = %ld!\n", |
365 | 332 | __func__, dev->_audiofilename, PTR_ERR(file)); | |
366 | myfile = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); | 333 | return PTR_ERR(file); |
367 | 334 | } | |
368 | if (IS_ERR(myfile)) { | ||
369 | const int open_errno = -PTR_ERR(myfile); | ||
370 | pr_err("%s(): ERROR opening file(%s) with errno = %d!\n", | ||
371 | __func__, dev->_audiofilename, open_errno); | ||
372 | return PTR_ERR(myfile); | ||
373 | } else { | ||
374 | if (!(myfile->f_op)) { | ||
375 | pr_err("%s(): File has no file operations registered!\n", | ||
376 | __func__); | ||
377 | filp_close(myfile, NULL); | ||
378 | return -EIO; | ||
379 | } | ||
380 | |||
381 | if (!myfile->f_op->read) { | ||
382 | pr_err("%s(): File has no READ operations registered!\n", | ||
383 | __func__); | ||
384 | filp_close(myfile, NULL); | ||
385 | return -EIO; | ||
386 | } | ||
387 | |||
388 | pos = myfile->f_pos; | ||
389 | old_fs = get_fs(); | ||
390 | set_fs(KERNEL_DS); | ||
391 | |||
392 | for (j = 0; j < NUM_AUDIO_FRAMES; j++) { | ||
393 | for (i = 0; i < dev->_audio_lines_count; i++) { | ||
394 | pos = offset; | ||
395 | |||
396 | vfs_read_retval = vfs_read(myfile, mybuf, | ||
397 | line_size, &pos); | ||
398 | |||
399 | if (vfs_read_retval > 0 && | ||
400 | vfs_read_retval == line_size && | ||
401 | dev->_audiodata_buf_virt_addr != NULL) { | ||
402 | memcpy((void *)(dev-> | ||
403 | _audiodata_buf_virt_addr | ||
404 | + offset / 4), mybuf, | ||
405 | vfs_read_retval); | ||
406 | } | ||
407 | 335 | ||
408 | offset += vfs_read_retval; | 336 | for (j = 0, offset = 0; j < NUM_AUDIO_FRAMES; j++) { |
337 | for (i = 0; i < dev->_audio_lines_count; i++) { | ||
338 | char buf[AUDIO_LINE_SIZE]; | ||
339 | int n = kernel_read(file, offset, buf, | ||
340 | AUDIO_LINE_SIZE); | ||
409 | 341 | ||
410 | if (vfs_read_retval < line_size) { | 342 | if (n < AUDIO_LINE_SIZE) { |
411 | pr_info("Done: exit %s() since no more bytes to read from Audio file\n", | 343 | pr_info("Done: exit %s() since no more bytes to read from Audio file\n", |
412 | __func__); | 344 | __func__); |
413 | break; | 345 | dev->_audiofile_status = END_OF_FILE; |
414 | } | 346 | fput(file); |
347 | return 0; | ||
415 | } | 348 | } |
416 | 349 | ||
417 | if (i > 0) | 350 | if (p) |
418 | dev->_audioframe_count++; | 351 | memcpy(p + offset, buf, n); |
419 | 352 | ||
420 | if (vfs_read_retval < line_size) | 353 | offset += n; |
421 | break; | ||
422 | } | 354 | } |
423 | 355 | dev->_audioframe_count++; | |
424 | dev->_audiofile_status = (vfs_read_retval == line_size) ? | ||
425 | IN_PROGRESS : END_OF_FILE; | ||
426 | |||
427 | set_fs(old_fs); | ||
428 | myfile->f_pos = 0; | ||
429 | filp_close(myfile, NULL); | ||
430 | } | 356 | } |
431 | 357 | dev->_audiofile_status = IN_PROGRESS; | |
358 | fput(file); | ||
432 | return 0; | 359 | return 0; |
433 | } | 360 | } |
434 | 361 | ||
diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c index eb822862a646..0e763a784e2b 100644 --- a/drivers/media/pci/ttpci/av7110_ir.c +++ b/drivers/media/pci/ttpci/av7110_ir.c | |||
@@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110) | |||
375 | if (av_cnt == 1) { | 375 | if (av_cnt == 1) { |
376 | e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops); | 376 | e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops); |
377 | if (e) | 377 | if (e) |
378 | e->size = 4 + 256 * sizeof(u16); | 378 | proc_set_size(e, 4 + 256 * sizeof(u16)); |
379 | } | 379 | } |
380 | 380 | ||
381 | tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir); | 381 | tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir); |
diff --git a/drivers/media/pci/zoran/zoran_procfs.c b/drivers/media/pci/zoran/zoran_procfs.c index 1512b5d40533..f7ceee0cdefd 100644 --- a/drivers/media/pci/zoran/zoran_procfs.c +++ b/drivers/media/pci/zoran/zoran_procfs.c | |||
@@ -130,14 +130,14 @@ static int zoran_show(struct seq_file *p, void *v) | |||
130 | 130 | ||
131 | static int zoran_open(struct inode *inode, struct file *file) | 131 | static int zoran_open(struct inode *inode, struct file *file) |
132 | { | 132 | { |
133 | struct zoran *data = PDE(inode)->data; | 133 | struct zoran *data = PDE_DATA(inode); |
134 | return single_open(file, zoran_show, data); | 134 | return single_open(file, zoran_show, data); |
135 | } | 135 | } |
136 | 136 | ||
137 | static ssize_t zoran_write(struct file *file, const char __user *buffer, | 137 | static ssize_t zoran_write(struct file *file, const char __user *buffer, |
138 | size_t count, loff_t *ppos) | 138 | size_t count, loff_t *ppos) |
139 | { | 139 | { |
140 | struct zoran *zr = PDE(file_inode(file))->data; | 140 | struct zoran *zr = PDE_DATA(file_inode(file)); |
141 | char *string, *sp; | 141 | char *string, *sp; |
142 | char *line, *ldelim, *varname, *svar, *tdelim; | 142 | char *line, *ldelim, *varname, *svar, *tdelim; |
143 | 143 | ||