[PATCH] staging: most: sound: pass correct device when creating a sound card
This patch fixes the usage of the wrong struct device when calling function snd_card_new. Reported-by: Eugeniu Rosca Signed-off-by: Christian Gromm --- drivers/staging/most/sound/sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 7c99867..342f390 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -613,7 +613,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, INIT_LIST_HEAD(&adpt->dev_list); iface->priv = adpt; list_add_tail(&adpt->list, &adpt_list); - ret = snd_card_new(&iface->dev, -1, "INIC", THIS_MODULE, + ret = snd_card_new(iface->driver_dev, -1, "INIC", THIS_MODULE, sizeof(*channel), &adpt->card); if (ret < 0) goto err_free_adpt; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] media: imx7-media-csi: add i.MX6UL support
i.MX7 and i.MX6UL/L have the same CSI controller. So add i.MX6UL/L support to imx7-media-csi driver. Signed-off-by: Sébastien Szymanski --- This patch needs the following patch from Rui Miguel Silva: https://patchwork.linuxtv.org/patch/55657/ I have tested this patch with a OV5640 sensor (8-bit parallel). The pipeline is: Device topology - entity 1: csi (2 pads, 2 links) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0 pad0: Sink [fmt:UYVY8_2X8/640x480 field:none colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range] <- "ov5640 1-003c":0 [ENABLED] pad1: Source [fmt:UYVY8_2X8/640x480 field:none colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range] -> "csi capture":0 [ENABLED] - entity 4: csi capture (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video0 pad0: Sink <- "csi":1 [ENABLED] - entity 10: ov5640 1-003c (1 pad, 1 link) type V4L2 subdev subtype Sensor flags 0 device node name /dev/v4l-subdev1 pad0: Source [fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range] -> "csi":0 [ENABLED] drivers/staging/media/imx/imx7-media-csi.c | 61 -- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index a708a0340eb1..ef4534a96fa0 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -154,6 +154,11 @@ static const char * const imx7_csi_clk_id[] = {"axi", "dcic", "mclk"}; +enum csi_type { + IMX7, + IMX6UL +}; + struct imx7_csi { struct device *dev; struct v4l2_subdev sd; @@ -195,6 +200,7 @@ struct imx7_csi { bool is_init; bool is_streaming; bool is_csi2; + enum csi_type type; struct completion last_eof_completion; }; @@ -554,6 +560,14 @@ static int imx7_csi_pad_link_validate(struct v4l2_subdev *sd, if (ret) return ret; + if (csi->type == IMX6UL) { + mutex_lock(&csi->lock); + csi->is_csi2 = false; + mutex_unlock(&csi->lock); + + return 0; + } + ret = imx7_csi_get_upstream_endpoint(csi, &upstream_ep, true); if (ret) { v4l2_err(&csi->sd, "failed to find upstream endpoint\n"); @@ -763,6 +777,7 @@ static int imx7_csi_configure(struct imx7_csi *csi) struct v4l2_pix_format *out_pix = &vdev->fmt.fmt.pix; __u32 in_code = csi->format_mbus[IMX7_CSI_PAD_SINK].code; u32 cr1, cr18; + int width = out_pix->width; if (out_pix->field == V4L2_FIELD_INTERLACED) { imx7_csi_deinterlace_enable(csi, true); @@ -772,15 +787,27 @@ static int imx7_csi_configure(struct imx7_csi *csi) imx7_csi_buf_stride_set(csi, 0); } - imx7_csi_set_imagpara(csi, out_pix->width, out_pix->height); + cr18 = imx7_csi_reg_read(csi, CSI_CSICR18); + + if (!csi->is_csi2) { + if (out_pix->pixelformat == V4L2_PIX_FMT_UYVY || + out_pix->pixelformat == V4L2_PIX_FMT_YUYV) + width *= 2; + + imx7_csi_set_imagpara(csi, width, out_pix->height); + + cr18 |= (BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL | + BIT_BASEADDR_CHG_ERR_EN); + imx7_csi_reg_write(csi, cr18, CSI_CSICR18); - if (!csi->is_csi2) return 0; + } + + imx7_csi_set_imagpara(csi, width, out_pix->height); cr1 = imx7_csi_reg_read(csi, CSI_CSICR1); cr1 &= ~BIT_GCLK_MODE; - cr18 = imx7_csi_reg_read(csi, CSI_CSICR18); cr18 &= BIT_MIPI_DATA_FORMAT_MASK; cr18 |= BIT_DATA_FROM_MIPI; @@ -815,12 +842,9 @@ static int imx7_csi_enable(struct imx7_csi *csi) { imx7_csi_sw_reset(csi); - if (csi->is_csi2) { - imx7_csi_dmareq_rff_enable(csi); - imx7_csi_hw_enable_irq(csi); - imx7_csi_hw_enable(csi); - return 0; - } + imx7_csi_dmareq_rff_enable(csi); + imx7_csi_hw_enable_irq(csi); + imx7_csi_hw_enable(csi); return 0; } @@ -1218,20 +1242,33 @@ static int imx7_csi_clocks_get(struct imx7_csi *csi) return devm_clk_bulk_get(dev, csi->num_clks, csi->clks); } +static const struct of_device_id imx7_csi_of_match[] = { + { .compatible = "fsl,imx7-csi", .data = (void *)IMX7 }, + { .compatible = "fsl,imx6ul-csi", .data = (void *)IMX6UL }, + { }, +}; +MODULE_DEVICE_TABLE(of, imx7_csi_of_match); + static int imx7_csi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struc
Re: [PATCH] staging: kpc2000: Use memset to initialize resources
On Wed, Apr 24, 2019 at 11:57:43AM -0700, Nathan Chancellor wrote: > diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c > b/drivers/staging/kpc2000/kpc2000/cell_probe.c > index ad2cc0a3bfa1..13f544f3c0b9 100644 > --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c > +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c > @@ -93,8 +93,8 @@ void parse_core_table_entry(struct core_table_entry *cte, > const u64 read_val, co > int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard, > char *name, const struct core_table_entry cte) > { > struct mfd_cell cell = {0}; > -struct resource resources[2] = {0}; > - > +struct resource resources[2]; > + > struct kpc_core_device_platdata core_pdata = { Greg already applied this and that's cool but I would have probably gone with "struct resource resources[2] = {};". memset() is only required if we want to clear out the struct holes because we're going to copy the whole struct to userspace. (Some compilers will change foo = {} into "foo.a = 0; foo.b = 0;" when it's faster than doing a memset, so the struct holes don't always get cleared). Also it was risky from a process perspective to delete the stray tab from the next line because some one could have argued that it was unrelated or that the whole line should be removed instead. You would have had to redo the patch for something silly... #YOLO #LivingOnTheEdge But in this case, it's already applied so everything worked out. :) regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: sound: pass correct device when creating a sound card
On Tue, Apr 30, 2019 at 11:00:22AM +0200, Christian Gromm wrote: > This patch fixes the usage of the wrong struct device when calling > function snd_card_new. > > Reported-by: Eugeniu Rosca > Signed-off-by: Christian Gromm > --- > drivers/staging/most/sound/sound.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Does this fix a specific commit? If so, should there be a "Fixes: " tag in the s-o-b: area? Does this need to go to the stable trees? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH RFC] staging: kpc2000: use int for wait_for_completion_interruptible
On Sat, Apr 27, 2019 at 04:38:45AM +0200, Nicholas Mc Guire wrote: > weit_for_completion_interruptible returns in (0 on completion and > -ERESTARTSYS on interruption) - so use an int not long for API conformance > and simplify the logic here a bit: need not check explicitly for == 0 as > this is either -ERESTARTSYS or 0. > > Signed-off-by: Nicholas Mc Guire > --- > > Problem located with experimental API conformance checking cocci script > > Not sure if making such point-wise fixes makes much sense - this driver has > a number of issues both style-wise and API compliance wise. > > Note that kpc_dma_transfer() returns int not long - currently rv (long) is > being returned in most places (some places do return int) - so the return > handling here is a bit inconsistent. > > Patch was compile-tested with: x86_64_defconfig + KPC2000=y, KPC2000_DMA=y > (with a number of unrelated sparse warnings about non-declared symbols, and > smatch warnings about overflowing constants as well as coccicheck warning > about usless casting) The patch must have got corrupted or something. Or maybe the code was ifdeffed out. It won't compile. > > Patch is against 5.1-rc6 (localversion-next is next-20190426) > > drivers/staging/kpc2000/kpc_dma/fileops.c | 16 +--- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c > b/drivers/staging/kpc2000/kpc_dma/fileops.c > index 5741d2b..66f0d5a 100644 > --- a/drivers/staging/kpc2000/kpc_dma/fileops.c > +++ b/drivers/staging/kpc2000/kpc_dma/fileops.c > @@ -38,6 +38,7 @@ int kpc_dma_transfer(struct dev_private_data *priv, struct > kiocb *kcb, unsigned > { > unsigned int i = 0; > long rv = 0; > + int ret = 0; > struct kpc_dma_device *ldev; > struct aio_cb_data *acd; > DECLARE_COMPLETION_ONSTACK(done); > @@ -180,16 +181,17 @@ int kpc_dma_transfer(struct dev_private_data *priv, > struct kiocb *kcb, unsigned > > // If this is a synchronous kiocb, we need to put the calling process > to sleep until the transfer is complete > if (kcb == NULL || is_sync_kiocb(kcb)){ > - rv = wait_for_completion_interruptible(&done); > - // If the user aborted (rv == -ERESTARTSYS), we're no longer > responsible for cleaning up the acd > - if (rv == -ERESTARTSYS){ > + ret = wait_for_completion_interruptible(&done); > + /* If the user aborted (ret == -ERESTARTSYS), we're > + * no longer responsible for cleaning up the acd > + * This comment is never closed off with a "*/". > + if (ret){ ^^ Missing space. Please use checkpatch.pl. > acd->cpl = NULL; > - } > - if (rv == 0){ > - rv = acd->len; > + } else { > + ret = acd->len; > kfree(acd); > } > - return rv; > + return ret I don't really see an advantage with introducing a "ret" variable instead of using "rv". regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: use proper return type for wait_for_completion_timeout
On Sat, Apr 27, 2019 at 05:27:25AM +0200, Nicholas Mc Guire wrote: > wait_for_completion_timeout() returns unsigned long (0 on timeout or > remaining jiffies) not int. > Yeah, but it's fine though because 1 / 256 fits into int without a problem. I'm not sure this sort of patch is worth it when it's just a style debate instead of a bugfix. I'm a little bit torn about this. In Smatch, I run into this issue one in a while where Smatch doesn't know if the timeout is less than int. Right now I hacked the DB to say that these functions always return < INT_MAX. Anyway, for sure the commit message should say that it's just a cleanup and not a bugfix. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH RFC V2] staging: kpc2000: use int for wait_for_completion_interruptible
On Sat, Apr 27, 2019 at 11:14:34AM +0200, Nicholas Mc Guire wrote: > weit_for_completion_interruptible returns in (0 on completion and ^ wait_for_completion_interruptible > -ERESTARTSYS on interruption) - so use an int not long for API conformance > and simplify the logic here a bit: need not check explicitly for == 0 as > this is either -ERESTARTSYS or 0. > > Signed-off-by: Nicholas Mc Guire > --- > > Problem located with experimental API conformance checking cocci script > > V2: kbuild reported a missing closing comment - seems that I managed > send out the the initial version before compile testing/checkpatching > sorry for the noise. > > Not sure if making such point-wise fixes makes much sense - this driver has > a number of issues both style-wise and API compliance wise. > > Note that kpc_dma_transfer() returns int not long - currently rv (long) is > being returned in most places (some places do return int) - so the return > handling here is a bit inconsistent. > > Patch was compile-tested with: x86_64_defconfig + KPC2000=y, KPC2000_DMA=y > (with a number of unrelated sparse warnings about non-declared symbols, and > smatch warnings about overflowing constants as well as coccicheck warning > about usless casting) > > Patch is against 5.1-rc6 (localversion-next is next-20190426) > > drivers/staging/kpc2000/kpc_dma/fileops.c | 16 +--- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c > b/drivers/staging/kpc2000/kpc_dma/fileops.c > index 5741d2b..66f0d5a 100644 > --- a/drivers/staging/kpc2000/kpc_dma/fileops.c > +++ b/drivers/staging/kpc2000/kpc_dma/fileops.c > @@ -38,6 +38,7 @@ int kpc_dma_transfer(struct dev_private_data *priv, struct > kiocb *kcb, unsigned > { > unsigned int i = 0; > long rv = 0; > + int ret = 0; This assignment is never used. It just turns static checking for uninitialized variable bugs. > struct kpc_dma_device *ldev; > struct aio_cb_data *acd; > DECLARE_COMPLETION_ONSTACK(done); > @@ -180,16 +181,17 @@ int kpc_dma_transfer(struct dev_private_data *priv, > struct kiocb *kcb, unsigned > > // If this is a synchronous kiocb, we need to put the calling process > to sleep until the transfer is complete > if (kcb == NULL || is_sync_kiocb(kcb)){ > - rv = wait_for_completion_interruptible(&done); > - // If the user aborted (rv == -ERESTARTSYS), we're no longer > responsible for cleaning up the acd > - if (rv == -ERESTARTSYS){ > + ret = wait_for_completion_interruptible(&done); > + /* If the user aborted (ret == -ERESTARTSYS), we're > + * no longer responsible for cleaning up the acd > + */ > + if (ret) { > acd->cpl = NULL; > - } > - if (rv == 0){ > - rv = acd->len; > + } else { > + ret = acd->len; "acd->len" is a size_t (unsigned long) so probably we should just change the type of kpc_dma_transfer to ssize_t actually. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: kpc2000: Fix a stack information leak in kp2000_cdev_ioctl()
The kp2000_regs struct has a 4 byte hole between ->hw_rev and ->ssid so this could leak stack information to the user. This patch just memsets the whole struct to zero. Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers") Signed-off-by: Dan Carpenter --- drivers/staging/kpc2000/kpc2000/fileops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/kpc2000/kpc2000/fileops.c b/drivers/staging/kpc2000/kpc2000/fileops.c index 4bfba59570e6..a6beca8dbac5 100644 --- a/drivers/staging/kpc2000/kpc2000/fileops.c +++ b/drivers/staging/kpc2000/kpc2000/fileops.c @@ -91,6 +91,8 @@ long kp2000_cdev_ioctl(struct file *filp, unsigned int ioctl_num, unsigned long case KP2000_IOCTL_GET_EVERYTHING: { struct kp2000_regs temp; int ret; + + memset(&temp, 0, sizeof(temp)); temp.card_id = pcard->card_id; temp.build_version = pcard->build_version; temp.build_datestamp = pcard->build_datestamp; -- 2.18.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: kpc2000: fix resource size calculation
The code is calculating the resource size wrong because it should be inclusive of the "res->end" address. In other words, "end - start + 1". We can just use the resource_size() function to do it correctly. Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers") Signed-off-by: Dan Carpenter --- drivers/staging/kpc2000/kpc_i2c/i2c_driver.c | 2 +- drivers/staging/kpc2000/kpc_spi/spi_driver.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/kpc2000/kpc_i2c/i2c_driver.c b/drivers/staging/kpc2000/kpc_i2c/i2c_driver.c index 6bb6ad4abe87..1fc30dc687f9 100644 --- a/drivers/staging/kpc2000/kpc_i2c/i2c_driver.c +++ b/drivers/staging/kpc2000/kpc_i2c/i2c_driver.c @@ -632,7 +632,7 @@ int pi2c_probe(struct platform_device *pldev) priv->adapter.algo = &smbus_algorithm; res = platform_get_resource(pldev, IORESOURCE_MEM, 0); -priv->smba = (unsigned long)ioremap_nocache(res->start, res->end - res->start); +priv->smba = (unsigned long)ioremap_nocache(res->start, resource_size(res)); priv->pldev = pldev; pldev->dev.platform_data = priv; diff --git a/drivers/staging/kpc2000/kpc_spi/spi_driver.c b/drivers/staging/kpc2000/kpc_spi/spi_driver.c index b38149b752fb..e568dec04800 100644 --- a/drivers/staging/kpc2000/kpc_spi/spi_driver.c +++ b/drivers/staging/kpc2000/kpc_spi/spi_driver.c @@ -452,7 +452,7 @@ kp_spi_probe(struct platform_device *pldev) goto free_master; } -kpspi->phys = (unsigned long)ioremap_nocache(r->start, r->end - r->start); +kpspi->phys = (unsigned long)ioremap_nocache(r->start, resource_size(r)); kpspi->base = (u64 __iomem *)kpspi->phys; status = spi_register_master(master); -- 2.18.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] dma-buf: add struct dma_buf_attach_info v2
Add a structure for the parameters of dma_buf_attach, this makes it much easier to add new parameters later on. v2: rebase cleanup and fix all new implementations as well Signed-off-by: Christian König --- drivers/dma-buf/dma-buf.c | 13 +++-- drivers/gpu/drm/armada/armada_gem.c | 6 +- drivers/gpu/drm/drm_prime.c | 6 +- drivers/gpu/drm/i915/i915_gem_dmabuf.c | 6 +- drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 6 +- drivers/gpu/drm/tegra/gem.c | 6 +- drivers/gpu/drm/udl/udl_dmabuf.c| 6 +- .../common/videobuf2/videobuf2-dma-contig.c | 6 +- .../media/common/videobuf2/videobuf2-dma-sg.c | 6 +- drivers/misc/fastrpc.c | 6 +- drivers/staging/media/tegra-vde/tegra-vde.c | 6 +- drivers/xen/gntdev-dmabuf.c | 4 include/linux/dma-buf.h | 17 +++-- 13 files changed, 76 insertions(+), 18 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 3ae6c0c2cc02..e295e76a8c57 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -535,8 +535,9 @@ EXPORT_SYMBOL_GPL(dma_buf_put); /** * dma_buf_attach - Add the device to dma_buf's attachments list; optionally, * calls attach() of dma_buf_ops to allow device-specific attach functionality - * @dmabuf:[in]buffer to attach device to. - * @dev: [in]device to be attached. + * @info: [in]holds all the attach related information provided + * by the importer. see &struct dma_buf_attach_info + * for further details. * * Returns struct dma_buf_attachment pointer for this attachment. Attachments * must be cleaned up by calling dma_buf_detach(). @@ -550,20 +551,20 @@ EXPORT_SYMBOL_GPL(dma_buf_put); * accessible to @dev, and cannot be moved to a more suitable place. This is * indicated with the error code -EBUSY. */ -struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, - struct device *dev) +struct dma_buf_attachment *dma_buf_attach(const struct dma_buf_attach_info *info) { + struct dma_buf *dmabuf = info->dmabuf; struct dma_buf_attachment *attach; int ret; - if (WARN_ON(!dmabuf || !dev)) + if (WARN_ON(!dmabuf || !info->dev)) return ERR_PTR(-EINVAL); attach = kzalloc(sizeof(*attach), GFP_KERNEL); if (!attach) return ERR_PTR(-ENOMEM); - attach->dev = dev; + attach->dev = info->dev; attach->dmabuf = dmabuf; mutex_lock(&dmabuf->lock); diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index 642d0e70d0f8..19c47821032f 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c @@ -501,6 +501,10 @@ armada_gem_prime_export(struct drm_device *dev, struct drm_gem_object *obj, struct drm_gem_object * armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) { + struct dma_buf_attach_info attach_info = { + .dev = dev->dev, + .dmabuf = buf + }; struct dma_buf_attachment *attach; struct armada_gem_object *dobj; @@ -516,7 +520,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) } } - attach = dma_buf_attach(buf, dev->dev); + attach = dma_buf_attach(&attach_info); if (IS_ERR(attach)) return ERR_CAST(attach); diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index dc079efb3b0f..1dd70fc095ee 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -710,6 +710,10 @@ struct drm_gem_object *drm_gem_prime_import_dev(struct drm_device *dev, struct dma_buf *dma_buf, struct device *attach_dev) { + struct dma_buf_attach_info attach_info = { + .dev = attach_dev, + .dmabuf = dma_buf + }; struct dma_buf_attachment *attach; struct sg_table *sgt; struct drm_gem_object *obj; @@ -730,7 +734,7 @@ struct drm_gem_object *drm_gem_prime_import_dev(struct drm_device *dev, if (!dev->driver->gem_prime_import_sg_table) return ERR_PTR(-EINVAL); - attach = dma_buf_attach(dma_buf, attach_dev); + attach = dma_buf_attach(&attach_info); if (IS_ERR(attach)) return ERR_CAST(attach); diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c index 5a101a9462d8..978054157c64 100644 --- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c @@ -277,6 +277,10 @@ static const struct drm_i915_gem_object_ops i915_gem_object_dmabuf_op
Re: [PATCH] staging: most: sound: pass correct device when creating a sound card
On Di, 2019-04-30 at 11:20 +0200, Greg KH wrote: > External E-Mail > > > On Tue, Apr 30, 2019 at 11:00:22AM +0200, Christian Gromm wrote: > > > > This patch fixes the usage of the wrong struct device when calling > > function snd_card_new. > > > > Reported-by: Eugeniu Rosca > > Signed-off-by: Christian Gromm > > --- > > drivers/staging/most/sound/sound.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > Does this fix a specific commit? If so, should there be a "Fixes: " > tag > in the s-o-b: area? Does this need to go to the stable trees? Yes, yes and yes. I'll be sending a v2 shortly. I wasn't aware that I need to refer to a certain commit when fixing things up. How can bugfix patches not fix a specific commit anyway? The bugs must have gotten in somehow, right? thanks, Chris > > thanks, > > greg k-h > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-de > vel > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: most: sound: pass correct device when creating a sound card
This patch fixes the usage of the wrong struct device when calling function snd_card_new. Reported-by: Eugeniu Rosca Signed-off-by: Christian Gromm Fixes: commit 69c90cf1b2faf5fa08fe5e18e4b47b044474506e --- v2: add Fixes tag to s-o-b area drivers/staging/most/sound/sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 7c99867..342f390 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -613,7 +613,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, INIT_LIST_HEAD(&adpt->dev_list); iface->priv = adpt; list_add_tail(&adpt->list, &adpt_list); - ret = snd_card_new(&iface->dev, -1, "INIC", THIS_MODULE, + ret = snd_card_new(iface->driver_dev, -1, "INIC", THIS_MODULE, sizeof(*channel), &adpt->card); if (ret < 0) goto err_free_adpt; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: sound: pass correct device when creating a sound card
On Tue, Apr 30, 2019 at 11:53:01AM +, christian.gr...@microchip.com wrote: > On Di, 2019-04-30 at 11:20 +0200, Greg KH wrote: > > External E-Mail > > > > > > On Tue, Apr 30, 2019 at 11:00:22AM +0200, Christian Gromm wrote: > > > > > > This patch fixes the usage of the wrong struct device when calling > > > function snd_card_new. > > > > > > Reported-by: Eugeniu Rosca > > > Signed-off-by: Christian Gromm > > > --- > > > drivers/staging/most/sound/sound.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > Does this fix a specific commit? If so, should there be a "Fixes: " > > tag > > in the s-o-b: area? Does this need to go to the stable trees? > > Yes, yes and yes. I'll be sending a v2 shortly. > > I wasn't aware that I need to refer to a certain commit when fixing > things up. How can bugfix patches not fix a specific commit anyway? > The bugs must have gotten in somehow, right? Yes, they must have snuck in somehow :) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: most: sound: pass correct device when creating a sound card
On Tue, Apr 30, 2019 at 02:07:48PM +0200, Christian Gromm wrote: > This patch fixes the usage of the wrong struct device when calling > function snd_card_new. > > Reported-by: Eugeniu Rosca > Signed-off-by: Christian Gromm > Fixes:commit 69c90cf1b2faf5fa08fe5e18e4b47b044474506e Nit, the proper format for this would be: Fixes: 69c90cf1b2fa ("staging: most: sound: call snd_card_new with struct device") and that can be gotten with this git line: git show -s --abbrev-commit --abbrev=12 --pretty=format:"Fixes: %h (\"%s\")%n" I think it's documented somewhere in Documentation... Anyway, I'll fix this up when applying it, thanks. Also, I'll tag it for stable backports, as it should go back to 4.18+ thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: use proper return type for wait_for_completion_timeout
On Tue, Apr 30, 2019 at 12:58:21PM +0300, Dan Carpenter wrote: > On Sat, Apr 27, 2019 at 05:27:25AM +0200, Nicholas Mc Guire wrote: > > wait_for_completion_timeout() returns unsigned long (0 on timeout or > > remaining jiffies) not int. > > > > Yeah, but it's fine though because 1 / 256 fits into int without a > problem. > > I'm not sure this sort of patch is worth it when it's just a style > debate instead of a bugfix. I'm a little bit torn about this. In > Smatch, I run into this issue one in a while where Smatch doesn't know > if the timeout is less than int. Right now I hacked the DB to say that > these functions always return < INT_MAX. > > Anyway, for sure the commit message should say that it's just a cleanup > and not a bugfix. > I know its not a functional bug its "only" an API violation - the problem is more that code is often cut&past and at some point it may be a problem or someoe expects a negative return value without that this evef can occure. But yes - the commit message should have stated that this non-conformance in this case has no effect - will resend. thx! hofrat ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: vc04_services: bcm2835-camera: Modify return statement.
On Mon, Apr 29, 2019 at 01:06:58PM +0530, Vatsala Narang wrote: > Modify return statement and remove the respective assignment. > > Issue found by coccinelle. > > Signed-off-by: Vatsala Narang > --- > drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) You sent two different patches that did different things with the same exact subject: line :( Please make them more unique. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation
On Tue, Apr 30, 2019 at 12:19 AM Al Viro wrote: > > ... not that there's much sense keeping ->fieldbus_type in host-endian, > while we are at it. Interesting! Suppose we make device->fieldbus_type bus-endian. Then the endinan-ness conversion either needs to happen in bus_match() (and we'd have to convert endianness each time this function is called). Or, we make driver->fieldbus_type bus-endian also, then there is no need for conversion... but the driver writer has to remember to specify this in bus endianness: static struct anybuss_client_driver profinet_driver = { .probe = ..., .fieldbus_type = endian convert?? (0x0089), }; Which pushes bus implementation details onto the client driver writer? Also, how to convert a constant to a specific endianness in a static initializer? You never make a remark without good reason, so what am I overlooking? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation
On Tue, Apr 30, 2019 at 09:32:20AM -0400, Sven Van Asbroeck wrote: > On Tue, Apr 30, 2019 at 12:19 AM Al Viro wrote: > > > > ... not that there's much sense keeping ->fieldbus_type in host-endian, > > while we are at it. > > Interesting! Suppose we make device->fieldbus_type bus-endian. Keep it bus-endian, as that's the "normal" way bus structures work (like PCI and USB for example), and that should be in a documented, and consistent, form, right? Then do the conversion when you access the field from within the kernel. Again, examples of USB and PCI can be used if you want to copy what they do. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation
On Tue, Apr 30, 2019 at 10:03 AM Greg Kroah-Hartman wrote: > > Keep it bus-endian, as that's the "normal" way bus structures work (like > PCI and USB for example), and that should be in a documented, and > consistent, form, right? > > Then do the conversion when you access the field from within the kernel. Ah ok, it's like a standard way of implementing a bus. Sounds good, I'll spin a patch to conform to it. And while I'm at it, I'll rename fieldbus_type because it can be confused with another fieldbus_type within the fieldbus_dev core. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation
On Tue, Apr 30, 2019 at 10:22 AM Sven Van Asbroeck wrote: > > Ah ok, it's like a standard way of implementing a bus. Sounds good, I'll > spin a patch to conform to it. And while I'm at it, I'll rename fieldbus_type > because it can be confused with another fieldbus_type within the > fieldbus_dev core. Nicholas, this future patch will silence sparse. So you can drop the patch you proposed at the beginning of this email thread. Thanks for your help, really appreciate it. Sven ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation
On Tue, Apr 30, 2019 at 09:32:20AM -0400, Sven Van Asbroeck wrote: > On Tue, Apr 30, 2019 at 12:19 AM Al Viro wrote: > > > > ... not that there's much sense keeping ->fieldbus_type in host-endian, > > while we are at it. > > Interesting! Suppose we make device->fieldbus_type bus-endian. > Then the endinan-ness conversion either needs to happen in > bus_match() (and we'd have to convert endianness each time > this function is called). > Or, we make driver->fieldbus_type bus-endian also, then there > is no need for conversion... but the driver writer has to remember > to specify this in bus endianness: > > static struct anybuss_client_driver profinet_driver = { > .probe = ..., > .fieldbus_type = endian convert?? (0x0089), > }; > > Which pushes bus implementation details onto the > client driver writer? Also, how to convert a constant > to a specific endianness in a static initializer? cpu_to_be16() or htons() - either will be fine there. On little-endian you'll get htons(0x0089) => ___htons(0x0089) => __cpu_to_be16(0x0089) => ((__force __be16)__swab16((0x0089))) => ((__be16)(__builtin_constant_p((__u16)((0x0089))) ? ___constant_swab16((0x0089)) : __fswab16((0x0089))) => ((__be16)(__builtin_constant_p((__u16)((0x0089))) ? ((__u16)__u16)((0x0089)) & (__u16)0x00ffU) << 8) | (((__u16)((0x0089)) & (__u16)0xff00U) >> 8))) : __fswab16((0x0089))) and once the preprocessor has produced that, from compiler POV we have a constant expression as argument of __builtin_constant_p(), so it evaluates as true, reducing the whole thing to ((__be16)(((__u16)__u16)((0x0089)) & (__u16)0x00ffU) << 8) | (((__u16)((0x0089)) & (__u16)0xff00U) >> 8))) ) i.e. (__be16)0x8900. On big-endian expansion will be different, resulting in (__be16)0x0089... IOW, you can use endianness convertors in static initializers; things like struct sockaddr_in addr = {.sin_addr.s_addr = htonl(0x7f01), .sin_port = htons(25), .sin_family = AF_INET}; are fine kernel-side (from the compiler POV, that is - something trying to speak SMTP in the kernel code would obviously be a bad sign). As for having to remember - sparse will complain about endianness mismatches in initializer... ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Intel-gfx] [PATCH] dma-buf: add struct dma_buf_attach_info v2
Hi "Christian, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.1-rc7 next-20190429] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Christian-K-nig/dma-buf-add-struct-dma_buf_attach_info-v2/20190430-221017 config: xtensa-allyesconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 8.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=8.1.0 make.cross ARCH=xtensa If you fix the issue, kindly add following tag Reported-by: kbuild test robot All errors (new ones prefixed by >>): drivers/staging/media/tegra-vde/tegra-vde.c: In function 'tegra_vde_attach_dmabuf': >> drivers/staging/media/tegra-vde/tegra-vde.c:573:13: error: 'dmabuf' >> undeclared (first use in this function); did you mean 'dma_buf'? .dmabuf = dmabuf ^~ dma_buf drivers/staging/media/tegra-vde/tegra-vde.c:573:13: note: each undeclared identifier is reported only once for each function it appears in vim +573 drivers/staging/media/tegra-vde/tegra-vde.c 559 560 static int tegra_vde_attach_dmabuf(struct device *dev, 561 int fd, 562 unsigned long offset, 563 size_t min_size, 564 size_t align_size, 565 struct dma_buf_attachment **a, 566 dma_addr_t *addr, 567 struct sg_table **s, 568 size_t *size, 569 enum dma_data_direction dma_dir) 570 { 571 struct dma_buf_attach_info attach_info = { 572 .dev = dev, > 573 .dmabuf = dmabuf 574 }; 575 struct dma_buf_attachment *attachment; 576 struct dma_buf *dmabuf; 577 struct sg_table *sgt; 578 int err; 579 580 dmabuf = dma_buf_get(fd); 581 if (IS_ERR(dmabuf)) { 582 dev_err(dev, "Invalid dmabuf FD\n"); 583 return PTR_ERR(dmabuf); 584 } 585 586 if (dmabuf->size & (align_size - 1)) { 587 dev_err(dev, "Unaligned dmabuf 0x%zX, should be aligned to 0x%zX\n", 588 dmabuf->size, align_size); 589 return -EINVAL; 590 } 591 592 if ((u64)offset + min_size > dmabuf->size) { 593 dev_err(dev, "Too small dmabuf size %zu @0x%lX, should be at least %zu\n", 594 dmabuf->size, offset, min_size); 595 return -EINVAL; 596 } 597 598 attachment = dma_buf_attach(&attach_info); 599 if (IS_ERR(attachment)) { 600 dev_err(dev, "Failed to attach dmabuf\n"); 601 err = PTR_ERR(attachment); 602 goto err_put; 603 } 604 605 sgt = dma_buf_map_attachment(attachment, dma_dir); 606 if (IS_ERR(sgt)) { 607 dev_err(dev, "Failed to get dmabufs sg_table\n"); 608 err = PTR_ERR(sgt); 609 goto err_detach; 610 } 611 612 if (sgt->nents != 1) { 613 dev_err(dev, "Sparse DMA region is unsupported\n"); 614 err = -EINVAL; 615 goto err_unmap; 616 } 617 618 *addr = sg_dma_address(sgt->sgl) + offset; 619 *a = attachment; 620 *s = sgt; 621 622 if (size) 623 *size = dmabuf->size - offset; 624 625 return 0; 626 627 err_unmap: 628 dma_buf_unmap_attachment(attachment, sgt, dma_dir); 629 err_detach: 630 dma_buf_detach(dmabuf, attachment); 631 err_put: 632 dma_buf_put(dmabuf); 633 634 return err; 635 } 636 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] greybus: audio_manager: fix a missing check of ida_simple_get
On Fri, Mar 15, 2019 at 10:49:46AM +0530, Vaibhav Agarwal wrote: > On Thu, Mar 14, 2019 at 12:15 PM Kangjie Lu wrote: > > > > ida_simple_get could fail. The fix inserts a check for its > > return value. > > > > Signed-off-by: Kangjie Lu > > --- > > drivers/staging/greybus/audio_manager.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/staging/greybus/audio_manager.c > > b/drivers/staging/greybus/audio_manager.c > > index d44b070d8862..c2a4af4c1d06 100644 > > --- a/drivers/staging/greybus/audio_manager.c > > +++ b/drivers/staging/greybus/audio_manager.c > > @@ -45,6 +45,9 @@ int gb_audio_manager_add(struct > > gb_audio_manager_module_descriptor *desc) > > int err; > > > > id = ida_simple_get(&module_id, 0, 0, GFP_KERNEL); > > + if (id < 0) > > + return id; > > + > > err = gb_audio_manager_module_create(&module, manager_kset, > > id, desc); > > if (err) { > > Reviewed-by: Vaibhav Agarwal I am sorry for not responding until now. For some strange reason, email from this list are being delayed. I just got this today (April 30). Thanks for the patch, Kangjie, and thanks for the review, Vaibhav. And FWIW, Reviewed-by: Mark Greer Mark -- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] dma-buf: add struct dma_buf_attach_info v2
On 4/30/19 7:10 AM, Christian König wrote: > diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c > index 2c4f324f8626..cacca830b482 100644 > --- a/drivers/xen/gntdev-dmabuf.c > +++ b/drivers/xen/gntdev-dmabuf.c > @@ -608,6 +608,7 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, > struct device *dev, > int fd, int count, int domid) > { > struct gntdev_dmabuf *gntdev_dmabuf, *ret; > + struct dma_buf_attach_info attach_info; > struct dma_buf *dma_buf; > struct dma_buf_attachment *attach; > struct sg_table *sgt; > @@ -627,6 +628,9 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, > struct device *dev, > gntdev_dmabuf->priv = priv; > gntdev_dmabuf->fd = fd; > > + memset(&attach_info, 0, sizeof(attach_info)); > + attach_info.dev = dev; > + attach_info.dmabuf = dma_buf; > attach = dma_buf_attach(dma_buf, dev); > if (IS_ERR(attach)) { > ret = ERR_CAST(attach); This won't build. Did you mean attach = dma_buf_attach(&attach_info); ? -boris ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] dma-buf: add struct dma_buf_attach_info v2
On Tue, Apr 30, 2019 at 01:10:02PM +0200, Christian König wrote: > Add a structure for the parameters of dma_buf_attach, this makes it much > easier > to add new parameters later on. I don't understand this reasoning. What are the "new parameters" that are being proposed, and why do we need to put them into memory to pass them across this interface? If the intention is to make it easier to change the interface, passing parameters in this manner mean that it's easy for the interface to change and drivers not to notice the changes, since the compiler will not warn (unless some member of the structure that the driver is using gets removed, in which case it will error.) Additions to the structure will go unnoticed by drivers - what if the caller is expecting some different kind of behaviour, and the driver ignores that new addition? This doesn't seem to me like a good idea. > > v2: rebase cleanup and fix all new implementations as well > > Signed-off-by: Christian König > --- > drivers/dma-buf/dma-buf.c | 13 +++-- > drivers/gpu/drm/armada/armada_gem.c | 6 +- > drivers/gpu/drm/drm_prime.c | 6 +- > drivers/gpu/drm/i915/i915_gem_dmabuf.c | 6 +- > drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 6 +- > drivers/gpu/drm/tegra/gem.c | 6 +- > drivers/gpu/drm/udl/udl_dmabuf.c| 6 +- > .../common/videobuf2/videobuf2-dma-contig.c | 6 +- > .../media/common/videobuf2/videobuf2-dma-sg.c | 6 +- > drivers/misc/fastrpc.c | 6 +- > drivers/staging/media/tegra-vde/tegra-vde.c | 6 +- > drivers/xen/gntdev-dmabuf.c | 4 > include/linux/dma-buf.h | 17 +++-- > 13 files changed, 76 insertions(+), 18 deletions(-) > > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c > index 3ae6c0c2cc02..e295e76a8c57 100644 > --- a/drivers/dma-buf/dma-buf.c > +++ b/drivers/dma-buf/dma-buf.c > @@ -535,8 +535,9 @@ EXPORT_SYMBOL_GPL(dma_buf_put); > /** > * dma_buf_attach - Add the device to dma_buf's attachments list; optionally, > * calls attach() of dma_buf_ops to allow device-specific attach > functionality > - * @dmabuf: [in]buffer to attach device to. > - * @dev: [in]device to be attached. > + * @info:[in]holds all the attach related information provided > + * by the importer. see &struct dma_buf_attach_info > + * for further details. > * > * Returns struct dma_buf_attachment pointer for this attachment. Attachments > * must be cleaned up by calling dma_buf_detach(). > @@ -550,20 +551,20 @@ EXPORT_SYMBOL_GPL(dma_buf_put); > * accessible to @dev, and cannot be moved to a more suitable place. This is > * indicated with the error code -EBUSY. > */ > -struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, > - struct device *dev) > +struct dma_buf_attachment *dma_buf_attach(const struct dma_buf_attach_info > *info) > { > + struct dma_buf *dmabuf = info->dmabuf; > struct dma_buf_attachment *attach; > int ret; > > - if (WARN_ON(!dmabuf || !dev)) > + if (WARN_ON(!dmabuf || !info->dev)) > return ERR_PTR(-EINVAL); > > attach = kzalloc(sizeof(*attach), GFP_KERNEL); > if (!attach) > return ERR_PTR(-ENOMEM); > > - attach->dev = dev; > + attach->dev = info->dev; > attach->dmabuf = dmabuf; > > mutex_lock(&dmabuf->lock); > diff --git a/drivers/gpu/drm/armada/armada_gem.c > b/drivers/gpu/drm/armada/armada_gem.c > index 642d0e70d0f8..19c47821032f 100644 > --- a/drivers/gpu/drm/armada/armada_gem.c > +++ b/drivers/gpu/drm/armada/armada_gem.c > @@ -501,6 +501,10 @@ armada_gem_prime_export(struct drm_device *dev, struct > drm_gem_object *obj, > struct drm_gem_object * > armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) > { > + struct dma_buf_attach_info attach_info = { > + .dev = dev->dev, > + .dmabuf = buf > + }; > struct dma_buf_attachment *attach; > struct armada_gem_object *dobj; > > @@ -516,7 +520,7 @@ armada_gem_prime_import(struct drm_device *dev, struct > dma_buf *buf) > } > } > > - attach = dma_buf_attach(buf, dev->dev); > + attach = dma_buf_attach(&attach_info); > if (IS_ERR(attach)) > return ERR_CAST(attach); > > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c > index dc079efb3b0f..1dd70fc095ee 100644 > --- a/drivers/gpu/drm/drm_prime.c > +++ b/drivers/gpu/drm/drm_prime.c > @@ -710,6 +710,10 @@ struct drm_gem_object *drm_gem_prime_import_dev(struct > drm_device *dev, > struct dma_buf *dma_buf, > struct device *attach_dev) > { > +
[PATCH] staging: rtl8192u: ieee80211: Resolve ERROR reported by checkpatch
This patch resolves coding style space ERRORs reported by checkpatch ERROR: spaces required around that '>' (ctx:VxV) ERROR: space required after that ',' (ctx:VxO) ERROR: space required before that '&' (ctx:OxV) ERROR: spaces required around that '!=' (ctx:VxV) ERROR: spaces required around that '=' (ctx:VxW) ERROR: space required before the open parenthesis '(' ERROR: spaces required around that '?' (ctx:VxE) ERROR: spaces required around that ':' (ctx:VxE) ERROR: spaces required around that '==' (ctx:VxV) Signed-off-by: Vandana BN --- .../rtl8192u/ieee80211/rtl819x_TSProc.c | 40 +-- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index 418c92403904..7cac668bfb0b 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -63,7 +63,7 @@ static void RxPktPendingTimeout(struct timer_list *t) } } - if (index>0) { + if (index > 0) { // Set rx_timeout_indicate_seq to 0x to indicate no pending packets in buffer now. pRxTs->rx_timeout_indicate_seq = 0x; @@ -182,7 +182,7 @@ void TSInitialize(struct ieee80211_device *ieee) INIT_LIST_HEAD(&ieee->RxReorder_Unused_List); //#ifdef TO_DO_LIST for (count = 0; count < REORDER_ENTRY_NUM; count++) { - list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List); + list_add_tail(&pRxReorderEntry->List, &ieee->RxReorder_Unused_List); if (count == (REORDER_ENTRY_NUM-1)) break; pRxReorderEntry = &ieee->RxReorderEntry[count+1]; @@ -196,7 +196,7 @@ static void AdmitTS(struct ieee80211_device *ieee, del_timer_sync(&pTsCommonInfo->setup_timer); del_timer_sync(&pTsCommonInfo->inact_timer); - if (InactTime!=0) + if (InactTime != 0) mod_timer(&pTsCommonInfo->inact_timer, jiffies + msecs_to_jiffies(InactTime)); } @@ -214,25 +214,25 @@ static struct ts_common_info *SearchAdmitTRStream(struct ieee80211_device *ieee, if (ieee->iw_mode == IW_MODE_MASTER) { //ap mode if (TxRxSelect == TX_DIR) { search_dir[DIR_DOWN] = true; - search_dir[DIR_BI_DIR]= true; + search_dir[DIR_BI_DIR] = true; } else { search_dir[DIR_UP] = true; - search_dir[DIR_BI_DIR]= true; + search_dir[DIR_BI_DIR] = true; } } else if (ieee->iw_mode == IW_MODE_ADHOC) { - if(TxRxSelect == TX_DIR) + if (TxRxSelect == TX_DIR) search_dir[DIR_UP] = true; else search_dir[DIR_DOWN] = true; } else { if (TxRxSelect == TX_DIR) { search_dir[DIR_UP] = true; - search_dir[DIR_BI_DIR]= true; - search_dir[DIR_DIRECT]= true; + search_dir[DIR_BI_DIR] = true; + search_dir[DIR_DIRECT] = true; } else { search_dir[DIR_DOWN] = true; - search_dir[DIR_BI_DIR]= true; - search_dir[DIR_DIRECT]= true; + search_dir[DIR_BI_DIR] = true; + search_dir[DIR_DIRECT] = true; } } @@ -357,20 +357,20 @@ bool GetTs( struct tspec_body TSpec; struct qos_tsinfo *pTSInfo = &TSpec.ts_info; struct list_head*pUnusedList = - (TxRxSelect == TX_DIR)? - (&ieee->Tx_TS_Unused_List): + (TxRxSelect == TX_DIR) ? + (&ieee->Tx_TS_Unused_List) : (&ieee->Rx_TS_Unused_List); struct list_head*pAddmitList = - (TxRxSelect == TX_DIR)? - (&ieee->Tx_TS_Admit_List): + (TxRxSelect == TX_DIR) ? + (&ieee->Tx_TS_Admit_List) : (&ieee->Rx_TS_Admit_List); - enum direction_valueDir = (ieee->iw_mode == IW_MODE_MASTER)? -
Re: [PATCH v2 1/8] media: staging/imx: Switch to sync registration for IPU subdevs
Hi Steve, On Sun 28 Apr 2019 at 20:09, Steve Longerbeam wrote: > Because the IPU sub-devices VDIC and IC are not present in the > device-tree, platform devices were created for them instead. This > allowed these sub-devices to be added to the media device's async > notifier and registered asynchronously along with the other > sub-devices that do have a device-tree presence (CSI and devices > external to the IPU and SoC). > > But that approach isn't really necessary. The IPU sub-devices don't > actually require a backing device (sd->dev is allowed to be NULL). > And that approach can't get around the fact that the IPU sub-devices > are not part of a device hierarchy, which makes it awkward to retrieve > the parent IPU of these devices. > > By registering them synchronously, they can be registered from the CSI > async bound notifier, so the init function for them can be given the CSI > subdev, who's dev->parent is the IPU. That is a somewhat cleaner way > to retrieve the parent IPU. > > So convert to synchronous registration for the VDIC and IC task > sub-devices, at the time a CSI sub-device is bound. There is no longer > a backing device for them (sd->dev is NULL), but that's ok. Also > set the VDIC/IC sub-device owner as the IPU, so that a reference can > be taken on the IPU module. > > Signed-off-by: Steve Longerbeam I am trying to bisect when my capture starts to fail to work with this series, since they are so many changes and reorg that I got lost on some of them. But... see below. > --- > drivers/staging/media/imx/imx-ic-common.c | 70 ++-- > drivers/staging/media/imx/imx-ic-prp.c| 34 +- > drivers/staging/media/imx/imx-ic-prpencvf.c | 70 ++-- > drivers/staging/media/imx/imx-ic.h| 7 +- > drivers/staging/media/imx/imx-media-capture.c | 7 +- > drivers/staging/media/imx/imx-media-csi.c | 2 +- > drivers/staging/media/imx/imx-media-dev.c | 121 +- > .../staging/media/imx/imx-media-internal-sd.c | 356 -- > drivers/staging/media/imx/imx-media-of.c | 38 +- > drivers/staging/media/imx/imx-media-vdic.c| 85 ++--- > drivers/staging/media/imx/imx-media.h | 67 ++-- > drivers/staging/media/imx/imx7-media-csi.c| 3 +- > 12 files changed, 325 insertions(+), 535 deletions(-) > > + dev_dbg(priv->ipu_dev, "%s: link setup %s -> %s", > + sd->name, remote->entity->name, local->entity->name); > > mutex_lock(&priv->lock); > > @@ -864,9 +856,6 @@ static int vdic_registered(struct v4l2_subdev *sd) > int i, ret; > u32 code; > > - /* get media device */ > - priv->md = dev_get_drvdata(sd->v4l2_dev->dev); > - > for (i = 0; i < VDIC_NUM_PADS; i++) { > priv->pad[i].flags = (i == VDIC_SRC_PAD_DIRECT) ? > MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK; > @@ -938,77 +927,55 @@ static const struct v4l2_subdev_internal_ops > vdic_internal_ops = { > .unregistered = vdic_unregistered, > }; > > -static int imx_vdic_probe(struct platform_device *pdev) > +struct v4l2_subdev *imx_media_vdic_register(struct imx_media_dev *imxmd, > + struct device *ipu_dev, > + struct ipu_soc *ipu, > + u32 grp_id) > { > - struct imx_media_ipu_internal_sd_pdata *pdata; > + struct v4l2_device *v4l2_dev = &imxmd->v4l2_dev; > struct vdic_priv *priv; > int ret; > > - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); > + priv = devm_kzalloc(ipu_dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > - return -ENOMEM; > + return ERR_PTR(-ENOMEM); > > - platform_set_drvdata(pdev, &priv->sd); > - priv->dev = &pdev->dev; > - > - pdata = priv->dev->platform_data; > - priv->ipu_id = pdata->ipu_id; > + priv->ipu_dev = ipu_dev; > + priv->ipu = ipu; > + priv->md = imxmd; > > v4l2_subdev_init(&priv->sd, &vdic_subdev_ops); > v4l2_set_subdevdata(&priv->sd, priv); > priv->sd.internal_ops = &vdic_internal_ops; > priv->sd.entity.ops = &vdic_entity_ops; > priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; > - priv->sd.dev = &pdev->dev; > - priv->sd.owner = THIS_MODULE; > + priv->sd.owner = ipu_dev->driver->owner; > priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE; > - /* get our group id */ > - priv->sd.grp_id = pdata->grp_id; > - strscpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name)); > + priv->sd.grp_id = grp_id; > + imx_media_grp_id_to_sd_name(priv->sd.name, sizeof(priv->sd.name), > + priv->sd.grp_id, ipu_get_num(ipu)); > > mutex_init(&priv->lock); > > - ret = v4l2_async_register_subdev(&priv->sd); > + ret = v4l2_device_register_subdev(v4l2_dev, &priv->sd); > if (ret) > goto free; > > - return 0; > + return &priv-
Re: [PATCH v2 1/8] media: staging/imx: Switch to sync registration for IPU subdevs
Thanks Rui for catching the bisect problem, I will fix for v3. Steve On 4/30/19 2:56 PM, Rui Miguel Silva wrote: Hi Steve, On Sun 28 Apr 2019 at 20:09, Steve Longerbeam wrote: Because the IPU sub-devices VDIC and IC are not present in the device-tree, platform devices were created for them instead. This allowed these sub-devices to be added to the media device's async notifier and registered asynchronously along with the other sub-devices that do have a device-tree presence (CSI and devices external to the IPU and SoC). But that approach isn't really necessary. The IPU sub-devices don't actually require a backing device (sd->dev is allowed to be NULL). And that approach can't get around the fact that the IPU sub-devices are not part of a device hierarchy, which makes it awkward to retrieve the parent IPU of these devices. By registering them synchronously, they can be registered from the CSI async bound notifier, so the init function for them can be given the CSI subdev, who's dev->parent is the IPU. That is a somewhat cleaner way to retrieve the parent IPU. So convert to synchronous registration for the VDIC and IC task sub-devices, at the time a CSI sub-device is bound. There is no longer a backing device for them (sd->dev is NULL), but that's ok. Also set the VDIC/IC sub-device owner as the IPU, so that a reference can be taken on the IPU module. Signed-off-by: Steve Longerbeam I am trying to bisect when my capture starts to fail to work with this series, since they are so many changes and reorg that I got lost on some of them. But... see below. --- drivers/staging/media/imx/imx-ic-common.c | 70 ++-- drivers/staging/media/imx/imx-ic-prp.c| 34 +- drivers/staging/media/imx/imx-ic-prpencvf.c | 70 ++-- drivers/staging/media/imx/imx-ic.h| 7 +- drivers/staging/media/imx/imx-media-capture.c | 7 +- drivers/staging/media/imx/imx-media-csi.c | 2 +- drivers/staging/media/imx/imx-media-dev.c | 121 +- .../staging/media/imx/imx-media-internal-sd.c | 356 -- drivers/staging/media/imx/imx-media-of.c | 38 +- drivers/staging/media/imx/imx-media-vdic.c| 85 ++--- drivers/staging/media/imx/imx-media.h | 67 ++-- drivers/staging/media/imx/imx7-media-csi.c| 3 +- 12 files changed, 325 insertions(+), 535 deletions(-) + dev_dbg(priv->ipu_dev, "%s: link setup %s -> %s", + sd->name, remote->entity->name, local->entity->name); mutex_lock(&priv->lock); @@ -864,9 +856,6 @@ static int vdic_registered(struct v4l2_subdev *sd) int i, ret; u32 code; - /* get media device */ - priv->md = dev_get_drvdata(sd->v4l2_dev->dev); - for (i = 0; i < VDIC_NUM_PADS; i++) { priv->pad[i].flags = (i == VDIC_SRC_PAD_DIRECT) ? MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK; @@ -938,77 +927,55 @@ static const struct v4l2_subdev_internal_ops vdic_internal_ops = { .unregistered = vdic_unregistered, }; -static int imx_vdic_probe(struct platform_device *pdev) +struct v4l2_subdev *imx_media_vdic_register(struct imx_media_dev *imxmd, + struct device *ipu_dev, + struct ipu_soc *ipu, + u32 grp_id) { - struct imx_media_ipu_internal_sd_pdata *pdata; + struct v4l2_device *v4l2_dev = &imxmd->v4l2_dev; struct vdic_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(ipu_dev, sizeof(*priv), GFP_KERNEL); if (!priv) - return -ENOMEM; + return ERR_PTR(-ENOMEM); - platform_set_drvdata(pdev, &priv->sd); - priv->dev = &pdev->dev; - - pdata = priv->dev->platform_data; - priv->ipu_id = pdata->ipu_id; + priv->ipu_dev = ipu_dev; + priv->ipu = ipu; + priv->md = imxmd; v4l2_subdev_init(&priv->sd, &vdic_subdev_ops); v4l2_set_subdevdata(&priv->sd, priv); priv->sd.internal_ops = &vdic_internal_ops; priv->sd.entity.ops = &vdic_entity_ops; priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; - priv->sd.dev = &pdev->dev; - priv->sd.owner = THIS_MODULE; + priv->sd.owner = ipu_dev->driver->owner; priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE; - /* get our group id */ - priv->sd.grp_id = pdata->grp_id; - strscpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name)); + priv->sd.grp_id = grp_id; + imx_media_grp_id_to_sd_name(priv->sd.name, sizeof(priv->sd.name), + priv->sd.grp_id, ipu_get_num(ipu)); mutex_init(&priv->lock); - ret = v4l2_async_register_subdev(&priv->sd); + ret = v4l2_device_register_subdev(v4l2_dev, &priv->sd); if (ret) goto free; - return 0; + return &priv->sd;
Re: [PATCH v2 4/8] Revert "media: imx: Set capture compose rectangle in capture_device_set_format"
Hi Steve, On Sun 28 Apr 2019 at 20:09, Steve Longerbeam wrote: > Rvert this commit, as imx_media_capture_device_set_format() will be > removed. > > This reverts commit 5964cbd8692252615370b77eb96764dd70c2f837. > > Signed-off-by: Steve Longerbeam > --- > drivers/staging/media/imx/imx-ic-prpencvf.c | 5 ++-- > drivers/staging/media/imx/imx-media-capture.c | 24 +-- > drivers/staging/media/imx/imx-media-csi.c | 5 ++-- > drivers/staging/media/imx/imx-media-utils.c | 20 > drivers/staging/media/imx/imx-media.h | 6 ++--- > 5 files changed, 23 insertions(+), 37 deletions(-) > > diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c > b/drivers/staging/media/imx/imx-ic-prpencvf.c > index 8242d88dfb82..afaa3a8b15e9 100644 > --- a/drivers/staging/media/imx/imx-ic-prpencvf.c > +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c > @@ -910,7 +910,6 @@ static int prp_set_fmt(struct v4l2_subdev *sd, > const struct imx_media_pixfmt *cc; > struct v4l2_pix_format vdev_fmt; > struct v4l2_mbus_framefmt *fmt; > - struct v4l2_rect vdev_compose; > int ret = 0; > > if (sdformat->pad >= PRPENCVF_NUM_PADS) > @@ -952,11 +951,11 @@ static int prp_set_fmt(struct v4l2_subdev *sd, > priv->cc[sdformat->pad] = cc; > > /* propagate output pad format to capture device */ > - imx_media_mbus_fmt_to_pix_fmt(&vdev_fmt, &vdev_compose, > + imx_media_mbus_fmt_to_pix_fmt(&vdev_fmt, > &priv->format_mbus[PRPENCVF_SRC_PAD], > priv->cc[PRPENCVF_SRC_PAD]); > mutex_unlock(&priv->lock); > - imx_media_capture_device_set_format(vdev, &vdev_fmt, &vdev_compose); > + imx_media_capture_device_set_format(vdev, &vdev_fmt); > > return 0; > out: > diff --git a/drivers/staging/media/imx/imx-media-capture.c > b/drivers/staging/media/imx/imx-media-capture.c > index 335084a6b0cd..555f6204660b 100644 > --- a/drivers/staging/media/imx/imx-media-capture.c > +++ b/drivers/staging/media/imx/imx-media-capture.c > @@ -205,8 +205,7 @@ static int capture_g_fmt_vid_cap(struct file *file, void > *fh, > > static int __capture_try_fmt_vid_cap(struct capture_priv *priv, >struct v4l2_subdev_format *fmt_src, > - struct v4l2_format *f, > - struct v4l2_rect *compose) > + struct v4l2_format *f) > { > const struct imx_media_pixfmt *cc, *cc_src; > > @@ -246,8 +245,7 @@ static int __capture_try_fmt_vid_cap(struct capture_priv > *priv, > } > } > > - imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, compose, > - &fmt_src->format, cc); > + imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, &fmt_src->format, cc); > > return 0; > } > @@ -265,7 +263,7 @@ static int capture_try_fmt_vid_cap(struct file *file, > void *fh, > if (ret) > return ret; > > - return __capture_try_fmt_vid_cap(priv, &fmt_src, f, NULL); > + return __capture_try_fmt_vid_cap(priv, &fmt_src, f); > } > > static int capture_s_fmt_vid_cap(struct file *file, void *fh, > @@ -273,7 +271,6 @@ static int capture_s_fmt_vid_cap(struct file *file, void > *fh, > { > struct capture_priv *priv = video_drvdata(file); > struct v4l2_subdev_format fmt_src; > - struct v4l2_rect compose; > int ret; > > if (vb2_is_busy(&priv->q)) { > @@ -287,14 +284,17 @@ static int capture_s_fmt_vid_cap(struct file *file, > void *fh, > if (ret) > return ret; > > - ret = __capture_try_fmt_vid_cap(priv, &fmt_src, f, &compose); > + ret = __capture_try_fmt_vid_cap(priv, &fmt_src, f); > if (ret) > return ret; > > priv->vdev.fmt.fmt.pix = f->fmt.pix; > priv->vdev.cc = imx_media_find_format(f->fmt.pix.pixelformat, > CS_SEL_ANY, true); > - priv->vdev.compose = compose; > + priv->vdev.compose.left = 0; > + priv->vdev.compose.top = 0; > + priv->vdev.compose.width = fmt_src.format.width; > + priv->vdev.compose.height = fmt_src.format.height; > > return 0; > } > @@ -655,8 +655,7 @@ static struct video_device capture_videodev = { > }; > > void imx_media_capture_device_set_format(struct imx_media_video_dev *vdev, > - const struct v4l2_pix_format *pix, > - const struct v4l2_rect *compose) > + struct v4l2_pix_format *pix) > { > struct capture_priv *priv = to_capture_priv(vdev); > > @@ -664,7 +663,6 @@ void imx_media_capture_device_set_format(struct > imx_media_video_dev *vdev, > priv->vdev.fmt.fmt.pix = *pix; > priv->vdev.cc = imx_media_find_format(pix->pixelformat, CS_SEL_ANY, > true); > -
Re: [PATCH v2 4/8] Revert "media: imx: Set capture compose rectangle in capture_device_set_format"
Yes, because the reverted commit was merged before the imx7 support, I will fix this for v3. Steve On 4/30/19 3:00 PM, Rui Miguel Silva wrote: Hi Steve, On Sun 28 Apr 2019 at 20:09, Steve Longerbeam wrote: Rvert this commit, as imx_media_capture_device_set_format() will be removed. This reverts commit 5964cbd8692252615370b77eb96764dd70c2f837. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-ic-prpencvf.c | 5 ++-- drivers/staging/media/imx/imx-media-capture.c | 24 +-- drivers/staging/media/imx/imx-media-csi.c | 5 ++-- drivers/staging/media/imx/imx-media-utils.c | 20 drivers/staging/media/imx/imx-media.h | 6 ++--- 5 files changed, 23 insertions(+), 37 deletions(-) diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index 8242d88dfb82..afaa3a8b15e9 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -910,7 +910,6 @@ static int prp_set_fmt(struct v4l2_subdev *sd, const struct imx_media_pixfmt *cc; struct v4l2_pix_format vdev_fmt; struct v4l2_mbus_framefmt *fmt; - struct v4l2_rect vdev_compose; int ret = 0; if (sdformat->pad >= PRPENCVF_NUM_PADS) @@ -952,11 +951,11 @@ static int prp_set_fmt(struct v4l2_subdev *sd, priv->cc[sdformat->pad] = cc; /* propagate output pad format to capture device */ - imx_media_mbus_fmt_to_pix_fmt(&vdev_fmt, &vdev_compose, + imx_media_mbus_fmt_to_pix_fmt(&vdev_fmt, &priv->format_mbus[PRPENCVF_SRC_PAD], priv->cc[PRPENCVF_SRC_PAD]); mutex_unlock(&priv->lock); - imx_media_capture_device_set_format(vdev, &vdev_fmt, &vdev_compose); + imx_media_capture_device_set_format(vdev, &vdev_fmt); return 0; out: diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 335084a6b0cd..555f6204660b 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -205,8 +205,7 @@ static int capture_g_fmt_vid_cap(struct file *file, void *fh, static int __capture_try_fmt_vid_cap(struct capture_priv *priv, struct v4l2_subdev_format *fmt_src, -struct v4l2_format *f, -struct v4l2_rect *compose) +struct v4l2_format *f) { const struct imx_media_pixfmt *cc, *cc_src; @@ -246,8 +245,7 @@ static int __capture_try_fmt_vid_cap(struct capture_priv *priv, } } - imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, compose, - &fmt_src->format, cc); + imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, &fmt_src->format, cc); return 0; } @@ -265,7 +263,7 @@ static int capture_try_fmt_vid_cap(struct file *file, void *fh, if (ret) return ret; - return __capture_try_fmt_vid_cap(priv, &fmt_src, f, NULL); + return __capture_try_fmt_vid_cap(priv, &fmt_src, f); } static int capture_s_fmt_vid_cap(struct file *file, void *fh, @@ -273,7 +271,6 @@ static int capture_s_fmt_vid_cap(struct file *file, void *fh, { struct capture_priv *priv = video_drvdata(file); struct v4l2_subdev_format fmt_src; - struct v4l2_rect compose; int ret; if (vb2_is_busy(&priv->q)) { @@ -287,14 +284,17 @@ static int capture_s_fmt_vid_cap(struct file *file, void *fh, if (ret) return ret; - ret = __capture_try_fmt_vid_cap(priv, &fmt_src, f, &compose); + ret = __capture_try_fmt_vid_cap(priv, &fmt_src, f); if (ret) return ret; priv->vdev.fmt.fmt.pix = f->fmt.pix; priv->vdev.cc = imx_media_find_format(f->fmt.pix.pixelformat, CS_SEL_ANY, true); - priv->vdev.compose = compose; + priv->vdev.compose.left = 0; + priv->vdev.compose.top = 0; + priv->vdev.compose.width = fmt_src.format.width; + priv->vdev.compose.height = fmt_src.format.height; return 0; } @@ -655,8 +655,7 @@ static struct video_device capture_videodev = { }; void imx_media_capture_device_set_format(struct imx_media_video_dev *vdev, -const struct v4l2_pix_format *pix, -const struct v4l2_rect *compose) +struct v4l2_pix_format *pix) { struct capture_priv *priv = to_capture_priv(vdev); @@ -664,7 +663,6 @@ void imx_media_capture_device_set_format(struct imx_media_video_dev *vdev, priv->vdev.fmt.fmt.pix = *pix; priv->vdev.cc = imx_media_find_format(pix->pixelformat, CS_SEL_ANY,
[PATCH] media: imx7_mipi_csis: fix racy entity pads init
Setting the media entity pads after the async register subdev can be racy with probe complete callback. So, make sure that the media pads are initialized before the probe complete is called. For that move the media entity pads initialization to the registered subdev internal operation. Signed-off-by: Rui Miguel Silva --- drivers/staging/media/imx/imx7-mipi-csis.c | 24 ++ 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index 19455f425416..042837b8ea28 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -784,6 +784,17 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static int mipi_csis_registered(struct v4l2_subdev *mipi_sd) +{ + struct csi_state *state = mipi_sd_to_csis_state(mipi_sd); + + state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK; + state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; + + return media_entity_pads_init(&state->mipi_sd.entity, CSIS_PADS_NUM, + state->pads); +} + static const struct v4l2_subdev_core_ops mipi_csis_core_ops = { .log_status = mipi_csis_log_status, }; @@ -809,6 +820,10 @@ static const struct v4l2_subdev_ops mipi_csis_subdev_ops = { .pad= &mipi_csis_pad_ops, }; +static const struct v4l2_subdev_internal_ops mipi_csis_internal_ops = { + .registered = mipi_csis_registered, +}; + static int mipi_csis_parse_dt(struct platform_device *pdev, struct csi_state *state) { @@ -869,6 +884,7 @@ static int mipi_csis_subdev_init(struct v4l2_subdev *mipi_sd, mipi_sd->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; mipi_sd->entity.ops = &mipi_csis_entity_ops; + mipi_sd->internal_ops = &mipi_csis_internal_ops; mipi_sd->dev = &pdev->dev; @@ -990,13 +1006,6 @@ static int mipi_csis_probe(struct platform_device *pdev) if (ret < 0) goto disable_clock; - state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK; - state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_pads_init(&state->mipi_sd.entity, CSIS_PADS_NUM, -state->pads); - if (ret < 0) - goto unregister_subdev; - memcpy(state->events, mipi_csis_events, sizeof(state->events)); mipi_csis_debugfs_init(state); @@ -1016,7 +1025,6 @@ static int mipi_csis_probe(struct platform_device *pdev) unregister_all: mipi_csis_debugfs_exit(state); media_entity_cleanup(&state->mipi_sd.entity); -unregister_subdev: v4l2_async_unregister_subdev(&state->mipi_sd); disable_clock: mipi_csis_clk_disable(state); -- 2.21.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 3/8] media: staging/imx: Move add_video_device into capture_device_register
Move imx_media_add_video_device() into imx_media_capture_device_register(). Also the former has no error conditions to convert to void. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-ic-prpencvf.c | 5 - drivers/staging/media/imx/imx-media-capture.c | 3 +++ drivers/staging/media/imx/imx-media-csi.c | 7 +-- drivers/staging/media/imx/imx-media-utils.c | 9 - drivers/staging/media/imx/imx-media.h | 4 ++-- drivers/staging/media/imx/imx7-media-csi.c| 12 +--- 6 files changed, 11 insertions(+), 29 deletions(-) diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index ddcd87a17c71..8242d88dfb82 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -1241,7 +1241,6 @@ static int prp_s_frame_interval(struct v4l2_subdev *sd, static int prp_registered(struct v4l2_subdev *sd) { struct prp_priv *priv = sd_to_priv(sd); - struct imx_ic_priv *ic_priv = priv->ic_priv; int i, ret; u32 code; @@ -1271,10 +1270,6 @@ static int prp_registered(struct v4l2_subdev *sd) if (ret) return ret; - ret = imx_media_add_video_device(ic_priv->md, priv->vdev); - if (ret) - goto unreg; - ret = prp_init_controls(priv); if (ret) goto unreg; diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 211ec4df2066..335084a6b0cd 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -780,6 +780,9 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev) vfd->ctrl_handler = &priv->ctrl_hdlr; + /* add vdev to the video device list */ + imx_media_add_video_device(priv->md, vdev); + return 0; unreg: video_unregister_device(vfd); diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index ea3d13103c91..c70fa6b509ae 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1820,13 +1820,8 @@ static int csi_registered(struct v4l2_subdev *sd) if (ret) goto free_fim; - ret = imx_media_add_video_device(priv->md, priv->vdev); - if (ret) - goto unreg; - return 0; -unreg: - imx_media_capture_device_unregister(priv->vdev); + free_fim: if (priv->fim) imx_media_fim_free(priv->fim); diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index c52aa59acd05..8a6e57652402 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -767,18 +767,17 @@ imx_media_find_subdev_by_devname(struct imx_media_dev *imxmd, EXPORT_SYMBOL_GPL(imx_media_find_subdev_by_devname); /* - * Adds a video device to the master video device list. This is called by - * an async subdev that owns a video device when it is registered. + * Adds a video device to the master video device list. This is called + * when a video device is registered. */ -int imx_media_add_video_device(struct imx_media_dev *imxmd, - struct imx_media_video_dev *vdev) +void imx_media_add_video_device(struct imx_media_dev *imxmd, + struct imx_media_video_dev *vdev) { mutex_lock(&imxmd->mutex); list_add_tail(&vdev->list, &imxmd->vdev_list); mutex_unlock(&imxmd->mutex); - return 0; } EXPORT_SYMBOL_GPL(imx_media_add_video_device); diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h index ba2d75bcc4c9..71e20f53ed7b 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -189,8 +189,8 @@ imx_media_find_subdev_by_fwnode(struct imx_media_dev *imxmd, struct v4l2_subdev * imx_media_find_subdev_by_devname(struct imx_media_dev *imxmd, const char *devname); -int imx_media_add_video_device(struct imx_media_dev *imxmd, - struct imx_media_video_dev *vdev); +void imx_media_add_video_device(struct imx_media_dev *imxmd, + struct imx_media_video_dev *vdev); int imx_media_find_mipi_csi2_channel(struct imx_media_dev *imxmd, struct media_entity *start_entity); struct media_pad * diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 96d01d8af874..f2037aba6e0e 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1126,17 +1126,7 @@ static int imx7_csi_registered(struct v4l2_subdev *sd) if (ret < 0) return ret; - ret = imx_media_capture_device_register(c
[PATCH v3 4/8] Revert "media: imx: Set capture compose rectangle in capture_device_set_format"
Rvert this commit, as imx_media_capture_device_set_format() will be removed. The arguments to mx_media_mbus_fmt_to_pix_fmt() and imx_media_capture_device_set_format() in imx7_csi_set_fmt() are also reverted. This reverts commit 5964cbd8692252615370b77eb96764dd70c2f837. Signed-off-by: Steve Longerbeam --- Chnges in v3: - revert to previous args in imx7_csi_set_fmt(). --- drivers/staging/media/imx/imx-ic-prpencvf.c | 5 ++-- drivers/staging/media/imx/imx-media-capture.c | 24 +-- drivers/staging/media/imx/imx-media-csi.c | 5 ++-- drivers/staging/media/imx/imx-media-utils.c | 20 drivers/staging/media/imx/imx-media.h | 6 ++--- drivers/staging/media/imx/imx7-media-csi.c| 5 ++-- 6 files changed, 25 insertions(+), 40 deletions(-) diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index 8242d88dfb82..afaa3a8b15e9 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -910,7 +910,6 @@ static int prp_set_fmt(struct v4l2_subdev *sd, const struct imx_media_pixfmt *cc; struct v4l2_pix_format vdev_fmt; struct v4l2_mbus_framefmt *fmt; - struct v4l2_rect vdev_compose; int ret = 0; if (sdformat->pad >= PRPENCVF_NUM_PADS) @@ -952,11 +951,11 @@ static int prp_set_fmt(struct v4l2_subdev *sd, priv->cc[sdformat->pad] = cc; /* propagate output pad format to capture device */ - imx_media_mbus_fmt_to_pix_fmt(&vdev_fmt, &vdev_compose, + imx_media_mbus_fmt_to_pix_fmt(&vdev_fmt, &priv->format_mbus[PRPENCVF_SRC_PAD], priv->cc[PRPENCVF_SRC_PAD]); mutex_unlock(&priv->lock); - imx_media_capture_device_set_format(vdev, &vdev_fmt, &vdev_compose); + imx_media_capture_device_set_format(vdev, &vdev_fmt); return 0; out: diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 335084a6b0cd..555f6204660b 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -205,8 +205,7 @@ static int capture_g_fmt_vid_cap(struct file *file, void *fh, static int __capture_try_fmt_vid_cap(struct capture_priv *priv, struct v4l2_subdev_format *fmt_src, -struct v4l2_format *f, -struct v4l2_rect *compose) +struct v4l2_format *f) { const struct imx_media_pixfmt *cc, *cc_src; @@ -246,8 +245,7 @@ static int __capture_try_fmt_vid_cap(struct capture_priv *priv, } } - imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, compose, - &fmt_src->format, cc); + imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, &fmt_src->format, cc); return 0; } @@ -265,7 +263,7 @@ static int capture_try_fmt_vid_cap(struct file *file, void *fh, if (ret) return ret; - return __capture_try_fmt_vid_cap(priv, &fmt_src, f, NULL); + return __capture_try_fmt_vid_cap(priv, &fmt_src, f); } static int capture_s_fmt_vid_cap(struct file *file, void *fh, @@ -273,7 +271,6 @@ static int capture_s_fmt_vid_cap(struct file *file, void *fh, { struct capture_priv *priv = video_drvdata(file); struct v4l2_subdev_format fmt_src; - struct v4l2_rect compose; int ret; if (vb2_is_busy(&priv->q)) { @@ -287,14 +284,17 @@ static int capture_s_fmt_vid_cap(struct file *file, void *fh, if (ret) return ret; - ret = __capture_try_fmt_vid_cap(priv, &fmt_src, f, &compose); + ret = __capture_try_fmt_vid_cap(priv, &fmt_src, f); if (ret) return ret; priv->vdev.fmt.fmt.pix = f->fmt.pix; priv->vdev.cc = imx_media_find_format(f->fmt.pix.pixelformat, CS_SEL_ANY, true); - priv->vdev.compose = compose; + priv->vdev.compose.left = 0; + priv->vdev.compose.top = 0; + priv->vdev.compose.width = fmt_src.format.width; + priv->vdev.compose.height = fmt_src.format.height; return 0; } @@ -655,8 +655,7 @@ static struct video_device capture_videodev = { }; void imx_media_capture_device_set_format(struct imx_media_video_dev *vdev, -const struct v4l2_pix_format *pix, -const struct v4l2_rect *compose) +struct v4l2_pix_format *pix) { struct capture_priv *priv = to_capture_priv(vdev); @@ -664,7 +663,6 @@ void imx_media_capture_device_set_format(struct imx_media_video_dev *vdev, priv->vdev.fmt.fmt.pix = *pix; priv->vdev.cc = imx_media_find_format(pix->pixelformat, CS_SE
[PATCH v3 5/8] media: staging/imx: Remove capture_device_set_format
Don't propagate the source pad format to the connected capture device. It's now the responsibility of userspace to call VIDIOC_S_FMT on the capture device to ensure the capture format and compose rectangle are compatible with the connected source. To check this, validate the capture format with the source before streaming starts. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-ic-prpencvf.c | 16 + drivers/staging/media/imx/imx-media-capture.c | 64 +-- drivers/staging/media/imx/imx-media-csi.c | 16 + drivers/staging/media/imx/imx-media.h | 2 - drivers/staging/media/imx/imx7-media-csi.c| 17 + 5 files changed, 50 insertions(+), 65 deletions(-) diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index afaa3a8b15e9..63334fd61492 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -906,9 +906,7 @@ static int prp_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *sdformat) { struct prp_priv *priv = sd_to_priv(sd); - struct imx_media_video_dev *vdev = priv->vdev; const struct imx_media_pixfmt *cc; - struct v4l2_pix_format vdev_fmt; struct v4l2_mbus_framefmt *fmt; int ret = 0; @@ -945,19 +943,9 @@ static int prp_set_fmt(struct v4l2_subdev *sd, priv->cc[PRPENCVF_SRC_PAD] = outcc; } - if (sdformat->which == V4L2_SUBDEV_FORMAT_TRY) - goto out; - - priv->cc[sdformat->pad] = cc; + if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE) + priv->cc[sdformat->pad] = cc; - /* propagate output pad format to capture device */ - imx_media_mbus_fmt_to_pix_fmt(&vdev_fmt, - &priv->format_mbus[PRPENCVF_SRC_PAD], - priv->cc[PRPENCVF_SRC_PAD]); - mutex_unlock(&priv->lock); - imx_media_capture_device_set_format(vdev, &vdev_fmt); - - return 0; out: mutex_unlock(&priv->lock); return ret; diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 555f6204660b..b77a67bda47c 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -205,7 +205,8 @@ static int capture_g_fmt_vid_cap(struct file *file, void *fh, static int __capture_try_fmt_vid_cap(struct capture_priv *priv, struct v4l2_subdev_format *fmt_src, -struct v4l2_format *f) +struct v4l2_format *f, +struct v4l2_rect *compose) { const struct imx_media_pixfmt *cc, *cc_src; @@ -247,6 +248,13 @@ static int __capture_try_fmt_vid_cap(struct capture_priv *priv, imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, &fmt_src->format, cc); + if (compose) { + compose->left = 0; + compose->top = 0; + compose->width = fmt_src->format.width; + compose->height = fmt_src->format.height; + } + return 0; } @@ -263,7 +271,7 @@ static int capture_try_fmt_vid_cap(struct file *file, void *fh, if (ret) return ret; - return __capture_try_fmt_vid_cap(priv, &fmt_src, f); + return __capture_try_fmt_vid_cap(priv, &fmt_src, f, NULL); } static int capture_s_fmt_vid_cap(struct file *file, void *fh, @@ -271,6 +279,7 @@ static int capture_s_fmt_vid_cap(struct file *file, void *fh, { struct capture_priv *priv = video_drvdata(file); struct v4l2_subdev_format fmt_src; + struct v4l2_rect compose; int ret; if (vb2_is_busy(&priv->q)) { @@ -284,17 +293,14 @@ static int capture_s_fmt_vid_cap(struct file *file, void *fh, if (ret) return ret; - ret = __capture_try_fmt_vid_cap(priv, &fmt_src, f); + ret = __capture_try_fmt_vid_cap(priv, &fmt_src, f, &compose); if (ret) return ret; priv->vdev.fmt.fmt.pix = f->fmt.pix; priv->vdev.cc = imx_media_find_format(f->fmt.pix.pixelformat, CS_SEL_ANY, true); - priv->vdev.compose.left = 0; - priv->vdev.compose.top = 0; - priv->vdev.compose.width = fmt_src.format.width; - priv->vdev.compose.height = fmt_src.format.height; + priv->vdev.compose = compose; return 0; } @@ -524,6 +530,33 @@ static void capture_buf_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&priv->q_lock, flags); } +static int capture_validate_fmt(struct capture_priv *priv) +{ + struct v4l2_subdev_format fmt_src; + struct v4l2_rect compose; + struct v4l2_format f; + int ret; + + fmt_src.pad = priv->src_sd_pad; + fmt_src.which = V4L2_
[PATCH v3 6/8] media: staging/imx: Re-organize modules
Re-organize modules, and which objects are linked into those modules, so that: - imx6-media (renamed from imx-media) is the media driver module for imx5/6 only, and has no symbol exports. - imx6-media-csi (renamed from imx-media-csi) is the subdev driver module for imx5/6 CSI. It is now linked direcly with imx-media-fim, since only the imx5/6 CSI makes use of the frame interval monitor. - imx-media-common now only contains common code between imx5/6 and imx7 media drivers. It contains imx-media-utils, imx-media-of, imx-media-dev-common, and imx-media-capture. In order to acheive that, some functions common to imx5/6 and imx7 have been moved out of imx-media-dev.c and into imx-media-dev-common.c. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/Makefile| 14 +- .../staging/media/imx/imx-media-dev-common.c | 345 +- drivers/staging/media/imx/imx-media-dev.c | 340 + drivers/staging/media/imx/imx-media-fim.c | 5 - drivers/staging/media/imx/imx-media-of.c | 3 + drivers/staging/media/imx/imx-media.h | 16 +- drivers/staging/media/imx/imx7-media-csi.c| 4 +- 7 files changed, 369 insertions(+), 358 deletions(-) diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index 86f0c81b6a3b..aa6c4b4ad37e 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -1,14 +1,16 @@ # SPDX-License-Identifier: GPL-2.0 -imx-media-objs := imx-media-dev.o imx-media-internal-sd.o imx-media-of.o \ +imx6-media-objs := imx-media-dev.o imx-media-internal-sd.o \ imx-ic-common.o imx-ic-prp.o imx-ic-prpencvf.o imx-media-vdic.o -imx-media-objs += imx-media-dev-common.o -imx-media-common-objs := imx-media-utils.o imx-media-fim.o -obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o +imx-media-common-objs := imx-media-capture.o imx-media-dev-common.o \ + imx-media-of.o imx-media-utils.o + +imx6-media-csi-objs := imx-media-csi.o imx-media-fim.o + +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx6-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o -obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-capture.o -obj-$(CONFIG_VIDEO_IMX_CSI) += imx-media-csi.o +obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c index 6cd93419b81d..89dc4ec8dadb 100644 --- a/drivers/staging/media/imx/imx-media-dev-common.c +++ b/drivers/staging/media/imx/imx-media-dev-common.c @@ -8,9 +8,342 @@ #include #include +#include +#include +#include +#include #include "imx-media.h" -static const struct v4l2_async_notifier_operations imx_media_subdev_ops = { +static inline struct imx_media_dev *notifier2dev(struct v4l2_async_notifier *n) +{ + return container_of(n, struct imx_media_dev, notifier); +} + +/* async subdev bound notifier */ +static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, + struct v4l2_async_subdev *asd) +{ + v4l2_info(sd->v4l2_dev, "subdev %s bound\n", sd->name); + + return 0; +} + +/* + * Create the media links for all subdevs that registered. + * Called after all async subdevs have bound. + */ +static int imx_media_create_links(struct v4l2_async_notifier *notifier) +{ + struct imx_media_dev *imxmd = notifier2dev(notifier); + struct v4l2_subdev *sd; + + list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) { + switch (sd->grp_id) { + case IMX_MEDIA_GRP_ID_IPU_VDIC: + case IMX_MEDIA_GRP_ID_IPU_IC_PRP: + case IMX_MEDIA_GRP_ID_IPU_IC_PRPENC: + case IMX_MEDIA_GRP_ID_IPU_IC_PRPVF: + /* +* links have already been created for the +* sync-registered subdevs. +*/ + break; + case IMX_MEDIA_GRP_ID_IPU_CSI0: + case IMX_MEDIA_GRP_ID_IPU_CSI1: + case IMX_MEDIA_GRP_ID_CSI: + imx_media_create_csi_of_links(imxmd, sd); + break; + default: + /* +* if this subdev has fwnode links, create media +* links for them. +*/ + imx_media_create_of_links(imxmd, sd); + break; + } + } + + return 0; +} + +/* + * adds given video device to given imx-media source pad vdev list. + * Continues upstream from the pad entity's sink pads. + */ +static int imx_media_add_vdev_to_pad(struct imx_media_dev *imxmd, +struct imx_media_video_dev *vdev, +
[PATCH v3 7/8] media: staging/imx: Improve pipeline searching
Export find_pipeline_pad(), renaming to imx_media_pipeline_pad(), and extend its functionality to allow searching for video devices in the enabled pipeline in addition to sub-devices. As part of this: - Rename imx_media_find_mipi_csi2_channel() to imx_media_pipeline_csi2_channel(). - Remove imx_media_find_upstream_pad(), it is redundant now. - Rename imx_media_find_upstream_subdev() to imx_media_pipeline_subdev() with an additional boolean argument for searching upstream or downstream. - Add imx_media_pipeline_video_device() which is analogous to imx_media_pipeline_subdev() but searches for video devices. - Remove imxmd pointer arg from all of the functions above, it was never used in those functions. With that change the i.MX5/6 CSI, VDIC, and IC sub-devices no longer require the media_device. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-ic-common.c | 4 +- drivers/staging/media/imx/imx-ic-prp.c| 4 +- drivers/staging/media/imx/imx-ic.h| 1 - drivers/staging/media/imx/imx-media-csi.c | 13 +- drivers/staging/media/imx/imx-media-fim.c | 4 - .../staging/media/imx/imx-media-internal-sd.c | 5 +- drivers/staging/media/imx/imx-media-utils.c | 128 ++ drivers/staging/media/imx/imx-media-vdic.c| 5 +- drivers/staging/media/imx/imx-media.h | 20 +-- drivers/staging/media/imx/imx7-media-csi.c| 2 +- 10 files changed, 93 insertions(+), 93 deletions(-) diff --git a/drivers/staging/media/imx/imx-ic-common.c b/drivers/staging/media/imx/imx-ic-common.c index ad0c291db03c..37734984beb4 100644 --- a/drivers/staging/media/imx/imx-ic-common.c +++ b/drivers/staging/media/imx/imx-ic-common.c @@ -22,12 +22,11 @@ static struct imx_ic_ops *ic_ops[IC_NUM_OPS] = { [IC_TASK_VIEWFINDER] = &imx_ic_prpencvf_ops, }; -struct v4l2_subdev *imx_media_ic_register(struct imx_media_dev *imxmd, +struct v4l2_subdev *imx_media_ic_register(struct v4l2_device *v4l2_dev, struct device *ipu_dev, struct ipu_soc *ipu, u32 grp_id) { - struct v4l2_device *v4l2_dev = &imxmd->v4l2_dev; struct imx_ic_priv *priv; int ret; @@ -37,7 +36,6 @@ struct v4l2_subdev *imx_media_ic_register(struct imx_media_dev *imxmd, priv->ipu_dev = ipu_dev; priv->ipu = ipu; - priv->md = imxmd; /* get our IC task id */ switch (grp_id) { diff --git a/drivers/staging/media/imx/imx-ic-prp.c b/drivers/staging/media/imx/imx-ic-prp.c index 663db200e594..1432776a33f9 100644 --- a/drivers/staging/media/imx/imx-ic-prp.c +++ b/drivers/staging/media/imx/imx-ic-prp.c @@ -302,8 +302,8 @@ static int prp_link_validate(struct v4l2_subdev *sd, if (ret) return ret; - csi = imx_media_find_upstream_subdev(ic_priv->md, &ic_priv->sd.entity, -IMX_MEDIA_GRP_ID_IPU_CSI); + csi = imx_media_pipeline_subdev(&ic_priv->sd.entity, + IMX_MEDIA_GRP_ID_IPU_CSI, true); if (IS_ERR(csi)) csi = NULL; diff --git a/drivers/staging/media/imx/imx-ic.h b/drivers/staging/media/imx/imx-ic.h index 1dcbb37aeada..ff2f66f11982 100644 --- a/drivers/staging/media/imx/imx-ic.h +++ b/drivers/staging/media/imx/imx-ic.h @@ -16,7 +16,6 @@ struct imx_ic_priv { struct device *ipu_dev; struct ipu_soc *ipu; - struct imx_media_dev *md; struct v4l2_subdev sd; inttask_id; void *task_priv; diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 68c2b1a3066a..555904759078 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -60,7 +60,6 @@ struct csi_skip_desc { struct csi_priv { struct device *dev; struct ipu_soc *ipu; - struct imx_media_dev *md; struct v4l2_subdev sd; struct media_pad pad[CSI_NUM_PADS]; /* the video device at IDMAC output pad */ @@ -182,8 +181,8 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, * CSI-2 receiver if it is in the path, otherwise stay * with video mux. */ - sd = imx_media_find_upstream_subdev(priv->md, src, - IMX_MEDIA_GRP_ID_CSI2); + sd = imx_media_pipeline_subdev(src, IMX_MEDIA_GRP_ID_CSI2, + true); if (!IS_ERR(sd)) src = &sd->entity; } @@ -197,7 +196,7 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, src = &priv->sd.entity; /* get source pad of entity directly upstream from src */ - pad = imx_media_find_upstream_pad(priv->md, src, 0); + pad = imx_media_pipel
[PATCH v3 2/8] media: staging/imx: Pass device to alloc/free_dma_buf
Allocate and free a DMA coherent buffer in imx_media_alloc/free_dma_buf() from the given device. This allows DMA alloc and free using a device that is backed by real hardware, which for the imx5/6/7 CSI is the CSI unit, and for the internal IPU sub-devices, is the parent IPU. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-ic-prpencvf.c | 18 +- drivers/staging/media/imx/imx-media-csi.c | 6 +++--- drivers/staging/media/imx/imx-media-utils.c | 13 ++--- drivers/staging/media/imx/imx-media.h | 4 ++-- drivers/staging/media/imx/imx7-media-csi.c | 4 ++-- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index 069cce512280..ddcd87a17c71 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -464,13 +464,13 @@ static int prp_setup_rotation(struct prp_priv *priv) incc = priv->cc[PRPENCVF_SINK_PAD]; outcc = vdev->cc; - ret = imx_media_alloc_dma_buf(ic_priv->md, &priv->rot_buf[0], + ret = imx_media_alloc_dma_buf(ic_priv->ipu_dev, &priv->rot_buf[0], outfmt->sizeimage); if (ret) { v4l2_err(&ic_priv->sd, "failed to alloc rot_buf[0], %d\n", ret); return ret; } - ret = imx_media_alloc_dma_buf(ic_priv->md, &priv->rot_buf[1], + ret = imx_media_alloc_dma_buf(ic_priv->ipu_dev, &priv->rot_buf[1], outfmt->sizeimage); if (ret) { v4l2_err(&ic_priv->sd, "failed to alloc rot_buf[1], %d\n", ret); @@ -543,9 +543,9 @@ static int prp_setup_rotation(struct prp_priv *priv) unsetup_vb2: prp_unsetup_vb2_buf(priv, VB2_BUF_STATE_QUEUED); free_rot1: - imx_media_free_dma_buf(ic_priv->md, &priv->rot_buf[1]); + imx_media_free_dma_buf(ic_priv->ipu_dev, &priv->rot_buf[1]); free_rot0: - imx_media_free_dma_buf(ic_priv->md, &priv->rot_buf[0]); + imx_media_free_dma_buf(ic_priv->ipu_dev, &priv->rot_buf[0]); return ret; } @@ -563,8 +563,8 @@ static void prp_unsetup_rotation(struct prp_priv *priv) ipu_ic_disable(priv->ic); - imx_media_free_dma_buf(ic_priv->md, &priv->rot_buf[0]); - imx_media_free_dma_buf(ic_priv->md, &priv->rot_buf[1]); + imx_media_free_dma_buf(ic_priv->ipu_dev, &priv->rot_buf[0]); + imx_media_free_dma_buf(ic_priv->ipu_dev, &priv->rot_buf[1]); } static int prp_setup_norotation(struct prp_priv *priv) @@ -656,7 +656,7 @@ static int prp_start(struct prp_priv *priv) outfmt = &vdev->fmt.fmt.pix; - ret = imx_media_alloc_dma_buf(ic_priv->md, &priv->underrun_buf, + ret = imx_media_alloc_dma_buf(ic_priv->ipu_dev, &priv->underrun_buf, outfmt->sizeimage); if (ret) goto out_put_ipu; @@ -726,7 +726,7 @@ static int prp_start(struct prp_priv *priv) out_unsetup: prp_unsetup(priv, VB2_BUF_STATE_QUEUED); out_free_underrun: - imx_media_free_dma_buf(ic_priv->md, &priv->underrun_buf); + imx_media_free_dma_buf(ic_priv->ipu_dev, &priv->underrun_buf); out_put_ipu: prp_put_ipu_resources(priv); return ret; @@ -763,7 +763,7 @@ static void prp_stop(struct prp_priv *priv) prp_unsetup(priv, VB2_BUF_STATE_ERROR); - imx_media_free_dma_buf(ic_priv->md, &priv->underrun_buf); + imx_media_free_dma_buf(ic_priv->ipu_dev, &priv->underrun_buf); /* cancel the EOF timeout timer */ del_timer_sync(&priv->eof_timeout_timer); diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 93b107eab5f5..ea3d13103c91 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -612,7 +612,7 @@ static int csi_idmac_start(struct csi_priv *priv) outfmt = &vdev->fmt.fmt.pix; - ret = imx_media_alloc_dma_buf(priv->md, &priv->underrun_buf, + ret = imx_media_alloc_dma_buf(priv->dev, &priv->underrun_buf, outfmt->sizeimage); if (ret) goto out_put_ipu; @@ -666,7 +666,7 @@ static int csi_idmac_start(struct csi_priv *priv) out_unsetup: csi_idmac_unsetup(priv, VB2_BUF_STATE_QUEUED); out_free_dma_buf: - imx_media_free_dma_buf(priv->md, &priv->underrun_buf); + imx_media_free_dma_buf(priv->dev, &priv->underrun_buf); out_put_ipu: csi_idmac_put_ipu_resources(priv); return ret; @@ -698,7 +698,7 @@ static void csi_idmac_stop(struct csi_priv *priv) csi_idmac_unsetup(priv, VB2_BUF_STATE_ERROR); - imx_media_free_dma_buf(priv->md, &priv->underrun_buf); + imx_media_free_dma_buf(priv->dev, &priv->underrun_buf); /* cancel the EOF timeout timer */ del_timer_sync(&priv->eof_timeout_timer); diff --git a/drivers/st
[PATCH v3 1/8] media: staging/imx: Switch to sync registration for IPU subdevs
Because the IPU sub-devices VDIC and IC are not present in the device-tree, platform devices were created for them instead. This allowed these sub-devices to be added to the media device's async notifier and registered asynchronously along with the other sub-devices that do have a device-tree presence (CSI and devices external to the IPU and SoC). But that approach isn't really necessary. The IPU sub-devices don't actually require a backing device (sd->dev is allowed to be NULL). And that approach can't get around the fact that the IPU sub-devices are not part of a device hierarchy, which makes it awkward to retrieve the parent IPU of these devices. By registering them synchronously, they can be registered from the CSI async bound notifier, so the init function for them can be given the CSI subdev, who's dev->parent is the IPU. That is a somewhat cleaner way to retrieve the parent IPU. So convert to synchronous registration for the VDIC and IC task sub-devices, at the time a CSI sub-device is bound. There is no longer a backing device for them (sd->dev is NULL), but that's ok. Also set the VDIC/IC sub-device owner as the IPU, so that a reference can be taken on the IPU module. Since the VDIC and IC task drivers are no longer platform drivers, they are now statically linked to imx-media module. Signed-off-by: Steve Longerbeam --- Changes in v3: - statically link VDIC and IC task objects to imx-media module in Makefile. --- drivers/staging/media/imx/Makefile| 6 +- drivers/staging/media/imx/imx-ic-common.c | 70 ++-- drivers/staging/media/imx/imx-ic-prp.c| 34 +- drivers/staging/media/imx/imx-ic-prpencvf.c | 70 ++-- drivers/staging/media/imx/imx-ic.h| 7 +- drivers/staging/media/imx/imx-media-capture.c | 7 +- drivers/staging/media/imx/imx-media-csi.c | 2 +- drivers/staging/media/imx/imx-media-dev.c | 121 +- .../staging/media/imx/imx-media-internal-sd.c | 356 -- drivers/staging/media/imx/imx-media-of.c | 38 +- drivers/staging/media/imx/imx-media-vdic.c| 85 ++--- drivers/staging/media/imx/imx-media.h | 67 ++-- drivers/staging/media/imx/imx7-media-csi.c| 3 +- 13 files changed, 327 insertions(+), 539 deletions(-) diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index d2d909a36239..86f0c81b6a3b 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -1,14 +1,12 @@ # SPDX-License-Identifier: GPL-2.0 -imx-media-objs := imx-media-dev.o imx-media-internal-sd.o imx-media-of.o +imx-media-objs := imx-media-dev.o imx-media-internal-sd.o imx-media-of.o \ + imx-ic-common.o imx-ic-prp.o imx-ic-prpencvf.o imx-media-vdic.o imx-media-objs += imx-media-dev-common.o imx-media-common-objs := imx-media-utils.o imx-media-fim.o -imx-media-ic-objs := imx-ic-common.o imx-ic-prp.o imx-ic-prpencvf.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-capture.o -obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-vdic.o -obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-ic.o obj-$(CONFIG_VIDEO_IMX_CSI) += imx-media-csi.o obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o diff --git a/drivers/staging/media/imx/imx-ic-common.c b/drivers/staging/media/imx/imx-ic-common.c index 1addb0893c57..ad0c291db03c 100644 --- a/drivers/staging/media/imx/imx-ic-common.c +++ b/drivers/staging/media/imx/imx-ic-common.c @@ -8,8 +8,6 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ -#include -#include #include #include #include "imx-media.h" @@ -24,23 +22,25 @@ static struct imx_ic_ops *ic_ops[IC_NUM_OPS] = { [IC_TASK_VIEWFINDER] = &imx_ic_prpencvf_ops, }; -static int imx_ic_probe(struct platform_device *pdev) +struct v4l2_subdev *imx_media_ic_register(struct imx_media_dev *imxmd, + struct device *ipu_dev, + struct ipu_soc *ipu, + u32 grp_id) { - struct imx_media_ipu_internal_sd_pdata *pdata; + struct v4l2_device *v4l2_dev = &imxmd->v4l2_dev; struct imx_ic_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(ipu_dev, sizeof(*priv), GFP_KERNEL); if (!priv) - return -ENOMEM; + return ERR_PTR(-ENOMEM); - platform_set_drvdata(pdev, &priv->sd); - priv->dev = &pdev->dev; + priv->ipu_dev = ipu_dev; + priv->ipu = ipu; + priv->md = imxmd; - /* get our ipu_id, grp_id and IC task id */ - pdata = priv->dev->platform_data; - priv->ipu_id = pdata->ipu_id; - switch (pdata->grp_id) { + /* get our IC task id */ + switch (grp_id) { case IMX_MEDIA_GRP_ID_IPU_IC_PRP: priv
[PATCH v3 8/8] media: staging/imx: Don't set driver data for v4l2_dev
The media device is already available via multiple methods, there is no need to set driver data for v4l2_dev to the media device. In imx_media_link_notify(), get media device from link->graph_obj.mdev. In imx_media_capture_device_register(), get media device from v4l2_dev->mdev. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-media-capture.c| 5 +++-- drivers/staging/media/imx/imx-media-dev-common.c | 7 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index b77a67bda47c..565d21f169d8 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -732,15 +732,16 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev) { struct capture_priv *priv = to_capture_priv(vdev); struct v4l2_subdev *sd = priv->src_sd; + struct v4l2_device *v4l2_dev = sd->v4l2_dev; struct video_device *vfd = vdev->vfd; struct vb2_queue *vq = &priv->q; struct v4l2_subdev_format fmt_src; int ret; /* get media device */ - priv->md = dev_get_drvdata(sd->v4l2_dev->dev); + priv->md = container_of(v4l2_dev->mdev, struct imx_media_dev, md); - vfd->v4l2_dev = sd->v4l2_dev; + vfd->v4l2_dev = v4l2_dev; ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); if (ret) { diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c index 89dc4ec8dadb..66b505f7e8df 100644 --- a/drivers/staging/media/imx/imx-media-dev-common.c +++ b/drivers/staging/media/imx/imx-media-dev-common.c @@ -260,10 +260,11 @@ static int imx_media_inherit_controls(struct imx_media_dev *imxmd, static int imx_media_link_notify(struct media_link *link, u32 flags, unsigned int notification) { + struct imx_media_dev *imxmd = container_of(link->graph_obj.mdev, + struct imx_media_dev, md); struct media_entity *source = link->source->entity; struct imx_media_pad_vdev *pad_vdev; struct list_head *pad_vdev_list; - struct imx_media_dev *imxmd; struct video_device *vfd; struct v4l2_subdev *sd; int pad_idx, ret; @@ -279,8 +280,6 @@ static int imx_media_link_notify(struct media_link *link, u32 flags, sd = media_entity_to_v4l2_subdev(source); pad_idx = link->source->index; - imxmd = dev_get_drvdata(sd->v4l2_dev->dev); - pad_vdev_list = to_pad_vdev_list(sd, pad_idx); if (!pad_vdev_list) { /* nothing to do if source sd has no pad vdev list */ @@ -384,8 +383,6 @@ struct imx_media_dev *imx_media_dev_init(struct device *dev, goto cleanup; } - dev_set_drvdata(imxmd->v4l2_dev.dev, imxmd); - INIT_LIST_HEAD(&imxmd->vdev_list); v4l2_async_notifier_init(&imxmd->notifier); -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Intel-gfx] [PATCH] dma-buf: add struct dma_buf_attach_info v2
Hi "Christian, I love your patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.1-rc7 next-20190430] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Christian-K-nig/dma-buf-add-struct-dma_buf_attach_info-v2/20190430-221017 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) >> drivers/xen/gntdev-dmabuf.c:634:33: sparse: sparse: incorrect type in >> argument 1 (different base types) @@expected struct dma_buf_attach_info >> const *info @@got dma_buf_attach_info const *info @@ >> drivers/xen/gntdev-dmabuf.c:634:33: sparse:expected struct >> dma_buf_attach_info const *info >> drivers/xen/gntdev-dmabuf.c:634:33: sparse:got struct dma_buf >> *[assigned] dma_buf >> drivers/xen/gntdev-dmabuf.c:634:32: sparse: sparse: too many arguments for >> function dma_buf_attach vim +634 drivers/xen/gntdev-dmabuf.c bf8dc55b Oleksandr Andrushchenko 2018-07-20 605 932d6562 Oleksandr Andrushchenko 2018-07-20 606 static struct gntdev_dmabuf * 932d6562 Oleksandr Andrushchenko 2018-07-20 607 dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev, 932d6562 Oleksandr Andrushchenko 2018-07-20 608 int fd, int count, int domid) 932d6562 Oleksandr Andrushchenko 2018-07-20 609 { bf8dc55b Oleksandr Andrushchenko 2018-07-20 610struct gntdev_dmabuf *gntdev_dmabuf, *ret; e648feab Christian König 2019-04-30 611struct dma_buf_attach_info attach_info; bf8dc55b Oleksandr Andrushchenko 2018-07-20 612struct dma_buf *dma_buf; bf8dc55b Oleksandr Andrushchenko 2018-07-20 613struct dma_buf_attachment *attach; bf8dc55b Oleksandr Andrushchenko 2018-07-20 614struct sg_table *sgt; bf8dc55b Oleksandr Andrushchenko 2018-07-20 615struct sg_page_iter sg_iter; bf8dc55b Oleksandr Andrushchenko 2018-07-20 616int i; bf8dc55b Oleksandr Andrushchenko 2018-07-20 617 bf8dc55b Oleksandr Andrushchenko 2018-07-20 618dma_buf = dma_buf_get(fd); bf8dc55b Oleksandr Andrushchenko 2018-07-20 619if (IS_ERR(dma_buf)) bf8dc55b Oleksandr Andrushchenko 2018-07-20 620return ERR_CAST(dma_buf); bf8dc55b Oleksandr Andrushchenko 2018-07-20 621 bf8dc55b Oleksandr Andrushchenko 2018-07-20 622gntdev_dmabuf = dmabuf_imp_alloc_storage(count); bf8dc55b Oleksandr Andrushchenko 2018-07-20 623if (IS_ERR(gntdev_dmabuf)) { bf8dc55b Oleksandr Andrushchenko 2018-07-20 624ret = gntdev_dmabuf; bf8dc55b Oleksandr Andrushchenko 2018-07-20 625goto fail_put; bf8dc55b Oleksandr Andrushchenko 2018-07-20 626} bf8dc55b Oleksandr Andrushchenko 2018-07-20 627 bf8dc55b Oleksandr Andrushchenko 2018-07-20 628gntdev_dmabuf->priv = priv; bf8dc55b Oleksandr Andrushchenko 2018-07-20 629gntdev_dmabuf->fd = fd; bf8dc55b Oleksandr Andrushchenko 2018-07-20 630 e648feab Christian König 2019-04-30 631memset(&attach_info, 0, sizeof(attach_info)); e648feab Christian König 2019-04-30 632attach_info.dev = dev; e648feab Christian König 2019-04-30 633attach_info.dmabuf = dma_buf; bf8dc55b Oleksandr Andrushchenko 2018-07-20 @634attach = dma_buf_attach(dma_buf, dev); bf8dc55b Oleksandr Andrushchenko 2018-07-20 635if (IS_ERR(attach)) { bf8dc55b Oleksandr Andrushchenko 2018-07-20 636ret = ERR_CAST(attach); bf8dc55b Oleksandr Andrushchenko 2018-07-20 637goto fail_free_obj; bf8dc55b Oleksandr Andrushchenko 2018-07-20 638} bf8dc55b Oleksandr Andrushchenko 2018-07-20 639 bf8dc55b Oleksandr Andrushchenko 2018-07-20 640 gntdev_dmabuf->u.imp.attach = attach; bf8dc55b Oleksandr Andrushchenko 2018-07-20 641 bf8dc55b Oleksandr Andrushchenko 2018-07-20 642sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); bf8dc55b Oleksandr Andrushchenko 2018-07-20 643if (IS_ERR(sgt)) { bf8dc55b Oleksandr Andrushchenko 2018-07-20 644ret = ERR_CAST(sgt); bf8dc55b Oleksandr Andrushchenko 2018-07-20 645goto fail_detach; bf8dc55b Oleksandr Andrushchenko 2018-07-20 646} bf8dc55b Oleksandr Andrushchenko 2018-07-20 647 bf8dc55b Oleksandr Andrushchenko 2018-07-20 648/* Check number of pages that imported buffer has. */ bf8dc55b Oleksandr Andrushchenko 2018-07-20 649if (attach->dmabuf->size != gntdev_dmabuf->nr_pages << PAGE_SHIFT) { bf8dc55b Oleksandr Andrushchenko 2018-07-20 650ret =
[PATCH v2] staging: vc04_services: bcm2835-camera: Compress two lines into one line
Return value directly without saving it in a variable and remove that variable. Issue suggested by Coccinelle. Signed-off-by: Vatsala Narang --- Changes in v2: -Change subject line and log message -Remove respective unused variable drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index c9b6346111a5..68f08dc18da9 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -1491,7 +1491,6 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance, struct vchiq_mmal_component *camera, struct bm2835_mmal_dev *dev) { - int ret; struct mmal_parameter_camera_config cam_config = { .max_stills_w = dev->max_width, .max_stills_h = dev->max_height, @@ -1507,10 +1506,9 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance, .use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC }; - ret = vchiq_mmal_port_parameter_set(instance, &camera->control, + return vchiq_mmal_port_parameter_set(instance, &camera->control, MMAL_PARAMETER_CAMERA_CONFIG, &cam_config, sizeof(cam_config)); - return ret; } #define MAX_SUPPORTED_ENCODINGS 20 -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel