diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-05-30 10:59:04 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-05-30 10:59:04 +0200 |
commit | 063e04776172f93b16a5eefd5661a340c1126513 (patch) | |
tree | 19cb1623631c8cc5dcf0d91f4731feec7cbefa04 /drivers/media/video/s5p-mfc | |
parent | 59cd358a7a5b2f6b61faa01dae6cfda3830ac62a (diff) | |
parent | 731a7378b81c2f5fa88ca1ae20b83d548d5613dc (diff) | |
download | blackbird-op-linux-063e04776172f93b16a5eefd5661a340c1126513.tar.gz blackbird-op-linux-063e04776172f93b16a5eefd5661a340c1126513.zip |
Merge branch 'linus' into perf/urgent
Merge back Linus's latest branch so that we pick up the uprobes changes.
( I tested this branch locally and while it's one from the middle of the
merge window it's a good one to base further work off. )
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/media/video/s5p-mfc')
-rw-r--r-- | drivers/media/video/s5p-mfc/s5p_mfc.c | 81 | ||||
-rw-r--r-- | drivers/media/video/s5p-mfc/s5p_mfc_common.h | 2 | ||||
-rw-r--r-- | drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c | 16 | ||||
-rw-r--r-- | drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 6 | ||||
-rw-r--r-- | drivers/media/video/s5p-mfc/s5p_mfc_opr.c | 28 |
5 files changed, 52 insertions, 81 deletions
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc.c b/drivers/media/video/s5p-mfc/s5p_mfc.c index 83fe461af263..9bb68e7b5ae8 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc.c @@ -70,7 +70,7 @@ static void wake_up_dev(struct s5p_mfc_dev *dev, unsigned int reason, wake_up(&dev->queue); } -void s5p_mfc_watchdog(unsigned long arg) +static void s5p_mfc_watchdog(unsigned long arg) { struct s5p_mfc_dev *dev = (struct s5p_mfc_dev *)arg; @@ -373,7 +373,7 @@ static void s5p_mfc_handle_error(struct s5p_mfc_ctx *ctx, /* If no context is available then all necessary * processing has been done. */ - if (ctx == 0) + if (ctx == NULL) return; dev = ctx->dev; @@ -429,7 +429,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx, struct s5p_mfc_dev *dev; unsigned int guard_width, guard_height; - if (ctx == 0) + if (ctx == NULL) return; dev = ctx->dev; if (ctx->c_ops->post_seq_start) { @@ -496,7 +496,7 @@ static void s5p_mfc_handle_init_buffers(struct s5p_mfc_ctx *ctx, struct s5p_mfc_dev *dev; unsigned long flags; - if (ctx == 0) + if (ctx == NULL) return; dev = ctx->dev; s5p_mfc_clear_int_flags(dev); @@ -772,7 +772,7 @@ err_queue_init: err_init_hw: s5p_mfc_release_firmware(dev); err_alloc_fw: - dev->ctx[ctx->num] = 0; + dev->ctx[ctx->num] = NULL; del_timer_sync(&dev->watchdog_timer); s5p_mfc_clock_off(); err_pwr_enable: @@ -849,7 +849,7 @@ static int s5p_mfc_release(struct file *file) } mfc_debug(2, "Shutting down clock\n"); s5p_mfc_clock_off(); - dev->ctx[ctx->num] = 0; + dev->ctx[ctx->num] = NULL; s5p_mfc_dec_ctrls_delete(ctx); v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh); @@ -948,7 +948,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) int ret; pr_debug("%s++\n", __func__); - dev = kzalloc(sizeof *dev, GFP_KERNEL); + dev = devm_kzalloc(&pdev->dev, sizeof *dev, GFP_KERNEL); if (!dev) { dev_err(&pdev->dev, "Not enough memory for MFC device\n"); return -ENOMEM; @@ -959,49 +959,35 @@ static int s5p_mfc_probe(struct platform_device *pdev) dev->plat_dev = pdev; if (!dev->plat_dev) { dev_err(&pdev->dev, "No platform data specified\n"); - ret = -ENODEV; - goto err_dev; + return -ENODEV; } ret = s5p_mfc_init_pm(dev); if (ret < 0) { dev_err(&pdev->dev, "failed to get mfc clock source\n"); - goto err_clk; + return ret; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(&pdev->dev, "failed to get memory region resource\n"); - ret = -ENOENT; - goto err_res; - } - dev->mfc_mem = request_mem_region(res->start, resource_size(res), - pdev->name); - if (dev->mfc_mem == NULL) { - dev_err(&pdev->dev, "failed to get memory region\n"); - ret = -ENOENT; - goto err_mem_reg; - } - dev->regs_base = ioremap(dev->mfc_mem->start, resource_size(dev->mfc_mem)); + dev->regs_base = devm_request_and_ioremap(&pdev->dev, res); if (dev->regs_base == NULL) { - dev_err(&pdev->dev, "failed to ioremap address region\n"); - ret = -ENOENT; - goto err_ioremap; + dev_err(&pdev->dev, "Failed to obtain io memory\n"); + return -ENOENT; } res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (res == NULL) { dev_err(&pdev->dev, "failed to get irq resource\n"); ret = -ENOENT; - goto err_get_res; + goto err_res; } dev->irq = res->start; - ret = request_irq(dev->irq, s5p_mfc_irq, IRQF_DISABLED, pdev->name, - dev); + ret = devm_request_irq(&pdev->dev, dev->irq, s5p_mfc_irq, + IRQF_DISABLED, pdev->name, dev); if (ret) { dev_err(&pdev->dev, "Failed to install irq (%d)\n", ret); - goto err_req_irq; + goto err_res; } dev->mem_dev_l = device_find_child(&dev->plat_dev->dev, "s5p-mfc-l", @@ -1009,20 +995,20 @@ static int s5p_mfc_probe(struct platform_device *pdev) if (!dev->mem_dev_l) { mfc_err("Mem child (L) device get failed\n"); ret = -ENODEV; - goto err_find_child; + goto err_res; } dev->mem_dev_r = device_find_child(&dev->plat_dev->dev, "s5p-mfc-r", match_child); if (!dev->mem_dev_r) { mfc_err("Mem child (R) device get failed\n"); ret = -ENODEV; - goto err_find_child; + goto err_res; } dev->alloc_ctx[0] = vb2_dma_contig_init_ctx(dev->mem_dev_l); if (IS_ERR_OR_NULL(dev->alloc_ctx[0])) { ret = PTR_ERR(dev->alloc_ctx[0]); - goto err_mem_init_ctx_0; + goto err_res; } dev->alloc_ctx[1] = vb2_dma_contig_init_ctx(dev->mem_dev_r); if (IS_ERR_OR_NULL(dev->alloc_ctx[1])) { @@ -1048,6 +1034,10 @@ static int s5p_mfc_probe(struct platform_device *pdev) vfd->ioctl_ops = get_dec_v4l2_ioctl_ops(); vfd->release = video_device_release, vfd->lock = &dev->mfc_mutex; + /* Locking in file operations other than ioctl should be done + by the driver, not the V4L2 core. + This driver needs auditing so that this flag can be removed. */ + set_bit(V4L2_FL_LOCK_ALL_FOPS, &vfd->flags); vfd->v4l2_dev = &dev->v4l2_dev; snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_DEC_NAME); dev->vfd_dec = vfd; @@ -1072,6 +1062,8 @@ static int s5p_mfc_probe(struct platform_device *pdev) vfd->ioctl_ops = get_enc_v4l2_ioctl_ops(); vfd->release = video_device_release, vfd->lock = &dev->mfc_mutex; + /* This should not be necessary */ + set_bit(V4L2_FL_LOCK_ALL_FOPS, &vfd->flags); vfd->v4l2_dev = &dev->v4l2_dev; snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_ENC_NAME); dev->vfd_enc = vfd; @@ -1110,22 +1102,9 @@ err_v4l2_dev_reg: vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[1]); err_mem_init_ctx_1: vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]); -err_mem_init_ctx_0: -err_find_child: - free_irq(dev->irq, dev); -err_req_irq: -err_get_res: - iounmap(dev->regs_base); - dev->regs_base = NULL; -err_ioremap: - release_resource(dev->mfc_mem); - kfree(dev->mfc_mem); -err_mem_reg: err_res: s5p_mfc_final_pm(dev); -err_clk: -err_dev: - kfree(dev); + pr_debug("%s-- with error\n", __func__); return ret; @@ -1148,15 +1127,7 @@ static int __devexit s5p_mfc_remove(struct platform_device *pdev) vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]); vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[1]); - free_irq(dev->irq, dev); - iounmap(dev->regs_base); - if (dev->mfc_mem) { - release_resource(dev->mfc_mem); - kfree(dev->mfc_mem); - dev->mfc_mem = NULL; - } s5p_mfc_final_pm(dev); - kfree(dev); return 0; } diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_common.h b/drivers/media/video/s5p-mfc/s5p_mfc_common.h index 91146fa622e4..bd5706a6bad1 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/video/s5p-mfc/s5p_mfc_common.h @@ -185,7 +185,6 @@ struct s5p_mfc_pm { * @mem_dev_r: child device of the right memory bank (1) * @regs_base: base address of the MFC hw registers * @irq: irq resource - * @mfc_mem: MFC registers memory resource * @dec_ctrl_handler: control framework handler for decoding * @enc_ctrl_handler: control framework handler for encoding * @pm: power management control @@ -221,7 +220,6 @@ struct s5p_mfc_dev { struct device *mem_dev_r; void __iomem *regs_base; int irq; - struct resource *mfc_mem; struct v4l2_ctrl_handler dec_ctrl_handler; struct v4l2_ctrl_handler enc_ctrl_handler; struct s5p_mfc_pm pm; diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c index f2481a85e0a2..08a5cfeaa59e 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c @@ -52,7 +52,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) s5p_mfc_bitproc_buf = vb2_dma_contig_memops.alloc( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], dev->fw_size); if (IS_ERR(s5p_mfc_bitproc_buf)) { - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; mfc_err("Allocating bitprocessor buffer failed\n"); release_firmware(fw_blob); return -ENOMEM; @@ -63,7 +63,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) mfc_err("The base memory for bank 1 is not aligned to 128KB\n"); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; release_firmware(fw_blob); return -EIO; } @@ -72,7 +72,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) mfc_err("Bitprocessor memory remap failed\n"); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; release_firmware(fw_blob); return -EIO; } @@ -82,7 +82,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) if (IS_ERR(b_base)) { vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; mfc_err("Allocating bank2 base failed\n"); release_firmware(fw_blob); return -ENOMEM; @@ -94,7 +94,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) mfc_err("The base memory for bank 2 is not aligned to 128KB\n"); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; release_firmware(fw_blob); return -EIO; } @@ -126,7 +126,7 @@ int s5p_mfc_reload_firmware(struct s5p_mfc_dev *dev) release_firmware(fw_blob); return -ENOMEM; } - if (s5p_mfc_bitproc_buf == 0 || s5p_mfc_bitproc_phys == 0) { + if (s5p_mfc_bitproc_buf == NULL || s5p_mfc_bitproc_phys == 0) { mfc_err("MFC firmware is not allocated or was not mapped correctly\n"); release_firmware(fw_blob); return -EINVAL; @@ -146,9 +146,9 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) if (!s5p_mfc_bitproc_buf) return -EINVAL; vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); - s5p_mfc_bitproc_virt = 0; + s5p_mfc_bitproc_virt = NULL; s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; return 0; } diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index dff9dc798795..acedb2004be3 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -1436,7 +1436,8 @@ static const struct v4l2_ctrl_ops s5p_mfc_enc_ctrl_ops = { .s_ctrl = s5p_mfc_enc_s_ctrl, }; -int vidioc_s_parm(struct file *file, void *priv, struct v4l2_streamparm *a) +static int vidioc_s_parm(struct file *file, void *priv, + struct v4l2_streamparm *a) { struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); @@ -1452,7 +1453,8 @@ int vidioc_s_parm(struct file *file, void *priv, struct v4l2_streamparm *a) return 0; } -int vidioc_g_parm(struct file *file, void *priv, struct v4l2_streamparm *a) +static int vidioc_g_parm(struct file *file, void *priv, + struct v4l2_streamparm *a) { struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_opr.c b/drivers/media/video/s5p-mfc/s5p_mfc_opr.c index e08b21c50ebf..e6217cbfa4a3 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_opr.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_opr.c @@ -43,7 +43,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx) ctx->desc_buf = vb2_dma_contig_memops.alloc( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], DESC_BUF_SIZE); if (IS_ERR_VALUE((int)ctx->desc_buf)) { - ctx->desc_buf = 0; + ctx->desc_buf = NULL; mfc_err("Allocating DESC buffer failed\n"); return -ENOMEM; } @@ -54,7 +54,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx) if (desc_virt == NULL) { vb2_dma_contig_memops.put(ctx->desc_buf); ctx->desc_phys = 0; - ctx->desc_buf = 0; + ctx->desc_buf = NULL; mfc_err("Remapping DESC buffer failed\n"); return -ENOMEM; } @@ -69,7 +69,7 @@ void s5p_mfc_release_dec_desc_buffer(struct s5p_mfc_ctx *ctx) if (ctx->desc_phys) { vb2_dma_contig_memops.put(ctx->desc_buf); ctx->desc_phys = 0; - ctx->desc_buf = 0; + ctx->desc_buf = NULL; } } @@ -186,7 +186,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx) ctx->bank1_buf = vb2_dma_contig_memops.alloc( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], ctx->bank1_size); if (IS_ERR(ctx->bank1_buf)) { - ctx->bank1_buf = 0; + ctx->bank1_buf = NULL; printk(KERN_ERR "Buf alloc for decoding failed (port A)\n"); return -ENOMEM; @@ -200,7 +200,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx) ctx->bank2_buf = vb2_dma_contig_memops.alloc( dev->alloc_ctx[MFC_BANK2_ALLOC_CTX], ctx->bank2_size); if (IS_ERR(ctx->bank2_buf)) { - ctx->bank2_buf = 0; + ctx->bank2_buf = NULL; mfc_err("Buf alloc for decoding failed (port B)\n"); return -ENOMEM; } @@ -216,13 +216,13 @@ void s5p_mfc_release_codec_buffers(struct s5p_mfc_ctx *ctx) { if (ctx->bank1_buf) { vb2_dma_contig_memops.put(ctx->bank1_buf); - ctx->bank1_buf = 0; + ctx->bank1_buf = NULL; ctx->bank1_phys = 0; ctx->bank1_size = 0; } if (ctx->bank2_buf) { vb2_dma_contig_memops.put(ctx->bank2_buf); - ctx->bank2_buf = 0; + ctx->bank2_buf = NULL; ctx->bank2_phys = 0; ctx->bank2_size = 0; } @@ -244,7 +244,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) if (IS_ERR(ctx->ctx_buf)) { mfc_err("Allocating context buffer failed\n"); ctx->ctx_phys = 0; - ctx->ctx_buf = 0; + ctx->ctx_buf = NULL; return -ENOMEM; } ctx->ctx_phys = s5p_mfc_mem_cookie( @@ -256,7 +256,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) mfc_err("Remapping instance buffer failed\n"); vb2_dma_contig_memops.put(ctx->ctx_buf); ctx->ctx_phys = 0; - ctx->ctx_buf = 0; + ctx->ctx_buf = NULL; return -ENOMEM; } /* Zero content of the allocated memory */ @@ -265,7 +265,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) if (s5p_mfc_init_shm(ctx) < 0) { vb2_dma_contig_memops.put(ctx->ctx_buf); ctx->ctx_phys = 0; - ctx->ctx_buf = 0; + ctx->ctx_buf = NULL; return -ENOMEM; } return 0; @@ -277,12 +277,12 @@ void s5p_mfc_release_instance_buffer(struct s5p_mfc_ctx *ctx) if (ctx->ctx_buf) { vb2_dma_contig_memops.put(ctx->ctx_buf); ctx->ctx_phys = 0; - ctx->ctx_buf = 0; + ctx->ctx_buf = NULL; } if (ctx->shm_alloc) { vb2_dma_contig_memops.put(ctx->shm_alloc); - ctx->shm_alloc = 0; - ctx->shm = 0; + ctx->shm_alloc = NULL; + ctx->shm = NULL; } } @@ -296,7 +296,7 @@ void s5p_mfc_set_dec_desc_buffer(struct s5p_mfc_ctx *ctx) } /* Set registers for shared buffer */ -void s5p_mfc_set_shared_buffer(struct s5p_mfc_ctx *ctx) +static void s5p_mfc_set_shared_buffer(struct s5p_mfc_ctx *ctx) { struct s5p_mfc_dev *dev = ctx->dev; mfc_write(dev, ctx->shm_ofs, S5P_FIMV_SI_CH0_HOST_WR_ADR); |