[git:media_tree/master] media: lgdt3306a: Add a check against null-pointer-def
This is an automatic generated email to let you know that the following patch were queued: Subject: media: lgdt3306a: Add a check against null-pointer-def Author: Zheyu Ma Date:Tue Apr 5 10:50:18 2022 +0100 The driver should check whether the client provides the platform_data. The following log reveals it: [ 29.610324] BUG: KASAN: null-ptr-deref in kmemdup+0x30/0x40 [ 29.610730] Read of size 40 at addr by task bash/414 [ 29.612820] Call Trace: [ 29.613030] [ 29.613201] dump_stack_lvl+0x56/0x6f [ 29.613496] ? kmemdup+0x30/0x40 [ 29.613754] print_report.cold+0x494/0x6b7 [ 29.614082] ? kmemdup+0x30/0x40 [ 29.614340] kasan_report+0x8a/0x190 [ 29.614628] ? kmemdup+0x30/0x40 [ 29.614888] kasan_check_range+0x14d/0x1d0 [ 29.615213] memcpy+0x20/0x60 [ 29.615454] kmemdup+0x30/0x40 [ 29.615700] lgdt3306a_probe+0x52/0x310 [ 29.616339] i2c_device_probe+0x951/0xa90 Link: https://lore.kernel.org/linux-media/20220405095018.3993578-1-zheyum...@gmail.com Signed-off-by: Zheyu Ma Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/lgdt3306a.c | 5 + 1 file changed, 5 insertions(+) --- diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c index 263887592415..231b45632ad5 100644 --- a/drivers/media/dvb-frontends/lgdt3306a.c +++ b/drivers/media/dvb-frontends/lgdt3306a.c @@ -2176,6 +2176,11 @@ static int lgdt3306a_probe(struct i2c_client *client) struct dvb_frontend *fe; int ret; + if (!client->dev.platform_data) { + dev_err(>dev, "platform data is mandatory\n"); + return -EINVAL; + } + config = kmemdup(client->dev.platform_data, sizeof(struct lgdt3306a_config), GFP_KERNEL); if (config == NULL) {
[git:media_tree/master] media: cec: cec.h: 2.1 ms -> 2100 ms
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: cec.h: 2.1 ms -> 2100 ms Author: Hans Verkuil Date:Fri Aug 18 13:12:48 2023 +0100 The transfer timeout is 2100 ms, not 2.1 ms. Fix this in the kerneldoc comment. Link: https://lore.kernel.org/linux-media/17cd1a67-3966-237c-2e0d-2d3ae618f...@xs4all.nl Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab include/media/cec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/include/media/cec.h b/include/media/cec.h index 10c9cf6058b7..c8350258f10a 100644 --- a/include/media/cec.h +++ b/include/media/cec.h @@ -173,7 +173,7 @@ struct cec_adap_ops { * case the transmit will finish, but will not retransmit * and be marked as ABORTED. * @xfer_timeout_ms: the transfer timeout in ms. - * If 0, then timeout after 2.1 ms. + * If 0, then timeout after 2100 ms. * @kthread_config:kthread used to configure a CEC adapter * @config_completion: used to signal completion of the config kthread * @kthread: main CEC processing thread
[git:media_tree/master] media: s2255: Use refcount_t instead of atomic_t for num_channels
This is an automatic generated email to let you know that the following patch were queued: Subject: media: s2255: Use refcount_t instead of atomic_t for num_channels Author: Ricardo Ribalda Date:Mon Apr 29 16:04:50 2024 +0100 Use an API that resembles more the actual use of num_channels. Found by cocci: drivers/media/usb/s2255/s2255drv.c:2362:5-24: WARNING: atomic_dec_and_test variation before object free at line 2363. drivers/media/usb/s2255/s2255drv.c:1557:5-24: WARNING: atomic_dec_and_test variation before object free at line 1558. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-11-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/s2255/s2255drv.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) --- diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 8e1de1e8bd12..a6e450181fd0 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -247,7 +247,7 @@ struct s2255_vc { struct s2255_dev { struct s2255_vc vc[MAX_CHANNELS]; struct v4l2_device v4l2_dev; - atomic_tnum_channels; + refcount_t num_channels; int frames; struct mutexlock; /* channels[].vdev.lock */ struct mutexcmdlock; /* protects cmdbuf */ @@ -1550,11 +1550,11 @@ static void s2255_video_device_release(struct video_device *vdev) container_of(vdev, struct s2255_vc, vdev); dprintk(dev, 4, "%s, chnls: %d\n", __func__, - atomic_read(>num_channels)); + refcount_read(>num_channels)); v4l2_ctrl_handler_free(>hdl); - if (atomic_dec_and_test(>num_channels)) + if (refcount_dec_and_test(>num_channels)) s2255_destroy(dev); return; } @@ -1659,7 +1659,7 @@ static int s2255_probe_v4l(struct s2255_dev *dev) "failed to register video device!\n"); break; } - atomic_inc(>num_channels); + refcount_inc(>num_channels); v4l2_info(>v4l2_dev, "V4L2 device registered as %s\n", video_device_node_name(>vdev)); @@ -1667,11 +1667,11 @@ static int s2255_probe_v4l(struct s2255_dev *dev) pr_info("Sensoray 2255 V4L driver Revision: %s\n", S2255_VERSION); /* if no channels registered, return error and probe will fail*/ - if (atomic_read(>num_channels) == 0) { + if (refcount_read(>num_channels) == 0) { v4l2_device_unregister(>v4l2_dev); return ret; } - if (atomic_read(>num_channels) != MAX_CHANNELS) + if (refcount_read(>num_channels) != MAX_CHANNELS) pr_warn("s2255: Not all channels available.\n"); return 0; } @@ -2221,7 +2221,7 @@ static int s2255_probe(struct usb_interface *interface, goto errorFWDATA1; } - atomic_set(>num_channels, 0); + refcount_set(>num_channels, 0); dev->pid = id->idProduct; dev->fw_data = kzalloc(sizeof(struct s2255_fw), GFP_KERNEL); if (!dev->fw_data) @@ -2341,12 +2341,12 @@ static void s2255_disconnect(struct usb_interface *interface) { struct s2255_dev *dev = to_s2255_dev(usb_get_intfdata(interface)); int i; - int channels = atomic_read(>num_channels); + int channels = refcount_read(>num_channels); mutex_lock(>lock); v4l2_device_disconnect(>v4l2_dev); mutex_unlock(>lock); /*see comments in the uvc_driver.c usb disconnect function */ - atomic_inc(>num_channels); + refcount_inc(>num_channels); /* unregister each video device. */ for (i = 0; i < channels; i++) video_unregister_device(>vc[i].vdev); @@ -2359,7 +2359,7 @@ static void s2255_disconnect(struct usb_interface *interface) dev->vc[i].vidstatus_ready = 1; wake_up(>vc[i].wait_vidstatus); } - if (atomic_dec_and_test(>num_channels)) + if (refcount_dec_and_test(>num_channels)) s2255_destroy(dev); dev_info(>dev, "%s\n", __func__); }
[git:media_tree/master] media: IR remote control for AVerMedia TD310
This is an automatic generated email to let you know that the following patch were queued: Subject: media: IR remote control for AVerMedia TD310 Author: Alex Volkov Date:Sun Mar 19 08:23:15 2023 + Uses NEC defaults as other non-eeprom devices. Link: https://lore.kernel.org/linux-media/2273969.FyfRTN5kjP@bootes Signed-off-by: Alex Volkov Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/dvb-usb-v2/af9035.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) --- diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 4eb7dd4599b7..0d2c42819d39 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -868,6 +868,9 @@ static int af9035_read_config(struct dvb_usb_device *d) if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) && (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_TD310)) { state->it930x_addresses = 1; + /* TD310 RC works with NEC defaults */ + state->ir_mode = 0x05; + state->ir_type = 0x00; } return 0; } @@ -2066,6 +2069,11 @@ static const struct dvb_usb_device_properties it930x_props = { .tuner_attach = it930x_tuner_attach, .tuner_detach = it930x_tuner_detach, .init = it930x_init, + /* +* dvb_usbv2_remote_init() calls rc_config() only for those devices +* which have non-empty rc_map, so it's safe to enable it for every IT930x +*/ + .get_rc_config = af9035_get_rc_config, .get_stream_config = af9035_get_stream_config, .get_adapter_count = af9035_get_adapter_count, @@ -2157,7 +2165,7 @@ static const struct usb_device_id af9035_id_table[] = { { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9303, _props, "ITE 9303 Generic", NULL) }, { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD310, - _props, "AVerMedia TD310 DVB-T2", NULL) }, + _props, "AVerMedia TD310 DVB-T2", RC_MAP_AVERMEDIA_RM_KS) }, { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x0100, _props, "Logilink VG0022A", NULL) }, { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_TC2_STICK,
[git:media_tree/master] media: intel/ipu6: Fix direct dependency Kconfig error
This is an automatic generated email to let you know that the following patch were queued: Subject: media: intel/ipu6: Fix direct dependency Kconfig error Author: Ricardo Ribalda Date:Wed May 1 14:08:12 2024 +0100 VIDEO_INTEL_IPU6 selects IPU6_BRIDGE, but they have different set of dependencies. It fixes this warning: WARNING: unmet direct dependencies detected for IPU_BRIDGE Depends on [n]: MEDIA_SUPPORT [=y] && PCI [=y] && MEDIA_PCI_SUPPORT [=y] && I2C [=y] && ACPI [=n] Selected by [y]: - VIDEO_INTEL_IPU6 [=y] && MEDIA_SUPPORT [=y] && PCI [=y] && MEDIA_PCI_SUPPORT [=y] && (ACPI [=n] || COMPILE_TEST [=y]) && VIDEO_DEV [=y] && X86 [=y] && X86_64 [=y] && HAS_DMA [=y] Signed-off-by: Ricardo Ribalda Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- diff --git a/drivers/media/pci/intel/Kconfig b/drivers/media/pci/intel/Kconfig index 04cb3d253486..d9fcddce028b 100644 --- a/drivers/media/pci/intel/Kconfig +++ b/drivers/media/pci/intel/Kconfig @@ -6,7 +6,8 @@ source "drivers/media/pci/intel/ivsc/Kconfig" config IPU_BRIDGE tristate "Intel IPU Bridge" - depends on I2C && ACPI + depends on ACPI || COMPILE_TEST + depends on I2C help The IPU bridge is a helper library for Intel IPU drivers to function on systems shipped with Windows.
[git:media_tree/master] media: pci: mgb4: Refactor struct resources
This is an automatic generated email to let you know that the following patch were queued: Subject: media: pci: mgb4: Refactor struct resources Author: Ricardo Ribalda Date:Mon Apr 29 16:04:40 2024 +0100 The struct resource end field signifies the end address not the relative offset from the start field i.e size == (end - start) + 1. Amend the .end field to specify the end address not the relative size from the offset as is currently given. Fixes cocci check: drivers/media/pci/mgb4/mgb4_regs.c:13:22-25: WARNING: Suspicious code. resource_size is maybe missing with res Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-1-3c4865f5a...@chromium.org Reviewed-by: Martin Tůma Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/mgb4/mgb4_core.c | 4 ++-- drivers/media/pci/mgb4/mgb4_regs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c index 9bcf10a77fd3..60498a5abebf 100644 --- a/drivers/media/pci/mgb4/mgb4_core.c +++ b/drivers/media/pci/mgb4/mgb4_core.c @@ -493,13 +493,13 @@ static int mgb4_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct mgb4_dev *mgbdev; struct resource video = { .start = 0x0, - .end= 0x100, + .end= 0xff, .flags = IORESOURCE_MEM, .name = "mgb4-video", }; struct resource cmt = { .start = 0x1000, - .end= 0x1800, + .end= 0x17ff, .flags = IORESOURCE_MEM, .name = "mgb4-cmt", }; diff --git a/drivers/media/pci/mgb4/mgb4_regs.c b/drivers/media/pci/mgb4/mgb4_regs.c index 53d4e4503a74..31befd722d72 100644 --- a/drivers/media/pci/mgb4/mgb4_regs.c +++ b/drivers/media/pci/mgb4/mgb4_regs.c @@ -10,7 +10,7 @@ int mgb4_regs_map(struct resource *res, struct mgb4_regs *regs) { regs->mapbase = res->start; - regs->mapsize = res->end - res->start; + regs->mapsize = resource_size(res); if (!request_mem_region(regs->mapbase, regs->mapsize, res->name)) return -EINVAL;
[git:media_tree/master] media: intel/ipu6: Fix build with !ACPI
This is an automatic generated email to let you know that the following patch were queued: Subject: media: intel/ipu6: Fix build with !ACPI Author: Ricardo Ribalda Date:Wed May 1 14:08:13 2024 +0100 Modify the code so it can be compiled tested in configurations that do not have ACPI enabled. It fixes the following errors: drivers/media/pci/intel/ipu-bridge.c:103:30: error: implicit declaration of function ‘acpi_device_handle’; did you mean ‘acpi_fwnode_handle’? [-Werror=implicit-function-declaration] drivers/media/pci/intel/ipu-bridge.c:103:30: warning: initialization of ‘acpi_handle’ {aka ‘void *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] drivers/media/pci/intel/ipu-bridge.c:110:17: error: implicit declaration of function ‘for_each_acpi_dev_match’ [-Werror=implicit-function-declaration] drivers/media/pci/intel/ipu-bridge.c:110:74: error: expected ‘;’ before ‘for_each_acpi_consumer_dev’ drivers/media/pci/intel/ipu-bridge.c:104:29: warning: unused variable ‘consumer’ [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:103:21: warning: unused variable ‘handle’ [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:166:38: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:185:43: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:191:30: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:196:30: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:202:30: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:223:31: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:236:18: error: implicit declaration of function ‘acpi_get_physical_device_location’ [-Werror=implicit-function-declaration] drivers/media/pci/intel/ipu-bridge.c:236:56: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:238:31: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:256:31: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:275:31: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:280:30: error: invalid use of undefined type ‘struct acpi_device’ drivers/media/pci/intel/ipu-bridge.c:469:26: error: implicit declaration of function ‘acpi_device_hid’; did you mean ‘dmi_device_id’? [-Werror=implicit-function-declaration] drivers/media/pci/intel/ipu-bridge.c:468:74: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=] drivers/media/pci/intel/ipu-bridge.c:637:58: error: expected ‘;’ before ‘{’ token drivers/media/pci/intel/ipu-bridge.c:696:1: warning: label ‘err_put_adev’ defined but not used [-Wunused-label] drivers/media/pci/intel/ipu-bridge.c:693:1: warning: label ‘err_put_ivsc’ defined but not used [-Wunused-label] drivers/media/pci/intel/ipu-bridge.c:691:1: warning: label ‘err_free_swnodes’ defined but not used [-Wunused-label] drivers/media/pci/intel/ipu-bridge.c:632:40: warning: unused variable ‘primary’ [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:632:31: warning: unused variable ‘fwnode’ [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:733:73: error: expected ‘;’ before ‘{’ token drivers/media/pci/intel/ipu-bridge.c:725:24: warning: unused variable ‘csi_dev’ [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:724:43: warning: unused variable ‘adev’ [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:599:12: warning: ‘ipu_bridge_instantiate_ivsc’ defined but not used [-Wunused-function] drivers/media/pci/intel/ipu-bridge.c:444:13: warning: ‘ipu_bridge_create_connection_swnodes’ defined but not used [-Wunused-function] drivers/media/pci/intel/ipu-bridge.c:297:13: warning: ‘ipu_bridge_create_fwnode_properties’ defined but not used [-Wunused-function] drivers/media/pci/intel/ipu-bridge.c:155:12: warning: ‘ipu_bridge_check_ivsc_dev’ defined but not used [-Wunused-function] Signed-off-by: Ricardo Ribalda Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 66 +--- 1 file changed, 47 insertions(+), 19 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index e994db4f4d91..61750cc98d70 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -15,6 +15,8 @@ #include #include +#define ADEV_DEV(adev) ACPI_PTR(&((adev)->dev)) + /* * 92335fcf-3203-4472-af93-7b4453ac29da * @@ -87,6 +89,7 @@ static const char * const ipu_vcm_types[] = { "lc898212axb", }; +#if IS_ENABLED(CONFIG_ACPI) /* * Used to figure out IVSC acpi device by ipu_bridge_
[git:media_tree/master] media: mtk-vcodec: potential null pointer deference in SCP
This is an automatic generated email to let you know that the following patch were queued: Subject: media: mtk-vcodec: potential null pointer deference in SCP Author: Fullway Wang Date:Thu Jan 18 02:35:06 2024 + The return value of devm_kzalloc() needs to be checked to avoid NULL pointer deference. This is similar to CVE-2022-3113. Link: https://lore.kernel.org/linux-media/ph7pr20mb5925094dae3fd750c7e39e01bf...@ph7pr20mb5925.namprd20.prod.outlook.com Signed-off-by: Fullway Wang Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c | 2 ++ 1 file changed, 2 insertions(+) --- diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c index 6bbe55de6ce9..ff23b225db70 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c @@ -79,6 +79,8 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use } fw = devm_kzalloc(_dev->dev, sizeof(*fw), GFP_KERNEL); + if (!fw) + return ERR_PTR(-ENOMEM); fw->type = SCP; fw->ops = _vcodec_rproc_msg; fw->scp = scp;
[git:media_tree/master] media: mxl5xx: Move xpt structures off stack
This is an automatic generated email to let you know that the following patch were queued: Subject: media: mxl5xx: Move xpt structures off stack Author: Nathan Chancellor Date:Fri Jan 12 00:40:36 2024 + When building for LoongArch with clang 18.0.0, the stack usage of probe() is larger than the allowed 2048 bytes: drivers/media/dvb-frontends/mxl5xx.c:1698:12: warning: stack frame size (2368) exceeds limit (2048) in 'probe' [-Wframe-larger-than] 1698 | static int probe(struct mxl *state, struct mxl5xx_cfg *cfg) |^ 1 warning generated. This is the result of the linked LLVM commit, which changes how the arrays of structures in config_ts() get handled with CONFIG_INIT_STACK_ZERO and CONFIG_INIT_STACK_PATTERN, which causes the above warning in combination with inlining, as config_ts() gets inlined into probe(). This warning can be easily fixed by moving the array of structures off of the stackvia 'static const', which is a better location for these variables anyways because they are static data that is only ever read from, never modified, so allocating the stack space is wasteful. This drops the stack usage from 2368 bytes to 256 bytes with the same compiler and configuration. Link: https://lore.kernel.org/linux-media/20240111-dvb-mxl5xx-move-structs-off-stack-v1-1-ca4230e67...@kernel.org Cc: sta...@vger.kernel.org Closes: https://github.com/ClangBuiltLinux/linux/issues/1977 Link: https://github.com/llvm/llvm-project/commit/afe8b93ffdfef5d8879e1894b9d7dda40dee2b8d Signed-off-by: Nathan Chancellor Reviewed-by: Miguel Ojeda Tested-by: Miguel Ojeda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/mxl5xx.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) --- diff --git a/drivers/media/dvb-frontends/mxl5xx.c b/drivers/media/dvb-frontends/mxl5xx.c index 4ebbcf05cc09..91e9c378397c 100644 --- a/drivers/media/dvb-frontends/mxl5xx.c +++ b/drivers/media/dvb-frontends/mxl5xx.c @@ -1381,57 +1381,57 @@ static int config_ts(struct mxl *state, enum MXL_HYDRA_DEMOD_ID_E demod_id, u32 nco_count_min = 0; u32 clk_type = 0; - struct MXL_REG_FIELD_T xpt_sync_polarity[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_sync_polarity[MXL_HYDRA_DEMOD_MAX] = { {0x90700010, 8, 1}, {0x90700010, 9, 1}, {0x90700010, 10, 1}, {0x90700010, 11, 1}, {0x90700010, 12, 1}, {0x90700010, 13, 1}, {0x90700010, 14, 1}, {0x90700010, 15, 1} }; - struct MXL_REG_FIELD_T xpt_clock_polarity[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_clock_polarity[MXL_HYDRA_DEMOD_MAX] = { {0x90700010, 16, 1}, {0x90700010, 17, 1}, {0x90700010, 18, 1}, {0x90700010, 19, 1}, {0x90700010, 20, 1}, {0x90700010, 21, 1}, {0x90700010, 22, 1}, {0x90700010, 23, 1} }; - struct MXL_REG_FIELD_T xpt_valid_polarity[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_valid_polarity[MXL_HYDRA_DEMOD_MAX] = { {0x90700014, 0, 1}, {0x90700014, 1, 1}, {0x90700014, 2, 1}, {0x90700014, 3, 1}, {0x90700014, 4, 1}, {0x90700014, 5, 1}, {0x90700014, 6, 1}, {0x90700014, 7, 1} }; - struct MXL_REG_FIELD_T xpt_ts_clock_phase[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_ts_clock_phase[MXL_HYDRA_DEMOD_MAX] = { {0x90700018, 0, 3}, {0x90700018, 4, 3}, {0x90700018, 8, 3}, {0x90700018, 12, 3}, {0x90700018, 16, 3}, {0x90700018, 20, 3}, {0x90700018, 24, 3}, {0x90700018, 28, 3} }; - struct MXL_REG_FIELD_T xpt_lsb_first[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_lsb_first[MXL_HYDRA_DEMOD_MAX] = { {0x907C, 16, 1}, {0x907C, 17, 1}, {0x907C, 18, 1}, {0x907C, 19, 1}, {0x907C, 20, 1}, {0x907C, 21, 1}, {0x907C, 22, 1}, {0x907C, 23, 1} }; - struct MXL_REG_FIELD_T xpt_sync_byte[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_sync_byte[MXL_HYDRA_DEMOD_MAX] = { {0x90700010, 0, 1}, {0x90700010, 1, 1}, {0x90700010, 2, 1}, {0x90700010, 3, 1}, {0x90700010, 4, 1}, {0x90700010, 5, 1}, {0x90700010, 6, 1}, {0x90700010, 7, 1} }; - struct MXL_REG_FIELD_T xpt_enable_output[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_enable_output[MXL_HYDRA_DEMOD_MAX] = { {0x907C, 0, 1}, {0x907C, 1, 1}, {0x907C, 2, 1}, {0x907C, 3, 1}, {0x907C, 4, 1}, {0x907C, 5, 1}, {0x907C, 6, 1}, {0x907C, 7, 1} }; - struct MXL_REG_FIELD_T xpt_err_replace_sync[MXL_HYDRA_DEMOD_MAX] = { + static const struct
[git:media_tree/master] media: platform: mtk-mdp3: Use refcount_t for job_count
This is an automatic generated email to let you know that the following patch were queued: Subject: media: platform: mtk-mdp3: Use refcount_t for job_count Author: Ricardo Ribalda Date:Mon Apr 29 16:04:51 2024 +0100 Use an API that resembles more the actual use of job_count. Found by cocci: drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:527:5-24: WARNING: atomic_dec_and_test variation before object free at line 541. drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:578:6-25: WARNING: atomic_dec_and_test variation before object free at line 581. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-12-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 10 +- drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 6 +++--- drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h | 2 +- drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) --- diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c index 1d64bac34b90..ea2ea119dd2a 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c @@ -524,7 +524,7 @@ static void mdp_auto_release_work(struct work_struct *work) mdp_comp_clocks_off(>pdev->dev, cmd->comps, cmd->num_comps); - if (atomic_dec_and_test(>job_count)) { + if (refcount_dec_and_test(>job_count)) { if (cmd->mdp_ctx) mdp_m2m_job_finish(cmd->mdp_ctx); @@ -575,7 +575,7 @@ static void mdp_handle_cmdq_callback(struct mbox_client *cl, void *mssg) mdp_comp_clocks_off(>pdev->dev, cmd->comps, cmd->num_comps); - if (atomic_dec_and_test(>job_count)) + if (refcount_dec_and_test(>job_count)) wake_up(>callback_wq); mdp_cmdq_pkt_destroy(>pkt); @@ -724,9 +724,9 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) int i, ret; u8 pp_used = __get_pp_num(param->param->type); - atomic_set(>job_count, pp_used); + refcount_set(>job_count, pp_used); if (atomic_read(>suspended)) { - atomic_set(>job_count, 0); + refcount_set(>job_count, 0); return -ECANCELED; } @@ -764,7 +764,7 @@ err_clock_off: mdp_comp_clocks_off(>pdev->dev, cmd[i]->comps, cmd[i]->num_comps); err_cancel_job: - atomic_set(>job_count, 0); + refcount_set(>job_count, 0); return ret; } diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c index 5209f531ef8d..c1f3bf98120a 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c @@ -380,14 +380,14 @@ static int __maybe_unused mdp_suspend(struct device *dev) atomic_set(>suspended, 1); - if (atomic_read(>job_count)) { + if (refcount_read(>job_count)) { ret = wait_event_timeout(mdp->callback_wq, -!atomic_read(>job_count), +!refcount_read(>job_count), 2 * HZ); if (ret == 0) { dev_err(dev, "%s:flushed cmdq task incomplete, count=%d\n", - __func__, atomic_read(>job_count)); + __func__, refcount_read(>job_count)); return -EBUSY; } } diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h index 8c09e984fd01..430251f63754 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h @@ -134,7 +134,7 @@ struct mdp_dev { /* synchronization protect for m2m device operation */ struct mutexm2m_lock; atomic_tsuspended; - atomic_tjob_count; + refcount_t job_count; }; struct mdp_pipe_info { diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c index 35a8b059bde5..0e69128a3772 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c @@ -104,14 +104,14 @@ static void mdp_m2m_devi
[git:media_tree/master] media: dw2102: fix a potential buffer overflow
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dw2102: fix a potential buffer overflow Author: Mauro Carvalho Chehab Date:Mon Apr 29 15:15:05 2024 +0100 As pointed by smatch: drivers/media/usb/dvb-usb/dw2102.c:802 su3000_i2c_transfer() error: __builtin_memcpy() '>data[4]' too small (64 vs 67) That seemss to be due to a wrong copy-and-paste. Fixes: 0e148a522b84 ("media: dw2102: Don't translate i2c read into write") Reported-by: Hans Verkuil Reviewed-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/dvb-usb/dw2102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index 03b411ad64bb..79e2ccf974c9 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -789,7 +789,7 @@ static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], if (msg[j].flags & I2C_M_RD) { /* single read */ - if (1 + msg[j].len > sizeof(state->data)) { + if (4 + msg[j].len > sizeof(state->data)) { warn("i2c rd: len=%d is too big!\n", msg[j].len); num = -EOPNOTSUPP; break;
[git:media_tree/master] media: common: saa7146: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: common: saa7146: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:52 2024 +0100 Simplifies the code. Found by cocci: drivers/media/common/saa7146/saa7146_hlp.c:125:36-37: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:154:41-42: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:286:35-36: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:289:35-36: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-13-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/common/saa7146/saa7146_hlp.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) --- diff --git a/drivers/media/common/saa7146/saa7146_hlp.c b/drivers/media/common/saa7146/saa7146_hlp.c index 7569d8cdd4d8..fe3348af543e 100644 --- a/drivers/media/common/saa7146/saa7146_hlp.c +++ b/drivers/media/common/saa7146/saa7146_hlp.c @@ -122,7 +122,7 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev, xacm = 0; /* set horizontal filter parameters (CXY = CXUV) */ - cxy = hps_h_coeff_tab[( (xpsc - 1) < 63 ? (xpsc - 1) : 63 )].hps_coeff; + cxy = hps_h_coeff_tab[min(xpsc - 1, 63)].hps_coeff; cxuv = cxy; /* calculate and set horizontal fine scale (xsci) */ @@ -151,7 +151,7 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev, xacm = 0; /* get best match in the table of attenuations for horizontal scaling */ - h_atten = hps_h_coeff_tab[( (xpsc - 1) < 63 ? (xpsc - 1) : 63 )].weight_sum; + h_atten = hps_h_coeff_tab[min(xpsc - 1, 63)].weight_sum; for (i = 0; h_attenuation[i] != 0; i++) { if (h_attenuation[i] >= h_atten) @@ -283,10 +283,10 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field } /* get filter coefficients for cya, cyb from table hps_v_coeff_tab */ - cya_cyb = hps_v_coeff_tab[ (yacl < 63 ? yacl : 63 ) ].hps_coeff; + cya_cyb = hps_v_coeff_tab[min(yacl, 63)].hps_coeff; /* get best match in the table of attenuations for vertical scaling */ - v_atten = hps_v_coeff_tab[ (yacl < 63 ? yacl : 63 ) ].weight_sum; + v_atten = hps_v_coeff_tab[min(yacl, 63)].weight_sum; for (i = 0; v_attenuation[i] != 0; i++) { if (v_attenuation[i] >= v_atten)
[git:media_tree/master] media: dvb-frontends: drx39xyj: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dvb-frontends: drx39xyj: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:53 2024 +0100 Replace ternary assignments with min() to simplify and make the code more readable. Found by cocci: drivers/media/dvb-frontends/drx39xyj/drxj.c:1447:23-24: WARNING opportunity for min() drivers/media/dvb-frontends/drx39xyj/drxj.c:1662:21-22: WARNING opportunity for min() drivers/media/dvb-frontends/drx39xyj/drxj.c:1685:24-25: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-14-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/drx39xyj/drxj.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) --- diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 1ef53754bc03..6fcaf07e1b82 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -1445,8 +1445,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, /* Read block from I2C */ do { - u16 todo = (datasize < DRXDAP_MAX_RCHUNKSIZE ? - datasize : DRXDAP_MAX_RCHUNKSIZE); + u16 todo = min(datasize, DRXDAP_MAX_RCHUNKSIZE); bufx = 0; @@ -1660,7 +1659,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, Address must be rewritten because HI is reset after data transport and expects an address. */ - todo = (block_size < datasize ? block_size : datasize); + todo = min(block_size, datasize); if (todo == 0) { u16 overhead_size_i2c_addr = 0; u16 data_block_size = 0; @@ -1682,9 +1681,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, first_err = st; } bufx = 0; - todo = - (data_block_size < -datasize ? data_block_size : datasize); + todo = min(data_block_size, datasize); } memcpy([bufx], data, todo); /* write (address if can do and) data */
[git:media_tree/master] media: imx214: Fix the error handling in imx214_probe()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: imx214: Fix the error handling in imx214_probe() Author: Zheyu Ma Date:Tue May 10 12:48:52 2022 +0100 The driver should disable regulators when fails to probe. Link: https://lore.kernel.org/linux-media/20220510114852.1719018-1-zheyum...@gmail.com Signed-off-by: Zheyu Ma Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/imx214.c | 1 + 1 file changed, 1 insertion(+) --- diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index 10b6ad66d126..4962cfe7c83d 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -1114,6 +1114,7 @@ free_ctrl: v4l2_ctrl_handler_free(>ctrls); error_power_off: pm_runtime_disable(imx214->dev); + regulator_bulk_disable(IMX214_NUM_SUPPLIES, imx214->supplies); return ret; }
[git:media_tree/master] media: verisilicon: Correct a typo in H1_REG_MAD_CTRL_MAD_THRESHOLD
This is an automatic generated email to let you know that the following patch were queued: Subject: media: verisilicon: Correct a typo in H1_REG_MAD_CTRL_MAD_THRESHOLD Author: Andrzej Pietrasiewicz Date:Thu Nov 16 15:48:12 2023 + It's a THRESHOLD and not a THREDHOLD. Link: https://lore.kernel.org/linux-media/20231116154816.70959-3-andrze...@collabora.com Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Chen-Yu Tsai Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/verisilicon/hantro_h1_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/platform/verisilicon/hantro_h1_regs.h b/drivers/media/platform/verisilicon/hantro_h1_regs.h index b45e6e104b23..8650cc489392 100644 --- a/drivers/media/platform/verisilicon/hantro_h1_regs.h +++ b/drivers/media/platform/verisilicon/hantro_h1_regs.h @@ -89,7 +89,7 @@ #define H1_REG_STR_BUF_LIMIT 0x060 #define H1_REG_MAD_CTRL0x064 #defineH1_REG_MAD_CTRL_QP_ADJUST(x)((x) << 28) -#defineH1_REG_MAD_CTRL_MAD_THREDHOLD(x)((x) << 22) +#defineH1_REG_MAD_CTRL_MAD_THRESHOLD(x)((x) << 22) #defineH1_REG_MAD_CTRL_QP_SUM_DIV2(x) ((x)) #define H1_REG_ADDR_VP8_PROB_CNT 0x068 #define H1_REG_QP_VAL 0x06c
[git:media_tree/master] media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: cec-adap: always cancel work in cec_transmit_msg_fh Author: Hans Verkuil Date:Fri Feb 23 12:24:38 2024 + Do not check for !data->completed, just always call cancel_delayed_work_sync(). This fixes a small race condition. Signed-off-by: Hans Verkuil Reported-by: Yang, Chenyuan Closes: https://lore.kernel.org/linux-media/ph7pr11mb57688e64ade4fe82e658d86da0...@ph7pr11mb5768.namprd11.prod.outlook.com/ Fixes: 490d84f6d73c ("media: cec: forgot to cancel delayed work") Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/core/cec-adap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c index 559a172ebc6c..6fc7de744ee9 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -936,8 +936,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, */ mutex_unlock(>lock); wait_for_completion_killable(>c); - if (!data->completed) - cancel_delayed_work_sync(>work); + cancel_delayed_work_sync(>work); mutex_lock(>lock); /* Cancel the transmit if it was interrupted */
[git:media_tree/master] media: dt-bindings: media: i2c: Rename ov8856.yaml
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dt-bindings: media: i2c: Rename ov8856.yaml Author: Lad Prabhakar Date:Fri Sep 16 12:09:55 2022 +0100 Rename 'ov8856.yaml' as 'ovti,ov8856.yaml' and update the MAINTAINERS file entry accordingly. All the Omnivision sensor DT bindings have vendor prefix "ovti," to their file name hence this renaming. Link: https://lore.kernel.org/linux-media/20220916110955.23757-1-prabhakar.mahadev-lad...@bp.renesas.com Signed-off-by: Lad Prabhakar Acked-by: Krzysztof Kozlowski Signed-off-by: Mauro Carvalho Chehab .../devicetree/bindings/media/i2c/{ov8856.yaml => ovti,ov8856.yaml} | 2 +- MAINTAINERS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- diff --git a/Documentation/devicetree/bindings/media/i2c/ov8856.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml similarity index 98% rename from Documentation/devicetree/bindings/media/i2c/ov8856.yaml rename to Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml index 816dac9c6f60..3f6f72c35485 100644 --- a/Documentation/devicetree/bindings/media/i2c/ov8856.yaml +++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml @@ -2,7 +2,7 @@ # Copyright (c) 2019 MediaTek Inc. %YAML 1.2 --- -$id: http://devicetree.org/schemas/media/i2c/ov8856.yaml# +$id: http://devicetree.org/schemas/media/i2c/ovti,ov8856.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Omnivision OV8856 CMOS Sensor diff --git a/MAINTAINERS b/MAINTAINERS index 5a178aaf21b3..01b86927a7ad 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16414,7 +16414,7 @@ M: Sakari Ailus L: linux-me...@vger.kernel.org S: Maintained T: git git://linuxtv.org/media_tree.git -F: Documentation/devicetree/bindings/media/i2c/ov8856.yaml +F: Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml F: drivers/media/i2c/ov8856.c OMNIVISION OV8858 SENSOR DRIVER
[git:media_tree/master] media: bcm2835-unicam: Fix build with !PM
This is an automatic generated email to let you know that the following patch were queued: Subject: media: bcm2835-unicam: Fix build with !PM Author: Ricardo Ribalda Date:Wed May 1 14:08:09 2024 +0100 The driver can only match the device vide the DT table, so the table should always be used, of_match_ptr does not make sense here. It fixes this warning: drivers/media/platform/broadcom/bcm2835-unicam.c:2724:34: warning: ‘unicam_of_match’ defined but not used [-Wunused-const-variable=] Signed-off-by: Ricardo Ribalda Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/broadcom/bcm2835-unicam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c index bd2bbb53070e..c590e26fe2cf 100644 --- a/drivers/media/platform/broadcom/bcm2835-unicam.c +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c @@ -2733,7 +2733,7 @@ static struct platform_driver unicam_driver = { .driver = { .name = UNICAM_MODULE_NAME, .pm = pm_ptr(_pm_ops), - .of_match_table = of_match_ptr(unicam_of_match), + .of_match_table = unicam_of_match, }, };
[git:media_tree/master] media: si2165: Remove redundant NULL check before release_firmware() call
This is an automatic generated email to let you know that the following patch were queued: Subject: media: si2165: Remove redundant NULL check before release_firmware() call Author: Minghao Chi Date:Mon Jun 6 02:44:33 2022 +0100 release_firmware() checks for NULL pointers internally so checking before calling it is redundant. Link: https://lore.kernel.org/linux-media/20220606014433.290667-1-chi.ming...@zte.com.cn Reported-by: Zeal Robot Signed-off-by: Minghao Chi Acked-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/si2165.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) --- diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 434d003bf397..013d423d3263 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -513,10 +513,8 @@ static int si2165_upload_firmware(struct si2165_state *state) ret = 0; state->firmware_loaded = true; error: - if (fw) { - release_firmware(fw); - fw = NULL; - } + release_firmware(fw); + fw = NULL; return ret; }
[git:media_tree/master] media: as102: avoid GFP_ATOMIC
This is an automatic generated email to let you know that the following patch were queued: Subject: media: as102: avoid GFP_ATOMIC Author: Oliver Neukum Date:Tue May 17 12:10:49 2022 +0100 No need for GFP_ATOMIC during probe() Link: https://lore.kernel.org/linux-media/20220517111049.25611-1-oneu...@suse.com Signed-off-by: Oliver Neukum Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/as102/as102_usb_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/usb/as102/as102_usb_drv.c b/drivers/media/usb/as102/as102_usb_drv.c index 6b380144d6c2..e0ef66a522e2 100644 --- a/drivers/media/usb/as102/as102_usb_drv.c +++ b/drivers/media/usb/as102/as102_usb_drv.c @@ -259,7 +259,7 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) for (i = 0; i < MAX_STREAM_URB; i++) { struct urb *urb; - urb = usb_alloc_urb(0, GFP_ATOMIC); + urb = usb_alloc_urb(0, GFP_KERNEL); if (urb == NULL) { as102_free_usb_stream_buffer(dev); return -ENOMEM;
[git:media_tree/master] media: staging: media: starfive: Clean pad selection in isp_try_format()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: staging: media: starfive: Clean pad selection in isp_try_format() Author: Changhuang Liang Date:Tue Mar 12 02:45:20 2024 + The code to select isp_dev->formats[] is overly complicated. We can just use the "pad" as the index. This will making adding new pads easier in future patches. No functional change. Link: https://lore.kernel.org/linux-media/20240312024520.11022-1-changhuang.li...@starfivetech.com Signed-off-by: Changhuang Liang Reviewed-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/starfive/camss/stf-isp.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) --- diff --git a/drivers/staging/media/starfive/camss/stf-isp.c b/drivers/staging/media/starfive/camss/stf-isp.c index d50616ef351e..4e6e26736852 100644 --- a/drivers/staging/media/starfive/camss/stf-isp.c +++ b/drivers/staging/media/starfive/camss/stf-isp.c @@ -10,9 +10,6 @@ #include "stf-camss.h" -#define SINK_FORMATS_INDEX 0 -#define SOURCE_FORMATS_INDEX 1 - static int isp_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, struct v4l2_subdev_selection *sel); @@ -94,10 +91,7 @@ static void isp_try_format(struct stf_isp_dev *isp_dev, return; } - if (pad == STF_ISP_PAD_SINK) - formats = _dev->formats[SINK_FORMATS_INDEX]; - else if (pad == STF_ISP_PAD_SRC) - formats = _dev->formats[SOURCE_FORMATS_INDEX]; + formats = _dev->formats[pad]; fmt->width = clamp_t(u32, fmt->width, STFCAMSS_FRAME_MIN_WIDTH, STFCAMSS_FRAME_MAX_WIDTH); @@ -123,7 +117,7 @@ static int isp_enum_mbus_code(struct v4l2_subdev *sd, if (code->index >= ARRAY_SIZE(isp_formats_sink)) return -EINVAL; - formats = _dev->formats[SINK_FORMATS_INDEX]; + formats = _dev->formats[code->pad]; code->code = formats->fmts[code->index].code; } else { struct v4l2_mbus_framefmt *sink_fmt;
[git:media_tree/master] media: cec: core: avoid confusing "transmit timed out" message
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: core: avoid confusing "transmit timed out" message Author: Hans Verkuil Date:Tue Apr 30 11:13:47 2024 +0100 If, when waiting for a transmit to finish, the wait is interrupted, then you might get a "transmit timed out" message, even though the transmit was interrupted and did not actually time out. Set transmit_in_progress_aborted to true if the wait_for_completion_killable() call was interrupted and ensure that the transmit is properly marked as ABORTED. Signed-off-by: Hans Verkuil Reported-by: Yang, Chenyuan Closes: https://lore.kernel.org/linux-media/ph7pr11mb57688e64ade4fe82e658d86da0...@ph7pr11mb5768.namprd11.prod.outlook.com/ Fixes: 590a8e564c6e ("media: cec: abort if the current transmit was canceled") Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/core/cec-adap.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) --- diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c index a493cbce2456..da09834990b8 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -490,6 +490,15 @@ int cec_thread_func(void *_adap) goto unlock; } + if (adap->transmit_in_progress && + adap->transmit_in_progress_aborted) { + if (adap->transmitting) + cec_data_cancel(adap->transmitting, + CEC_TX_STATUS_ABORTED, 0); + adap->transmit_in_progress = false; + adap->transmit_in_progress_aborted = false; + goto unlock; + } if (adap->transmit_in_progress && timeout) { /* * If we timeout, then log that. Normally this does @@ -771,6 +780,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, { struct cec_data *data; bool is_raw = msg_is_raw(msg); + int err; if (adap->devnode.unregistered) return -ENODEV; @@ -935,10 +945,13 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, * Release the lock and wait, retake the lock afterwards. */ mutex_unlock(>lock); - wait_for_completion_killable(>c); + err = wait_for_completion_killable(>c); cancel_delayed_work_sync(>work); mutex_lock(>lock); + if (err) + adap->transmit_in_progress_aborted = true; + /* Cancel the transmit if it was interrupted */ if (!data->completed) { if (data->msg.tx_status & CEC_TX_STATUS_OK)
[git:media_tree/master] media: intel/ipu6: Switch to RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS
This is an automatic generated email to let you know that the following patch were queued: Subject: media: intel/ipu6: Switch to RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS Author: Ricardo Ribalda Date:Wed May 1 14:08:11 2024 +0100 Replace the old helpers with its modern alternative. Now we do not need to set '__maybe_unused' annotations when we are not enabling the PM configurations. It fixes the following warnings: drivers/media/pci/intel/ipu6/ipu6.c:841:12: warning: ‘ipu6_runtime_resume’ defined but not used [-Wunused-function] drivers/media/pci/intel/ipu6/ipu6.c:806:12: warning: ‘ipu6_resume’ defined but not used [-Wunused-function] drivers/media/pci/intel/ipu6/ipu6.c:801:12: warning: ‘ipu6_suspend’ defined but not used [-Wunused-function] Signed-off-by: Ricardo Ribalda Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu6/ipu6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c index 4b1f69d14d71..7bcd9c5a381a 100644 --- a/drivers/media/pci/intel/ipu6/ipu6.c +++ b/drivers/media/pci/intel/ipu6/ipu6.c @@ -860,8 +860,8 @@ static int ipu6_runtime_resume(struct device *dev) } static const struct dev_pm_ops ipu6_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(_suspend, _resume) - SET_RUNTIME_PM_OPS(_suspend, _runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(_suspend, _resume) + RUNTIME_PM_OPS(_suspend, _runtime_resume, NULL) }; MODULE_DEVICE_TABLE(pci, ipu6_pci_tbl);
[git:media_tree/master] media: flexcop: unneeded ATOMIC
This is an automatic generated email to let you know that the following patch were queued: Subject: media: flexcop: unneeded ATOMIC Author: Oliver Neukum Date:Tue May 17 14:11:08 2022 +0100 No need for GFP_ATOMIC during probe() Link: https://lore.kernel.org/linux-media/20220517131109.28371-1-oneu...@suse.com Signed-off-by: Oliver Neukum Reviewed-by: Johan Hovold Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/b2c2/flexcop-usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c index 790787f0eba8..0f807da4b65a 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -448,7 +448,7 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb) /* creating iso urbs */ for (i = 0; i < B2C2_USB_NUM_ISO_URB; i++) { fc_usb->iso_urb[i] = usb_alloc_urb(B2C2_USB_FRAMES_PER_ISO, - GFP_ATOMIC); + GFP_KERNEL); if (fc_usb->iso_urb[i] == NULL) { ret = -ENOMEM; goto urb_error; @@ -481,7 +481,7 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb) frame_offset += frame_size; } - if ((ret = usb_submit_urb(fc_usb->iso_urb[i],GFP_ATOMIC))) { + if ((ret = usb_submit_urb(fc_usb->iso_urb[i],GFP_KERNEL))) { err("submitting urb %d failed with %d.", i, ret); goto urb_error; }
[git:media_tree/master] media: verisilicon Correct a typo in H1_REG_ENC_CTRL2_DEBLOCKING_FILTER_MODE
This is an automatic generated email to let you know that the following patch were queued: Subject: media: verisilicon Correct a typo in H1_REG_ENC_CTRL2_DEBLOCKING_FILTER_MODE Author: Andrzej Pietrasiewicz Date:Thu Nov 16 15:48:11 2023 + It's a FILTER and not FILETER. Link: https://lore.kernel.org/linux-media/20231116154816.70959-2-andrze...@collabora.com Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Chen-Yu Tsai Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/verisilicon/hantro_h1_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/platform/verisilicon/hantro_h1_regs.h b/drivers/media/platform/verisilicon/hantro_h1_regs.h index 30e7e7b920b5..b45e6e104b23 100644 --- a/drivers/media/platform/verisilicon/hantro_h1_regs.h +++ b/drivers/media/platform/verisilicon/hantro_h1_regs.h @@ -62,7 +62,7 @@ #defineH1_REG_ENC_CTRL1_INTRA_PRED_MODE(x) ((x) << 16) #defineH1_REG_ENC_CTRL1_FRAME_NUM(x) ((x)) #define H1_REG_ENC_CTRL2 0x048 -#defineH1_REG_ENC_CTRL2_DEBLOCKING_FILETER_MODE(x) ((x) << 30) +#defineH1_REG_ENC_CTRL2_DEBLOCKING_FILTER_MODE(x) ((x) << 30) #defineH1_REG_ENC_CTRL2_H264_SLICE_SIZE(x) ((x) << 23) #defineH1_REG_ENC_CTRL2_DISABLE_QUARTER_PIXMV BIT(22) #defineH1_REG_ENC_CTRL2_TRANS8X8_MODE_EN BIT(21)
[git:media_tree/master] media: sunxi: a83-mips-csi2: also select GENERIC_PHY
This is an automatic generated email to let you know that the following patch were queued: Subject: media: sunxi: a83-mips-csi2: also select GENERIC_PHY Author: Randy Dunlap Date:Wed Sep 27 05:04:38 2023 +0100 When selecting GENERIC_PHY_MIPI_DPHY, also select GENERIC_PHY to prevent kconfig warnings: WARNING: unmet direct dependencies detected for GENERIC_PHY_MIPI_DPHY Depends on [n]: GENERIC_PHY [=n] Selected by [y]: - VIDEO_SUN8I_A83T_MIPI_CSI2 [=y] && MEDIA_SUPPORT [=y] && MEDIA_PLATFORM_SUPPORT [=y] && MEDIA_PLATFORM_DRIVERS [=y] && V4L_PLATFORM_DRIVERS [=y] && VIDEO_DEV [=y] && (ARCH_SUNXI || COMPILE_TEST [=y]) && PM [=y] && COMMON_CLK [=y] && RESET_CONTROLLER [=y] Fixes: 94d7fd9692b5 ("media: sunxi: Depend on GENERIC_PHY_MIPI_DPHY") Reported-by: kernel test robot Closes: https://lore.kernel.org/r/ZQ/WS8HC1A3F0Qn8@rli9-mobl Link: https://lore.kernel.org/linux-media/20230927040438.5589-1-rdun...@infradead.org Signed-off-by: Randy Dunlap Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig | 1 + 1 file changed, 1 insertion(+) --- diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig index 47a8c0fb7eb9..99c401e653bc 100644 --- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig +++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig @@ -8,6 +8,7 @@ config VIDEO_SUN8I_A83T_MIPI_CSI2 select VIDEO_V4L2_SUBDEV_API select V4L2_FWNODE select REGMAP_MMIO + select GENERIC_PHY select GENERIC_PHY_MIPI_DPHY help Support for the Allwinner A83T MIPI CSI-2 controller and D-PHY.
[git:media_tree/master] media: ipu3: Use MODULE_FIRMWARE to add firmware files metadata
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu3: Use MODULE_FIRMWARE to add firmware files metadata Author: Víctor Gonzalo Date:Thu Sep 14 14:51:00 2023 +0100 The ipu3 driver requests firmware files but does not use the MODULE_FIRMWARE macro to show them in the module metadata [mchehab: add missing firmware file: IMGU_FW_NAME_IPU_20161208] Link: https://lore.kernel.org/linux-media/20230914135100.19911-1-victor.gonz...@anddroptable.net Signed-off-by: Víctor Gonzalo Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/ipu3/ipu3.c | 4 1 file changed, 4 insertions(+) --- diff --git a/drivers/staging/media/ipu3/ipu3.c b/drivers/staging/media/ipu3/ipu3.c index 215884b3e922..e22a9c092195 100644 --- a/drivers/staging/media/ipu3/ipu3.c +++ b/drivers/staging/media/ipu3/ipu3.c @@ -13,6 +13,7 @@ #include #include "ipu3.h" +#include "ipu3-css-fw.h" #include "ipu3-dmamap.h" #include "ipu3-mmu.h" @@ -860,3 +861,6 @@ MODULE_AUTHOR("Yuning Pu"); MODULE_AUTHOR("Yong Zhi "); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Intel ipu3_imgu PCI driver"); +MODULE_FIRMWARE(IMGU_FW_NAME); +MODULE_FIRMWARE(IMGU_FW_NAME_20161208); +MODULE_FIRMWARE(IMGU_FW_NAME_IPU_20161208);
[git:media_tree/master] media: atomisp-mt9m114: adjust macro parameter name
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp-mt9m114: adjust macro parameter name Author: Julia Lawall Date:Wed Mar 15 09:09:04 2023 + The macro parameter name, sd, captures the field name in the third argument of container_of. Fortunately, the argument at all uses is actually sd. But change the macro parameter name anyway, for a little added safety. Link: https://lore.kernel.org/linux-media/20230315090904.20092-1-julia.law...@inria.fr Signed-off-by: Julia Lawall Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 03ebee976d5b..23b1001c2a55 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -35,7 +35,7 @@ #include "mt9m114.h" -#define to_mt9m114_sensor(sd) container_of(sd, struct mt9m114_device, sd) +#define to_mt9m114_sensor(s) container_of(s, struct mt9m114_device, sd) /* * TODO: use debug parameter to actually define when debug messages should
[git:media_tree/master] media: bcm2835-unicam: Include v4l2-subdev.h
This is an automatic generated email to let you know that the following patch were queued: Subject: media: bcm2835-unicam: Include v4l2-subdev.h Author: Laurent Pinchart Date:Wed May 1 14:08:10 2024 +0100 The unicam driver uses the v4l2_subdev structure. Include the corresponding header instead of relying on indirect includes. Closes: https://lore.kernel.org/oe-kbuild-all/202404302324.8atc84ke-...@intel.com/ Signed-off-by: Laurent Pinchart Reported-by: kernel test robot Reviewed-by: Ricardo Ribalda Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/broadcom/bcm2835-unicam.c | 1 + 1 file changed, 1 insertion(+) --- diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c index c590e26fe2cf..3c7878d8d79b 100644 --- a/drivers/media/platform/broadcom/bcm2835-unicam.c +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include "bcm2835-unicam-regs.h"
[git:media_tree/master] media: cec: cec-api: add locking in cec_release()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: cec-api: add locking in cec_release() Author: Hans Verkuil Date:Fri Feb 23 12:25:55 2024 + When cec_release() uses fh->msgs it has to take fh->lock, otherwise the list can get corrupted. Signed-off-by: Hans Verkuil Reported-by: Yang, Chenyuan Closes: https://lore.kernel.org/linux-media/ph7pr11mb57688e64ade4fe82e658d86da0...@ph7pr11mb5768.namprd11.prod.outlook.com/ Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)") Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/core/cec-api.c | 3 +++ 1 file changed, 3 insertions(+) --- diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c index 67dc79ef1705..d64bb716f9c6 100644 --- a/drivers/media/cec/core/cec-api.c +++ b/drivers/media/cec/core/cec-api.c @@ -664,6 +664,8 @@ static int cec_release(struct inode *inode, struct file *filp) list_del_init(>xfer_list); } mutex_unlock(>lock); + + mutex_lock(>lock); while (!list_empty(>msgs)) { struct cec_msg_entry *entry = list_first_entry(>msgs, struct cec_msg_entry, list); @@ -681,6 +683,7 @@ static int cec_release(struct inode *inode, struct file *filp) kfree(entry); } } + mutex_unlock(>lock); kfree(fh); cec_put_device(devnode);
[git:media_tree/master] media: staging: max96712: fix copy-paste error
This is an automatic generated email to let you know that the following patch were queued: Subject: media: staging: max96712: fix copy-paste error Author: Ihor Matushchak Date:Sat Oct 14 15:38:43 2023 +0100 Link: https://lore.kernel.org/linux-media/20231014143843.3409-1-ihor.matushc...@foobox.net Signed-off-by: Ihor Matushchak Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/max96712/max96712.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/staging/media/max96712/max96712.c b/drivers/staging/media/max96712/max96712.c index c44145284aa1..ea67bcf69c9d 100644 --- a/drivers/staging/media/max96712/max96712.c +++ b/drivers/staging/media/max96712/max96712.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Maxim MAX9286 Quad GMSL2 Deserializer Driver + * Maxim MAX96712 Quad GMSL2 Deserializer Driver * * Copyright (C) 2021 Renesas Electronics Corporation * Copyright (C) 2021 Niklas Söderlund
[git:media_tree/master] media: cec: core: avoid recursive cec_claim_log_addrs
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: core: avoid recursive cec_claim_log_addrs Author: Hans Verkuil Date:Thu Feb 22 16:17:33 2024 + Keep track if cec_claim_log_addrs() is running, and return -EBUSY if it is when calling CEC_ADAP_S_LOG_ADDRS. This prevents a case where cec_claim_log_addrs() could be called while it was still in progress. Signed-off-by: Hans Verkuil Reported-by: Yang, Chenyuan Closes: https://lore.kernel.org/linux-media/ph7pr11mb57688e64ade4fe82e658d86da0...@ph7pr11mb5768.namprd11.prod.outlook.com/ Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)") Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/core/cec-adap.c | 6 +- drivers/media/cec/core/cec-api.c | 2 +- include/media/cec.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c index 6fc7de744ee9..a493cbce2456 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -1574,9 +1574,12 @@ unconfigure: */ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) { - if (WARN_ON(adap->is_configuring || adap->is_configured)) + if (WARN_ON(adap->is_claiming_log_addrs || + adap->is_configuring || adap->is_configured)) return; + adap->is_claiming_log_addrs = true; + init_completion(>config_completion); /* Ready to kick off the thread */ @@ -1591,6 +1594,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) wait_for_completion(>config_completion); mutex_lock(>lock); } + adap->is_claiming_log_addrs = false; } /* diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c index d64bb716f9c6..3ef915344304 100644 --- a/drivers/media/cec/core/cec-api.c +++ b/drivers/media/cec/core/cec-api.c @@ -178,7 +178,7 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh, CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU | CEC_LOG_ADDRS_FL_CDC_ONLY; mutex_lock(>lock); - if (!adap->is_configuring && + if (!adap->is_claiming_log_addrs && !adap->is_configuring && (!log_addrs.num_log_addrs || !adap->is_configured) && !cec_is_busy(adap, fh)) { err = __cec_s_log_addrs(adap, _addrs, block); diff --git a/include/media/cec.h b/include/media/cec.h index c8350258f10a..d3abe84c9c9e 100644 --- a/include/media/cec.h +++ b/include/media/cec.h @@ -258,6 +258,7 @@ struct cec_adapter { u16 phys_addr; bool needs_hpd; bool is_enabled; + bool is_claiming_log_addrs; bool is_configuring; bool must_reconfigure; bool is_configured;
[git:media_tree/master] media: flexcop: allow for modern speeds
This is an automatic generated email to let you know that the following patch were queued: Subject: media: flexcop: allow for modern speeds Author: Oliver Neukum Date:Tue May 17 14:11:09 2022 +0100 High speed is no longer the ultimate in speed. Link: https://lore.kernel.org/linux-media/20220517131109.28371-2-oneu...@suse.com Signed-off-by: Oliver Neukum Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/b2c2/flexcop-usb.c | 6 ++ 1 file changed, 6 insertions(+) --- diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c index 0f807da4b65a..8f45e9156fbe 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -531,6 +531,12 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb) case USB_SPEED_HIGH: info("running at HIGH speed."); break; + case USB_SPEED_SUPER: + info("running at SUPER speed."); + break; + case USB_SPEED_SUPER_PLUS: + info("running at SUPER+ speed."); + break; case USB_SPEED_UNKNOWN: default: err("cannot handle USB speed because it is unknown.");
[git:media_tree/master] media: flexcop-usb: fix sanity check of bNumEndpoints
This is an automatic generated email to let you know that the following patch were queued: Subject: media: flexcop-usb: fix sanity check of bNumEndpoints Author: Dongliang Mu Date:Thu Jun 2 06:50:24 2022 +0100 Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type ") adds a sanity check for endpoint[1], but fails to modify the sanity check of bNumEndpoints. Fix this by modifying the sanity check of bNumEndpoints to 2. Link: https://lore.kernel.org/linux-media/20220602055027.849014-1-dz...@hust.edu.cn Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type") Signed-off-by: Dongliang Mu Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/b2c2/flexcop-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c index 8f45e9156fbe..43dd3c932a85 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -515,7 +515,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb) alt = fc_usb->uintf->cur_altsetting; - if (alt->desc.bNumEndpoints < 1) + if (alt->desc.bNumEndpoints < 2) return -ENODEV; if (!usb_endpoint_is_isoc_in(>endpoint[0].desc)) return -ENODEV;
[git:media_tree/master] media: stb0899: Simplify check
This is an automatic generated email to let you know that the following patch were queued: Subject: media: stb0899: Simplify check Author: Ricardo Ribalda Date:Mon Apr 29 16:04:41 2024 +0100 chip_id is an unsigned number, it can never be < 0 Fixes cocci check: drivers/media/dvb-frontends/stb0899_drv.c:1280:8-15: WARNING: Unsigned expression compared with zero: chip_id > 0 Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-2-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/stb0899_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c index 2f4d8fb400cd..35634f9a8ab5 100644 --- a/drivers/media/dvb-frontends/stb0899_drv.c +++ b/drivers/media/dvb-frontends/stb0899_drv.c @@ -1277,7 +1277,7 @@ static int stb0899_get_dev_id(struct stb0899_state *state) dprintk(state->verbose, FE_ERROR, 1, "Demodulator Core ID=[%s], Version=[%d]", (char *) _str, demod_ver); CONVERT32(STB0899_READ_S2REG(STB0899_S2FEC, FEC_CORE_ID_REG), (char *)_str); fec_ver = STB0899_READ_S2REG(STB0899_S2FEC, FEC_VER_ID_REG); - if (! (chip_id > 0)) { + if (!chip_id) { dprintk(state->verbose, FE_ERROR, 1, "couldn't find a STB 0899"); return -ENODEV;
[git:media_tree/master] media: stm32-dcmipp: Remove redundant printk
This is an automatic generated email to let you know that the following patch were queued: Subject: media: stm32-dcmipp: Remove redundant printk Author: Ricardo Ribalda Date:Mon Apr 29 16:04:45 2024 +0100 platform_get_irq() already prints an error message. Also platform_get_irq() can never return 0, so lets fix the condition now that we are at it. Found by cocci: drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c:444:3-10: line 444 is redundant because platform_get_irq() already prints an error Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-6-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) --- diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c index bce821eb71ce..4acc3b90d03a 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c @@ -439,11 +439,8 @@ static int dcmipp_probe(struct platform_device *pdev) "Could not get reset control\n"); irq = platform_get_irq(pdev, 0); - if (irq <= 0) { - if (irq != -EPROBE_DEFER) - dev_err(>dev, "Could not get irq\n"); - return irq ? irq : -ENXIO; - } + if (irq < 0) + return irq; dcmipp->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(dcmipp->regs)) {
[git:media_tree/master] media: go7007: Use min and max macros
This is an automatic generated email to let you know that the following patch were queued: Subject: media: go7007: Use min and max macros Author: Ricardo Ribalda Date:Mon Apr 29 16:04:44 2024 +0100 Replace ternary inline selection of f1 and f2 min max values with min() and max() helper functions for the sake of readability and to make coccinelle happier drivers/media/usb/go7007/go7007-fw.c:1292:14-15: WARNING opportunity for max() drivers/media/usb/go7007/go7007-fw.c:1293:14-15: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-5-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/go7007/go7007-fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/usb/go7007/go7007-fw.c b/drivers/media/usb/go7007/go7007-fw.c index 018019ba47d4..86ce593e0c54 100644 --- a/drivers/media/usb/go7007/go7007-fw.c +++ b/drivers/media/usb/go7007/go7007-fw.c @@ -1289,8 +1289,8 @@ static int avsync_to_package(struct go7007 *go, __le16 *code, int space) 0xbf99, (u16)((-adjratio) >> 16), 0xbf92, 0, 0xbf93, 0, - 0xbff4, f1 > f2 ? f1 : f2, - 0xbff5, f1 < f2 ? f1 : f2, + 0xbff4, max(f1, f2), + 0xbff5, min(f1, f2), 0xbff6, f1 < f2 ? ratio : ratio + 1, 0xbff7, f1 > f2 ? ratio : ratio + 1, 0xbff8, 0,
[git:media_tree/master] media: dvb-frontends: tda18271c2dd: Remove casting during div
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dvb-frontends: tda18271c2dd: Remove casting during div Author: Ricardo Ribalda Date:Mon Apr 29 16:04:47 2024 +0100 do_div() divides 64 bits by 32. We were adding a casting to the divider to 64 bits, for a number that fits perfectly in 32 bits. Remove it. Found by cocci: drivers/media/dvb-frontends/tda18271c2dd.c:355:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead. drivers/media/dvb-frontends/tda18271c2dd.c:331:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-8-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/tda18271c2dd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c index a34834487943..fd928787207e 100644 --- a/drivers/media/dvb-frontends/tda18271c2dd.c +++ b/drivers/media/dvb-frontends/tda18271c2dd.c @@ -328,7 +328,7 @@ static int CalcMainPLL(struct tda_state *state, u32 freq) OscFreq = (u64) freq * (u64) Div; OscFreq *= (u64) 16384; - do_div(OscFreq, (u64)1600); + do_div(OscFreq, 1600); MainDiv = OscFreq; state->m_Regs[MPD] = PostDiv & 0x77; @@ -352,7 +352,7 @@ static int CalcCalPLL(struct tda_state *state, u32 freq) OscFreq = (u64)freq * (u64)Div; /* CalDiv = u32( OscFreq * 16384 / 1600 ); */ OscFreq *= (u64)16384; - do_div(OscFreq, (u64)1600); + do_div(OscFreq, 1600); CalDiv = OscFreq; state->m_Regs[CPD] = PostDiv;
[git:media_tree/master] media: uvcvideo: Use max() macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: uvcvideo: Use max() macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:43 2024 +0100 It makes the code slightly more clear and makes cocci incredibly happy: drivers/media/usb/uvc/uvc_ctrl.c:839:22-23: WARNING opportunity for max() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-4-3c4865f5a...@chromium.org Reviewed-by: Sergey Senozhatsky Reviewed-by: Kieran Bingham Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/uvc/uvc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index e59a463c2761..f8ae14b8b426 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -836,7 +836,7 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping, while (1) { u8 byte = *data & mask; value |= offset > 0 ? (byte >> offset) : (byte << (-offset)); - bits -= 8 - (offset > 0 ? offset : 0); + bits -= 8 - max(offset, 0); if (bits <= 0) break;
[git:media_tree/master] media: staging: media: tegra-video: Use swap macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: staging: media: tegra-video: Use swap macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:49 2024 +0100 Makes the code simpler and cocci happier: drivers/staging/media/tegra-video/tegra20.c:324:44-45: WARNING opportunity for swap() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-10-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Reviewed-by: Luca Ceresoli Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/tegra-video/tegra20.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) --- diff --git a/drivers/staging/media/tegra-video/tegra20.c b/drivers/staging/media/tegra-video/tegra20.c index 630e2ff987a3..7b8f8f810b35 100644 --- a/drivers/staging/media/tegra-video/tegra20.c +++ b/drivers/staging/media/tegra-video/tegra20.c @@ -317,13 +317,8 @@ static void tegra20_channel_queue_setup(struct tegra_vi_channel *chan) chan->addr_offset_v = chan->addr_offset_u + stride * height / 4; /* For YVU420, we swap the locations of the U and V planes. */ - if (chan->format.pixelformat == V4L2_PIX_FMT_YVU420) { - unsigned long temp; - - temp = chan->addr_offset_u; - chan->addr_offset_u = chan->addr_offset_v; - chan->addr_offset_v = temp; - } + if (chan->format.pixelformat == V4L2_PIX_FMT_YVU420) + swap(chan->addr_offset_u, chan->addr_offset_v); chan->start_offset_u = chan->addr_offset_u; chan->start_offset_v = chan->addr_offset_v;
[git:media_tree/master] media: staging: sun6i-isp: Remove redundant printk
This is an automatic generated email to let you know that the following patch were queued: Subject: media: staging: sun6i-isp: Remove redundant printk Author: Ricardo Ribalda Date:Mon Apr 29 16:04:46 2024 +0100 platform_get_irq() already prints an error for us. Found by cocci: drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c:389:2-9: line 389 is redundant because platform_get_irq() already prints an error Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-7-3c4865f5a...@chromium.org Acked-by: Jernej Skrabec Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- diff --git a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c index 5c0a45394cba..58f8ae92320d 100644 --- a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c +++ b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c @@ -386,8 +386,7 @@ static int sun6i_isp_resources_setup(struct sun6i_isp_device *isp_dev, irq = platform_get_irq(platform_dev, 0); if (irq < 0) { - dev_err(dev, "failed to get interrupt\n"); - ret = -ENXIO; + ret = irq; goto error_clock_rate_exclusive; }
[git:media_tree/master] media: netup_unidvb: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: netup_unidvb: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:54 2024 +0100 Simplify the code. Found by cocci: drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:138:26-27: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-15-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c index 46676f2c89c7..1c885d620b75 100644 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c @@ -135,7 +135,7 @@ static void netup_i2c_fifo_tx(struct netup_i2c *i2c) (readw(>regs->tx_fifo.stat_ctrl) & 0x3f); u32 msg_length = i2c->msg->len - i2c->xmit_size; - msg_length = (msg_length < fifo_space ? msg_length : fifo_space); + msg_length = min(msg_length, fifo_space); while (msg_length--) { data = i2c->msg->buf[i2c->xmit_size++]; writeb(data, >regs->tx_fifo.data8);
[git:media_tree/master] media: flexcop-usb: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: flexcop-usb: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:56 2024 +0100 Simplifies the code. Found by cocci: drivers/media/usb/b2c2/flexcop-usb.c:201:8-9: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-17-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/b2c2/flexcop-usb.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) --- diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c index 43dd3c932a85..90f1aea99dac 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -197,10 +197,7 @@ static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb, return -EINVAL; } for (i = 0; i < len;) { - pagechunk = - wMax < bytes_left_to_read_on_page(addr, len) ? - wMax : - bytes_left_to_read_on_page(addr, len); + pagechunk = min(wMax, bytes_left_to_read_on_page(addr, len)); deb_info("%x\n", (addr & V8_MEMORY_PAGE_MASK) | (V8_MEMORY_EXTENDED*extended));
[git:media_tree/master] media: gspca: cpia1: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: gspca: cpia1: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:57 2024 +0100 Simplifies the code. Found by cocci: drivers/media/usb/gspca/cpia1.c:607:30-31: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-18-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/gspca/cpia1.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) --- diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c index 5f5fa851ca64..14aaf36cde6e 100644 --- a/drivers/media/usb/gspca/cpia1.c +++ b/drivers/media/usb/gspca/cpia1.c @@ -604,10 +604,8 @@ static int find_over_exposure(int brightness) MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness - FLICKER_BRIGHTNESS_CONSTANT; - if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) - OverExposure = MaxAllowableOverExposure; - else - OverExposure = FLICKER_ALLOWABLE_OVER_EXPOSURE; + OverExposure = min(MaxAllowableOverExposure, + FLICKER_ALLOWABLE_OVER_EXPOSURE); return OverExposure; }
[git:media_tree/master] media: au0828: Use umin macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: au0828: Use umin macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:55 2024 +0100 Simplifies the code. Found by cocci: drivers/media/usb/au0828/au0828-video.c:605:11-12: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-16-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/au0828/au0828-video.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) --- diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index fd9fc43d47e0..2ec49ea479d5 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -602,10 +602,7 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) vbi_field_size = dev->vbi_width * dev->vbi_height * 2; if (dev->vbi_read < vbi_field_size) { remain = vbi_field_size - dev->vbi_read; - if (len < remain) - lencopy = len; - else - lencopy = remain; + lencopy = umin(len, remain); if (vbi_buf != NULL) au0828_copy_vbi(dev, vbi_dma_q, vbi_buf, p,
[git:media_tree/master] media: stk1160: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: stk1160: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:58 2024 +0100 Instead of a custom min() implementation, use the real macro. Mitigates the following cocci WARNINGs: drivers/media/usb/stk1160/stk1160-video.c:133:12-13: WARNING opportunity for min() drivers/media/usb/stk1160/stk1160-video.c:176:13-14: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-19-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/stk1160/stk1160-video.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) --- diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c index e79c45db60ab..9cbd957ecc90 100644 --- a/drivers/media/usb/stk1160/stk1160-video.c +++ b/drivers/media/usb/stk1160/stk1160-video.c @@ -130,10 +130,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len) dst += linesdone * bytesperline * 2 + lineoff; /* Copy the remaining of current line */ - if (remain < (bytesperline - lineoff)) - lencopy = remain; - else - lencopy = bytesperline - lineoff; + lencopy = min(remain, bytesperline - lineoff); /* * Check if we have enough space left in the buffer. @@ -178,10 +175,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len) src += lencopy; /* Copy one line at a time */ - if (remain < bytesperline) - lencopy = remain; - else - lencopy = bytesperline; + lencopy = min(remain, bytesperline); /* * Check if we have enough space left in the buffer.
[git:media_tree/master] media: tegra-vde: Refactor timeout handling
This is an automatic generated email to let you know that the following patch were queued: Subject: media: tegra-vde: Refactor timeout handling Author: Ricardo Ribalda Date:Mon Apr 29 16:04:59 2024 +0100 Reorder the branches a bit, so cocci stops complaining about the code. drivers/media/platform/nvidia/tegra-vde/h264.c:645:20-21: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-20-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/nvidia/tegra-vde/h264.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/platform/nvidia/tegra-vde/h264.c b/drivers/media/platform/nvidia/tegra-vde/h264.c index 204e474d57f7..cfea5572a1b8 100644 --- a/drivers/media/platform/nvidia/tegra-vde/h264.c +++ b/drivers/media/platform/nvidia/tegra-vde/h264.c @@ -633,7 +633,9 @@ static int tegra_vde_decode_end(struct tegra_vde *vde) timeout = wait_for_completion_interruptible_timeout( >decode_completion, msecs_to_jiffies(1000)); - if (timeout == 0) { + if (timeout < 0) { + ret = timeout; + } else if (timeout == 0) { bsev_ptr = tegra_vde_readl(vde, vde->bsev, 0x10); macroblocks_nb = tegra_vde_readl(vde, vde->sxe, 0xC8) & 0x1FFF; read_bytes = bsev_ptr ? bsev_ptr - vde->bitstream_data_addr : 0; @@ -642,8 +644,6 @@ static int tegra_vde_decode_end(struct tegra_vde *vde) read_bytes, macroblocks_nb); ret = -EIO; - } else if (timeout < 0) { - ret = timeout; } else { ret = 0; }
[git:media_tree/master] media: i2c: st-mipid02: Use the correct div function
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: st-mipid02: Use the correct div function Author: Ricardo Ribalda Date:Mon Apr 29 16:05:00 2024 +0100 link_freq does not fit in 32 bits. Found by cocci: drivers/media/i2c/st-mipid02.c:329:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_s64 instead. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-21-3c4865f5a...@chromium.org Reviewed-by: Benjamin Mugnier Reviewed-by: Sakari Ailus Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/st-mipid02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index f250640729ca..b947a55281f0 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -326,7 +326,7 @@ static int mipid02_configure_from_rx_speed(struct mipid02_dev *bridge, } dev_dbg(>dev, "detect link_freq = %lld Hz", link_freq); - do_div(ui_4, link_freq); + ui_4 = div64_u64(ui_4, link_freq); bridge->r.clk_lane_reg1 |= ui_4 << 2; return 0;
[git:media_tree/master] media: tc358746: Use the correct div_ function
This is an automatic generated email to let you know that the following patch were queued: Subject: media: tc358746: Use the correct div_ function Author: Ricardo Ribalda Date:Mon Apr 29 16:05:01 2024 +0100 fin does not fit in 32 bits in some arches. Found by cocci: drivers/media/i2c/tc358746.c:847:2-8: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-22-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/tc358746.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- diff --git a/drivers/media/i2c/tc358746.c b/drivers/media/i2c/tc358746.c index d676adc4401b..edf79107adc5 100644 --- a/drivers/media/i2c/tc358746.c +++ b/drivers/media/i2c/tc358746.c @@ -844,8 +844,7 @@ static unsigned long tc358746_find_pll_settings(struct tc358746 *tc358746, continue; tmp = fout * postdiv; - do_div(tmp, fin); - mul = tmp; + mul = div64_ul(tmp, fin); if (mul > 511) continue;
[git:media_tree/master] media: dvb-frontends: tda10048: Fix integer overflow
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dvb-frontends: tda10048: Fix integer overflow Author: Ricardo Ribalda Date:Mon Apr 29 16:05:04 2024 +0100 state->xtal_hz can be up to 16M, so it can overflow a 32 bit integer when multiplied by pll_mfactor. Create a new 64 bit variable to hold the calculations. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-25-3c4865f5a...@chromium.org Reported-by: Dan Carpenter Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/tda10048.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/dvb-frontends/tda10048.c b/drivers/media/dvb-frontends/tda10048.c index 5d5e4e9e4422..3e725cdcc66b 100644 --- a/drivers/media/dvb-frontends/tda10048.c +++ b/drivers/media/dvb-frontends/tda10048.c @@ -410,6 +410,7 @@ static int tda10048_set_if(struct dvb_frontend *fe, u32 bw) struct tda10048_config *config = >config; int i; u32 if_freq_khz; + u64 sample_freq; dprintk(1, "%s(bw = %d)\n", __func__, bw); @@ -451,9 +452,11 @@ static int tda10048_set_if(struct dvb_frontend *fe, u32 bw) dprintk(1, "- pll_pfactor = %d\n", state->pll_pfactor); /* Calculate the sample frequency */ - state->sample_freq = state->xtal_hz * (state->pll_mfactor + 45); - state->sample_freq /= (state->pll_nfactor + 1); - state->sample_freq /= (state->pll_pfactor + 4); + sample_freq = state->xtal_hz; + sample_freq *= state->pll_mfactor + 45; + do_div(sample_freq, state->pll_nfactor + 1); + do_div(sample_freq, state->pll_pfactor + 4); + state->sample_freq = sample_freq; dprintk(1, "- sample_freq = %d\n", state->sample_freq); /* Update the I/F */
[git:media_tree/master] media: intel/ipu6: Don't re-allocate memory for firmware
This is an automatic generated email to let you know that the following patch were queued: Subject: media: intel/ipu6: Don't re-allocate memory for firmware Author: Sakari Ailus Date:Thu May 2 16:49:50 2024 +0100 The ipu6 driver allocated vmalloc memory for the firmware if request_firmware() somehow managed not to use vmalloc to allocate it. Still how the memory is allocated by request_firmware() is not specified in its API, so be prepared for kmalloc-allocated firmware, too. Instead of allocating new vmalloc-backed buffer for the firmware, obtain the pages from virtual addresses instead. Link: https://lore.kernel.org/linux-media/20240502154950.549015-1-sakari.ai...@linux.intel.com Reported-by: Stephen Rothwell Closes: https://lore.kernel.org/all/20240501102236.3b258...@canb.auug.org.au/ Fixes: 25fedc021985 ("media: intel/ipu6: add Intel IPU6 PCI device driver") Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu6/ipu6-buttress.c | 7 - drivers/media/pci/intel/ipu6/ipu6.c | 41 +--- 2 files changed, 7 insertions(+), 41 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu6/ipu6-buttress.c b/drivers/media/pci/intel/ipu6/ipu6-buttress.c index dbcf1aa87872..23c537e7ce1e 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-buttress.c +++ b/drivers/media/pci/intel/ipu6/ipu6-buttress.c @@ -552,12 +552,16 @@ int ipu6_buttress_reset_authentication(struct ipu6_device *isp) int ipu6_buttress_map_fw_image(struct ipu6_bus_device *sys, const struct firmware *fw, struct sg_table *sgt) { + bool is_vmalloc = is_vmalloc_addr(fw->data); struct page **pages; const void *addr; unsigned long n_pages; unsigned int i; int ret; + if (!is_vmalloc && !virt_addr_valid(fw->data)) + return -EDOM; + n_pages = PHYS_PFN(PAGE_ALIGN(fw->size)); pages = kmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL); @@ -566,7 +570,8 @@ int ipu6_buttress_map_fw_image(struct ipu6_bus_device *sys, addr = fw->data; for (i = 0; i < n_pages; i++) { - struct page *p = vmalloc_to_page(addr); + struct page *p = is_vmalloc ? + vmalloc_to_page(addr) : virt_to_page(addr); if (!p) { ret = -ENOMEM; diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c index 7bcd9c5a381a..2cf04251c9e7 100644 --- a/drivers/media/pci/intel/ipu6/ipu6.c +++ b/drivers/media/pci/intel/ipu6/ipu6.c @@ -503,45 +503,6 @@ static void ipu6_configure_vc_mechanism(struct ipu6_device *isp) writel(val, isp->base + BUTTRESS_REG_BTRS_CTRL); } -static int request_cpd_fw(const struct firmware **firmware_p, const char *name, - struct device *device) -{ - const struct firmware *fw; - struct firmware *dst; - int ret = 0; - - ret = request_firmware(, name, device); - if (ret) - return ret; - - if (is_vmalloc_addr(fw->data)) { - *firmware_p = fw; - return 0; - } - - dst = kzalloc(sizeof(*dst), GFP_KERNEL); - if (!dst) { - ret = -ENOMEM; - goto release_firmware; - } - - dst->size = fw->size; - dst->data = vmalloc(fw->size); - if (!dst->data) { - kfree(dst); - ret = -ENOMEM; - goto release_firmware; - } - - memcpy((void *)dst->data, fw->data, fw->size); - *firmware_p = dst; - -release_firmware: - release_firmware(fw); - - return ret; -} - static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct ipu6_buttress_ctrl *isys_ctrl = NULL, *psys_ctrl = NULL; @@ -627,7 +588,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) return ret; - ret = request_cpd_fw(>cpd_fw, isp->cpd_fw_name, dev); + ret = request_firmware(>cpd_fw, isp->cpd_fw_name, dev); if (ret) { dev_err_probe(>pdev->dev, ret, "Requesting signed firmware %s failed\n",
[git:media_tree/master] media: intel/ipu6: explicitly include vmalloc.h
This is an automatic generated email to let you know that the following patch were queued: Subject: media: intel/ipu6: explicitly include vmalloc.h Author: Stephen Rothwell Date:Tue May 7 14:35:28 2024 +0200 linux/vmalloc.h needs to be included explicitly nowadays. Do it. Link: https://lore.kernel.org/linux-media/20240507123528.932421-1-sakari.ai...@linux.intel.com Fixes: 9163d83573e4 ("media: intel/ipu6: add IPU6 DMA mapping API and MMU table") Signed-off-by: Stephen Rothwell Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu6/ipu6-mmu.c | 1 + 1 file changed, 1 insertion(+) --- diff --git a/drivers/media/pci/intel/ipu6/ipu6-mmu.c b/drivers/media/pci/intel/ipu6/ipu6-mmu.c index 98a4bf9ca267..c3a20507d6db 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-mmu.c +++ b/drivers/media/pci/intel/ipu6/ipu6-mmu.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "ipu6.h" #include "ipu6-dma.h"
[git:media_tree/master] media: media: intel/ipu6: Fix spelling mistake "remappinp" -> "remapping"
This is an automatic generated email to let you know that the following patch were queued: Subject: media: media: intel/ipu6: Fix spelling mistake "remappinp" -> "remapping" Author: Colin Ian King Date:Wed May 8 10:17:12 2024 +0200 There is a spelling mistake in a dev_err_probe message. Fix it. Link: https://lore.kernel.org/linux-media/20240508081712.2868257-1-colin.i.k...@gmail.com Signed-off-by: Colin Ian King Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu6/ipu6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c index 2cf04251c9e7..d2bebd208461 100644 --- a/drivers/media/pci/intel/ipu6/ipu6.c +++ b/drivers/media/pci/intel/ipu6/ipu6.c @@ -530,7 +530,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret = pcim_iomap_regions(pdev, 1 << IPU6_PCI_BAR, pci_name(pdev)); if (ret) - return dev_err_probe(dev, ret, "Failed to I/O mem remappinp\n"); + return dev_err_probe(dev, ret, "Failed to I/O mem remapping\n"); isp->base = pcim_iomap_table(pdev)[IPU6_PCI_BAR]; pci_set_drvdata(pdev, isp);
[git:media_stage/master] media: media: intel/ipu6: Fix spelling mistake "remappinp" -> "remapping"
This is an automatic generated email to let you know that the following patch were queued: Subject: media: media: intel/ipu6: Fix spelling mistake "remappinp" -> "remapping" Author: Colin Ian King Date:Wed May 8 10:17:12 2024 +0200 There is a spelling mistake in a dev_err_probe message. Fix it. Link: https://lore.kernel.org/linux-media/20240508081712.2868257-1-colin.i.k...@gmail.com Signed-off-by: Colin Ian King Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu6/ipu6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c index 2cf04251c9e7..d2bebd208461 100644 --- a/drivers/media/pci/intel/ipu6/ipu6.c +++ b/drivers/media/pci/intel/ipu6/ipu6.c @@ -530,7 +530,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret = pcim_iomap_regions(pdev, 1 << IPU6_PCI_BAR, pci_name(pdev)); if (ret) - return dev_err_probe(dev, ret, "Failed to I/O mem remappinp\n"); + return dev_err_probe(dev, ret, "Failed to I/O mem remapping\n"); isp->base = pcim_iomap_table(pdev)[IPU6_PCI_BAR]; pci_set_drvdata(pdev, isp);
[git:media_stage/master] media: intel/ipu6: explicitly include vmalloc.h
This is an automatic generated email to let you know that the following patch were queued: Subject: media: intel/ipu6: explicitly include vmalloc.h Author: Stephen Rothwell Date:Tue May 7 14:35:28 2024 +0200 linux/vmalloc.h needs to be included explicitly nowadays. Do it. Link: https://lore.kernel.org/linux-media/20240507123528.932421-1-sakari.ai...@linux.intel.com Fixes: 9163d83573e4 ("media: intel/ipu6: add IPU6 DMA mapping API and MMU table") Signed-off-by: Stephen Rothwell Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu6/ipu6-mmu.c | 1 + 1 file changed, 1 insertion(+) --- diff --git a/drivers/media/pci/intel/ipu6/ipu6-mmu.c b/drivers/media/pci/intel/ipu6/ipu6-mmu.c index 98a4bf9ca267..c3a20507d6db 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-mmu.c +++ b/drivers/media/pci/intel/ipu6/ipu6-mmu.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "ipu6.h" #include "ipu6-dma.h"
[git:dtv-scan-tables/master] dvb-t/at-All: add Salzburg/Gaisberg dvb-t2 transponders
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: dvb-t/at-All: add Salzburg/Gaisberg dvb-t2 transponders Author: Yarny Date:Sun Mar 24 10:39:56 2024 + Adds a missing dvb-t2 transmitting station from Austria. Link: https://lore.kernel.org/linux-media/75149976-693b-444e-b4cc-dd2dd86ea...@public-files.de Signed-off-by: Mauro Carvalho Chehab dvb-t/at-All | 64 1 file changed, 64 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=7098bdd27548eaf3e5d9485fc68575f88e362daf diff --git a/dvb-t/at-All b/dvb-t/at-All index b83363d105ac..ace9e36153b5 100644 --- a/dvb-t/at-All +++ b/dvb-t/at-All @@ -76,3 +76,67 @@ INVERSION = AUTO STREAM_ID = 1 +[Gaisberg-MUXA-K32] + DELIVERY_SYSTEM = DVBT2 + FREQUENCY = 56200 + BANDWIDTH_HZ = 800 + CODE_RATE_HP = AUTO + CODE_RATE_LP = AUTO + MODULATION = QAM/AUTO + TRANSMISSION_MODE = AUTO + GUARD_INTERVAL = AUTO + HIERARCHY = AUTO + INVERSION = AUTO + STREAM_ID = 1 + +[Gaisberg-MUXB-K29] + DELIVERY_SYSTEM = DVBT2 + FREQUENCY = 53800 + BANDWIDTH_HZ = 800 + CODE_RATE_HP = AUTO + CODE_RATE_LP = AUTO + MODULATION = QAM/AUTO + TRANSMISSION_MODE = AUTO + GUARD_INTERVAL = AUTO + HIERARCHY = AUTO + INVERSION = AUTO + STREAM_ID = 1 + +[Gaisberg-MUXD-K47] + DELIVERY_SYSTEM = DVBT2 + FREQUENCY = 68200 + BANDWIDTH_HZ = 800 + CODE_RATE_HP = AUTO + CODE_RATE_LP = AUTO + MODULATION = QAM/AUTO + TRANSMISSION_MODE = AUTO + GUARD_INTERVAL = AUTO + HIERARCHY = AUTO + INVERSION = AUTO + STREAM_ID = 1 + +[Gaisberg-MUXE-K38] + DELIVERY_SYSTEM = DVBT2 + FREQUENCY = 61000 + BANDWIDTH_HZ = 800 + CODE_RATE_HP = AUTO + CODE_RATE_LP = AUTO + MODULATION = QAM/AUTO + TRANSMISSION_MODE = AUTO + GUARD_INTERVAL = AUTO + HIERARCHY = AUTO + INVERSION = AUTO + STREAM_ID = 1 + +[Gaisberg-MUXF-K42] + DELIVERY_SYSTEM = DVBT2 + FREQUENCY = 64200 + BANDWIDTH_HZ = 800 + CODE_RATE_HP = AUTO + CODE_RATE_LP = AUTO + MODULATION = QAM/AUTO + TRANSMISSION_MODE = AUTO + GUARD_INTERVAL = AUTO + HIERARCHY = AUTO + INVERSION = AUTO + STREAM_ID = 1
[git:media_stage/master] media: intel/ipu6: Don't re-allocate memory for firmware
This is an automatic generated email to let you know that the following patch were queued: Subject: media: intel/ipu6: Don't re-allocate memory for firmware Author: Sakari Ailus Date:Thu May 2 16:49:50 2024 +0100 The ipu6 driver allocated vmalloc memory for the firmware if request_firmware() somehow managed not to use vmalloc to allocate it. Still how the memory is allocated by request_firmware() is not specified in its API, so be prepared for kmalloc-allocated firmware, too. Instead of allocating new vmalloc-backed buffer for the firmware, obtain the pages from virtual addresses instead. Link: https://lore.kernel.org/linux-media/20240502154950.549015-1-sakari.ai...@linux.intel.com Reported-by: Stephen Rothwell Closes: https://lore.kernel.org/all/20240501102236.3b258...@canb.auug.org.au/ Fixes: 25fedc021985 ("media: intel/ipu6: add Intel IPU6 PCI device driver") Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu6/ipu6-buttress.c | 7 - drivers/media/pci/intel/ipu6/ipu6.c | 41 +--- 2 files changed, 7 insertions(+), 41 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu6/ipu6-buttress.c b/drivers/media/pci/intel/ipu6/ipu6-buttress.c index dbcf1aa87872..23c537e7ce1e 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-buttress.c +++ b/drivers/media/pci/intel/ipu6/ipu6-buttress.c @@ -552,12 +552,16 @@ int ipu6_buttress_reset_authentication(struct ipu6_device *isp) int ipu6_buttress_map_fw_image(struct ipu6_bus_device *sys, const struct firmware *fw, struct sg_table *sgt) { + bool is_vmalloc = is_vmalloc_addr(fw->data); struct page **pages; const void *addr; unsigned long n_pages; unsigned int i; int ret; + if (!is_vmalloc && !virt_addr_valid(fw->data)) + return -EDOM; + n_pages = PHYS_PFN(PAGE_ALIGN(fw->size)); pages = kmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL); @@ -566,7 +570,8 @@ int ipu6_buttress_map_fw_image(struct ipu6_bus_device *sys, addr = fw->data; for (i = 0; i < n_pages; i++) { - struct page *p = vmalloc_to_page(addr); + struct page *p = is_vmalloc ? + vmalloc_to_page(addr) : virt_to_page(addr); if (!p) { ret = -ENOMEM; diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c index 7bcd9c5a381a..2cf04251c9e7 100644 --- a/drivers/media/pci/intel/ipu6/ipu6.c +++ b/drivers/media/pci/intel/ipu6/ipu6.c @@ -503,45 +503,6 @@ static void ipu6_configure_vc_mechanism(struct ipu6_device *isp) writel(val, isp->base + BUTTRESS_REG_BTRS_CTRL); } -static int request_cpd_fw(const struct firmware **firmware_p, const char *name, - struct device *device) -{ - const struct firmware *fw; - struct firmware *dst; - int ret = 0; - - ret = request_firmware(, name, device); - if (ret) - return ret; - - if (is_vmalloc_addr(fw->data)) { - *firmware_p = fw; - return 0; - } - - dst = kzalloc(sizeof(*dst), GFP_KERNEL); - if (!dst) { - ret = -ENOMEM; - goto release_firmware; - } - - dst->size = fw->size; - dst->data = vmalloc(fw->size); - if (!dst->data) { - kfree(dst); - ret = -ENOMEM; - goto release_firmware; - } - - memcpy((void *)dst->data, fw->data, fw->size); - *firmware_p = dst; - -release_firmware: - release_firmware(fw); - - return ret; -} - static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct ipu6_buttress_ctrl *isys_ctrl = NULL, *psys_ctrl = NULL; @@ -627,7 +588,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) return ret; - ret = request_cpd_fw(>cpd_fw, isp->cpd_fw_name, dev); + ret = request_firmware(>cpd_fw, isp->cpd_fw_name, dev); if (ret) { dev_err_probe(>pdev->dev, ret, "Requesting signed firmware %s failed\n",
[git:media_stage/master] media: stb0899: Simplify check
This is an automatic generated email to let you know that the following patch were queued: Subject: media: stb0899: Simplify check Author: Ricardo Ribalda Date:Mon Apr 29 16:04:41 2024 +0100 chip_id is an unsigned number, it can never be < 0 Fixes cocci check: drivers/media/dvb-frontends/stb0899_drv.c:1280:8-15: WARNING: Unsigned expression compared with zero: chip_id > 0 Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-2-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/stb0899_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c index 2f4d8fb400cd..35634f9a8ab5 100644 --- a/drivers/media/dvb-frontends/stb0899_drv.c +++ b/drivers/media/dvb-frontends/stb0899_drv.c @@ -1277,7 +1277,7 @@ static int stb0899_get_dev_id(struct stb0899_state *state) dprintk(state->verbose, FE_ERROR, 1, "Demodulator Core ID=[%s], Version=[%d]", (char *) _str, demod_ver); CONVERT32(STB0899_READ_S2REG(STB0899_S2FEC, FEC_CORE_ID_REG), (char *)_str); fec_ver = STB0899_READ_S2REG(STB0899_S2FEC, FEC_VER_ID_REG); - if (! (chip_id > 0)) { + if (!chip_id) { dprintk(state->verbose, FE_ERROR, 1, "couldn't find a STB 0899"); return -ENODEV;
[git:media_stage/master] media: pci: mgb4: Refactor struct resources
This is an automatic generated email to let you know that the following patch were queued: Subject: media: pci: mgb4: Refactor struct resources Author: Ricardo Ribalda Date:Mon Apr 29 16:04:40 2024 +0100 The struct resource end field signifies the end address not the relative offset from the start field i.e size == (end - start) + 1. Amend the .end field to specify the end address not the relative size from the offset as is currently given. Fixes cocci check: drivers/media/pci/mgb4/mgb4_regs.c:13:22-25: WARNING: Suspicious code. resource_size is maybe missing with res Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-1-3c4865f5a...@chromium.org Reviewed-by: Martin Tůma Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/mgb4/mgb4_core.c | 4 ++-- drivers/media/pci/mgb4/mgb4_regs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c index 9bcf10a77fd3..60498a5abebf 100644 --- a/drivers/media/pci/mgb4/mgb4_core.c +++ b/drivers/media/pci/mgb4/mgb4_core.c @@ -493,13 +493,13 @@ static int mgb4_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct mgb4_dev *mgbdev; struct resource video = { .start = 0x0, - .end= 0x100, + .end= 0xff, .flags = IORESOURCE_MEM, .name = "mgb4-video", }; struct resource cmt = { .start = 0x1000, - .end= 0x1800, + .end= 0x17ff, .flags = IORESOURCE_MEM, .name = "mgb4-cmt", }; diff --git a/drivers/media/pci/mgb4/mgb4_regs.c b/drivers/media/pci/mgb4/mgb4_regs.c index 53d4e4503a74..31befd722d72 100644 --- a/drivers/media/pci/mgb4/mgb4_regs.c +++ b/drivers/media/pci/mgb4/mgb4_regs.c @@ -10,7 +10,7 @@ int mgb4_regs_map(struct resource *res, struct mgb4_regs *regs) { regs->mapbase = res->start; - regs->mapsize = res->end - res->start; + regs->mapsize = resource_size(res); if (!request_mem_region(regs->mapbase, regs->mapsize, res->name)) return -EINVAL;
[git:media_stage/master] media: staging: media: starfive: Clean pad selection in isp_try_format()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: staging: media: starfive: Clean pad selection in isp_try_format() Author: Changhuang Liang Date:Tue Mar 12 02:45:20 2024 + The code to select isp_dev->formats[] is overly complicated. We can just use the "pad" as the index. This will making adding new pads easier in future patches. No functional change. Link: https://lore.kernel.org/linux-media/20240312024520.11022-1-changhuang.li...@starfivetech.com Signed-off-by: Changhuang Liang Reviewed-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/starfive/camss/stf-isp.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) --- diff --git a/drivers/staging/media/starfive/camss/stf-isp.c b/drivers/staging/media/starfive/camss/stf-isp.c index d50616ef351e..4e6e26736852 100644 --- a/drivers/staging/media/starfive/camss/stf-isp.c +++ b/drivers/staging/media/starfive/camss/stf-isp.c @@ -10,9 +10,6 @@ #include "stf-camss.h" -#define SINK_FORMATS_INDEX 0 -#define SOURCE_FORMATS_INDEX 1 - static int isp_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, struct v4l2_subdev_selection *sel); @@ -94,10 +91,7 @@ static void isp_try_format(struct stf_isp_dev *isp_dev, return; } - if (pad == STF_ISP_PAD_SINK) - formats = _dev->formats[SINK_FORMATS_INDEX]; - else if (pad == STF_ISP_PAD_SRC) - formats = _dev->formats[SOURCE_FORMATS_INDEX]; + formats = _dev->formats[pad]; fmt->width = clamp_t(u32, fmt->width, STFCAMSS_FRAME_MIN_WIDTH, STFCAMSS_FRAME_MAX_WIDTH); @@ -123,7 +117,7 @@ static int isp_enum_mbus_code(struct v4l2_subdev *sd, if (code->index >= ARRAY_SIZE(isp_formats_sink)) return -EINVAL; - formats = _dev->formats[SINK_FORMATS_INDEX]; + formats = _dev->formats[code->pad]; code->code = formats->fmts[code->index].code; } else { struct v4l2_mbus_framefmt *sink_fmt;
[git:media_stage/master] media: uvcvideo: Use max() macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: uvcvideo: Use max() macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:43 2024 +0100 It makes the code slightly more clear and makes cocci incredibly happy: drivers/media/usb/uvc/uvc_ctrl.c:839:22-23: WARNING opportunity for max() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-4-3c4865f5a...@chromium.org Reviewed-by: Sergey Senozhatsky Reviewed-by: Kieran Bingham Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/uvc/uvc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index e59a463c2761..f8ae14b8b426 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -836,7 +836,7 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping, while (1) { u8 byte = *data & mask; value |= offset > 0 ? (byte >> offset) : (byte << (-offset)); - bits -= 8 - (offset > 0 ? offset : 0); + bits -= 8 - max(offset, 0); if (bits <= 0) break;
[git:media_stage/master] media: go7007: Use min and max macros
This is an automatic generated email to let you know that the following patch were queued: Subject: media: go7007: Use min and max macros Author: Ricardo Ribalda Date:Mon Apr 29 16:04:44 2024 +0100 Replace ternary inline selection of f1 and f2 min max values with min() and max() helper functions for the sake of readability and to make coccinelle happier drivers/media/usb/go7007/go7007-fw.c:1292:14-15: WARNING opportunity for max() drivers/media/usb/go7007/go7007-fw.c:1293:14-15: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-5-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/go7007/go7007-fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/usb/go7007/go7007-fw.c b/drivers/media/usb/go7007/go7007-fw.c index 018019ba47d4..86ce593e0c54 100644 --- a/drivers/media/usb/go7007/go7007-fw.c +++ b/drivers/media/usb/go7007/go7007-fw.c @@ -1289,8 +1289,8 @@ static int avsync_to_package(struct go7007 *go, __le16 *code, int space) 0xbf99, (u16)((-adjratio) >> 16), 0xbf92, 0, 0xbf93, 0, - 0xbff4, f1 > f2 ? f1 : f2, - 0xbff5, f1 < f2 ? f1 : f2, + 0xbff4, max(f1, f2), + 0xbff5, min(f1, f2), 0xbff6, f1 < f2 ? ratio : ratio + 1, 0xbff7, f1 > f2 ? ratio : ratio + 1, 0xbff8, 0,
[git:media_stage/master] media: staging: sun6i-isp: Remove redundant printk
This is an automatic generated email to let you know that the following patch were queued: Subject: media: staging: sun6i-isp: Remove redundant printk Author: Ricardo Ribalda Date:Mon Apr 29 16:04:46 2024 +0100 platform_get_irq() already prints an error for us. Found by cocci: drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c:389:2-9: line 389 is redundant because platform_get_irq() already prints an error Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-7-3c4865f5a...@chromium.org Acked-by: Jernej Skrabec Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- diff --git a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c index 5c0a45394cba..58f8ae92320d 100644 --- a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c +++ b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c @@ -386,8 +386,7 @@ static int sun6i_isp_resources_setup(struct sun6i_isp_device *isp_dev, irq = platform_get_irq(platform_dev, 0); if (irq < 0) { - dev_err(dev, "failed to get interrupt\n"); - ret = -ENXIO; + ret = irq; goto error_clock_rate_exclusive; }
[git:media_stage/master] media: staging: media: tegra-video: Use swap macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: staging: media: tegra-video: Use swap macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:49 2024 +0100 Makes the code simpler and cocci happier: drivers/staging/media/tegra-video/tegra20.c:324:44-45: WARNING opportunity for swap() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-10-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Reviewed-by: Luca Ceresoli Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/tegra-video/tegra20.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) --- diff --git a/drivers/staging/media/tegra-video/tegra20.c b/drivers/staging/media/tegra-video/tegra20.c index 630e2ff987a3..7b8f8f810b35 100644 --- a/drivers/staging/media/tegra-video/tegra20.c +++ b/drivers/staging/media/tegra-video/tegra20.c @@ -317,13 +317,8 @@ static void tegra20_channel_queue_setup(struct tegra_vi_channel *chan) chan->addr_offset_v = chan->addr_offset_u + stride * height / 4; /* For YVU420, we swap the locations of the U and V planes. */ - if (chan->format.pixelformat == V4L2_PIX_FMT_YVU420) { - unsigned long temp; - - temp = chan->addr_offset_u; - chan->addr_offset_u = chan->addr_offset_v; - chan->addr_offset_v = temp; - } + if (chan->format.pixelformat == V4L2_PIX_FMT_YVU420) + swap(chan->addr_offset_u, chan->addr_offset_v); chan->start_offset_u = chan->addr_offset_u; chan->start_offset_v = chan->addr_offset_v;
[git:media_stage/master] media: stm32-dcmipp: Remove redundant printk
This is an automatic generated email to let you know that the following patch were queued: Subject: media: stm32-dcmipp: Remove redundant printk Author: Ricardo Ribalda Date:Mon Apr 29 16:04:45 2024 +0100 platform_get_irq() already prints an error message. Also platform_get_irq() can never return 0, so lets fix the condition now that we are at it. Found by cocci: drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c:444:3-10: line 444 is redundant because platform_get_irq() already prints an error Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-6-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) --- diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c index bce821eb71ce..4acc3b90d03a 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c @@ -439,11 +439,8 @@ static int dcmipp_probe(struct platform_device *pdev) "Could not get reset control\n"); irq = platform_get_irq(pdev, 0); - if (irq <= 0) { - if (irq != -EPROBE_DEFER) - dev_err(>dev, "Could not get irq\n"); - return irq ? irq : -ENXIO; - } + if (irq < 0) + return irq; dcmipp->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(dcmipp->regs)) {
[git:media_stage/master] media: dvb-frontends: tda18271c2dd: Remove casting during div
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dvb-frontends: tda18271c2dd: Remove casting during div Author: Ricardo Ribalda Date:Mon Apr 29 16:04:47 2024 +0100 do_div() divides 64 bits by 32. We were adding a casting to the divider to 64 bits, for a number that fits perfectly in 32 bits. Remove it. Found by cocci: drivers/media/dvb-frontends/tda18271c2dd.c:355:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead. drivers/media/dvb-frontends/tda18271c2dd.c:331:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-8-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/tda18271c2dd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c index a34834487943..fd928787207e 100644 --- a/drivers/media/dvb-frontends/tda18271c2dd.c +++ b/drivers/media/dvb-frontends/tda18271c2dd.c @@ -328,7 +328,7 @@ static int CalcMainPLL(struct tda_state *state, u32 freq) OscFreq = (u64) freq * (u64) Div; OscFreq *= (u64) 16384; - do_div(OscFreq, (u64)1600); + do_div(OscFreq, 1600); MainDiv = OscFreq; state->m_Regs[MPD] = PostDiv & 0x77; @@ -352,7 +352,7 @@ static int CalcCalPLL(struct tda_state *state, u32 freq) OscFreq = (u64)freq * (u64)Div; /* CalDiv = u32( OscFreq * 16384 / 1600 ); */ OscFreq *= (u64)16384; - do_div(OscFreq, (u64)1600); + do_div(OscFreq, 1600); CalDiv = OscFreq; state->m_Regs[CPD] = PostDiv;
[git:media_stage/master] media: s2255: Use refcount_t instead of atomic_t for num_channels
This is an automatic generated email to let you know that the following patch were queued: Subject: media: s2255: Use refcount_t instead of atomic_t for num_channels Author: Ricardo Ribalda Date:Mon Apr 29 16:04:50 2024 +0100 Use an API that resembles more the actual use of num_channels. Found by cocci: drivers/media/usb/s2255/s2255drv.c:2362:5-24: WARNING: atomic_dec_and_test variation before object free at line 2363. drivers/media/usb/s2255/s2255drv.c:1557:5-24: WARNING: atomic_dec_and_test variation before object free at line 1558. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-11-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/s2255/s2255drv.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) --- diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 8e1de1e8bd12..a6e450181fd0 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -247,7 +247,7 @@ struct s2255_vc { struct s2255_dev { struct s2255_vc vc[MAX_CHANNELS]; struct v4l2_device v4l2_dev; - atomic_tnum_channels; + refcount_t num_channels; int frames; struct mutexlock; /* channels[].vdev.lock */ struct mutexcmdlock; /* protects cmdbuf */ @@ -1550,11 +1550,11 @@ static void s2255_video_device_release(struct video_device *vdev) container_of(vdev, struct s2255_vc, vdev); dprintk(dev, 4, "%s, chnls: %d\n", __func__, - atomic_read(>num_channels)); + refcount_read(>num_channels)); v4l2_ctrl_handler_free(>hdl); - if (atomic_dec_and_test(>num_channels)) + if (refcount_dec_and_test(>num_channels)) s2255_destroy(dev); return; } @@ -1659,7 +1659,7 @@ static int s2255_probe_v4l(struct s2255_dev *dev) "failed to register video device!\n"); break; } - atomic_inc(>num_channels); + refcount_inc(>num_channels); v4l2_info(>v4l2_dev, "V4L2 device registered as %s\n", video_device_node_name(>vdev)); @@ -1667,11 +1667,11 @@ static int s2255_probe_v4l(struct s2255_dev *dev) pr_info("Sensoray 2255 V4L driver Revision: %s\n", S2255_VERSION); /* if no channels registered, return error and probe will fail*/ - if (atomic_read(>num_channels) == 0) { + if (refcount_read(>num_channels) == 0) { v4l2_device_unregister(>v4l2_dev); return ret; } - if (atomic_read(>num_channels) != MAX_CHANNELS) + if (refcount_read(>num_channels) != MAX_CHANNELS) pr_warn("s2255: Not all channels available.\n"); return 0; } @@ -2221,7 +2221,7 @@ static int s2255_probe(struct usb_interface *interface, goto errorFWDATA1; } - atomic_set(>num_channels, 0); + refcount_set(>num_channels, 0); dev->pid = id->idProduct; dev->fw_data = kzalloc(sizeof(struct s2255_fw), GFP_KERNEL); if (!dev->fw_data) @@ -2341,12 +2341,12 @@ static void s2255_disconnect(struct usb_interface *interface) { struct s2255_dev *dev = to_s2255_dev(usb_get_intfdata(interface)); int i; - int channels = atomic_read(>num_channels); + int channels = refcount_read(>num_channels); mutex_lock(>lock); v4l2_device_disconnect(>v4l2_dev); mutex_unlock(>lock); /*see comments in the uvc_driver.c usb disconnect function */ - atomic_inc(>num_channels); + refcount_inc(>num_channels); /* unregister each video device. */ for (i = 0; i < channels; i++) video_unregister_device(>vc[i].vdev); @@ -2359,7 +2359,7 @@ static void s2255_disconnect(struct usb_interface *interface) dev->vc[i].vidstatus_ready = 1; wake_up(>vc[i].wait_vidstatus); } - if (atomic_dec_and_test(>num_channels)) + if (refcount_dec_and_test(>num_channels)) s2255_destroy(dev); dev_info(>dev, "%s\n", __func__); }
[git:media_stage/master] media: dvb-frontends: tda10048: Fix integer overflow
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dvb-frontends: tda10048: Fix integer overflow Author: Ricardo Ribalda Date:Mon Apr 29 16:05:04 2024 +0100 state->xtal_hz can be up to 16M, so it can overflow a 32 bit integer when multiplied by pll_mfactor. Create a new 64 bit variable to hold the calculations. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-25-3c4865f5a...@chromium.org Reported-by: Dan Carpenter Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/tda10048.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/dvb-frontends/tda10048.c b/drivers/media/dvb-frontends/tda10048.c index 5d5e4e9e4422..3e725cdcc66b 100644 --- a/drivers/media/dvb-frontends/tda10048.c +++ b/drivers/media/dvb-frontends/tda10048.c @@ -410,6 +410,7 @@ static int tda10048_set_if(struct dvb_frontend *fe, u32 bw) struct tda10048_config *config = >config; int i; u32 if_freq_khz; + u64 sample_freq; dprintk(1, "%s(bw = %d)\n", __func__, bw); @@ -451,9 +452,11 @@ static int tda10048_set_if(struct dvb_frontend *fe, u32 bw) dprintk(1, "- pll_pfactor = %d\n", state->pll_pfactor); /* Calculate the sample frequency */ - state->sample_freq = state->xtal_hz * (state->pll_mfactor + 45); - state->sample_freq /= (state->pll_nfactor + 1); - state->sample_freq /= (state->pll_pfactor + 4); + sample_freq = state->xtal_hz; + sample_freq *= state->pll_mfactor + 45; + do_div(sample_freq, state->pll_nfactor + 1); + do_div(sample_freq, state->pll_pfactor + 4); + state->sample_freq = sample_freq; dprintk(1, "- sample_freq = %d\n", state->sample_freq); /* Update the I/F */
[git:media_stage/master] media: platform: mtk-mdp3: Use refcount_t for job_count
This is an automatic generated email to let you know that the following patch were queued: Subject: media: platform: mtk-mdp3: Use refcount_t for job_count Author: Ricardo Ribalda Date:Mon Apr 29 16:04:51 2024 +0100 Use an API that resembles more the actual use of job_count. Found by cocci: drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:527:5-24: WARNING: atomic_dec_and_test variation before object free at line 541. drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:578:6-25: WARNING: atomic_dec_and_test variation before object free at line 581. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-12-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 10 +- drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 6 +++--- drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h | 2 +- drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) --- diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c index 1d64bac34b90..ea2ea119dd2a 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c @@ -524,7 +524,7 @@ static void mdp_auto_release_work(struct work_struct *work) mdp_comp_clocks_off(>pdev->dev, cmd->comps, cmd->num_comps); - if (atomic_dec_and_test(>job_count)) { + if (refcount_dec_and_test(>job_count)) { if (cmd->mdp_ctx) mdp_m2m_job_finish(cmd->mdp_ctx); @@ -575,7 +575,7 @@ static void mdp_handle_cmdq_callback(struct mbox_client *cl, void *mssg) mdp_comp_clocks_off(>pdev->dev, cmd->comps, cmd->num_comps); - if (atomic_dec_and_test(>job_count)) + if (refcount_dec_and_test(>job_count)) wake_up(>callback_wq); mdp_cmdq_pkt_destroy(>pkt); @@ -724,9 +724,9 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) int i, ret; u8 pp_used = __get_pp_num(param->param->type); - atomic_set(>job_count, pp_used); + refcount_set(>job_count, pp_used); if (atomic_read(>suspended)) { - atomic_set(>job_count, 0); + refcount_set(>job_count, 0); return -ECANCELED; } @@ -764,7 +764,7 @@ err_clock_off: mdp_comp_clocks_off(>pdev->dev, cmd[i]->comps, cmd[i]->num_comps); err_cancel_job: - atomic_set(>job_count, 0); + refcount_set(>job_count, 0); return ret; } diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c index 5209f531ef8d..c1f3bf98120a 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c @@ -380,14 +380,14 @@ static int __maybe_unused mdp_suspend(struct device *dev) atomic_set(>suspended, 1); - if (atomic_read(>job_count)) { + if (refcount_read(>job_count)) { ret = wait_event_timeout(mdp->callback_wq, -!atomic_read(>job_count), +!refcount_read(>job_count), 2 * HZ); if (ret == 0) { dev_err(dev, "%s:flushed cmdq task incomplete, count=%d\n", - __func__, atomic_read(>job_count)); + __func__, refcount_read(>job_count)); return -EBUSY; } } diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h index 8c09e984fd01..430251f63754 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h @@ -134,7 +134,7 @@ struct mdp_dev { /* synchronization protect for m2m device operation */ struct mutexm2m_lock; atomic_tsuspended; - atomic_tjob_count; + refcount_t job_count; }; struct mdp_pipe_info { diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c index 35a8b059bde5..0e69128a3772 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c @@ -104,14 +104,14 @@ static void mdp_m2m_devi
[git:media_stage/master] media: common: saa7146: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: common: saa7146: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:52 2024 +0100 Simplifies the code. Found by cocci: drivers/media/common/saa7146/saa7146_hlp.c:125:36-37: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:154:41-42: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:286:35-36: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:289:35-36: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-13-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/common/saa7146/saa7146_hlp.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) --- diff --git a/drivers/media/common/saa7146/saa7146_hlp.c b/drivers/media/common/saa7146/saa7146_hlp.c index 7569d8cdd4d8..fe3348af543e 100644 --- a/drivers/media/common/saa7146/saa7146_hlp.c +++ b/drivers/media/common/saa7146/saa7146_hlp.c @@ -122,7 +122,7 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev, xacm = 0; /* set horizontal filter parameters (CXY = CXUV) */ - cxy = hps_h_coeff_tab[( (xpsc - 1) < 63 ? (xpsc - 1) : 63 )].hps_coeff; + cxy = hps_h_coeff_tab[min(xpsc - 1, 63)].hps_coeff; cxuv = cxy; /* calculate and set horizontal fine scale (xsci) */ @@ -151,7 +151,7 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev, xacm = 0; /* get best match in the table of attenuations for horizontal scaling */ - h_atten = hps_h_coeff_tab[( (xpsc - 1) < 63 ? (xpsc - 1) : 63 )].weight_sum; + h_atten = hps_h_coeff_tab[min(xpsc - 1, 63)].weight_sum; for (i = 0; h_attenuation[i] != 0; i++) { if (h_attenuation[i] >= h_atten) @@ -283,10 +283,10 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field } /* get filter coefficients for cya, cyb from table hps_v_coeff_tab */ - cya_cyb = hps_v_coeff_tab[ (yacl < 63 ? yacl : 63 ) ].hps_coeff; + cya_cyb = hps_v_coeff_tab[min(yacl, 63)].hps_coeff; /* get best match in the table of attenuations for vertical scaling */ - v_atten = hps_v_coeff_tab[ (yacl < 63 ? yacl : 63 ) ].weight_sum; + v_atten = hps_v_coeff_tab[min(yacl, 63)].weight_sum; for (i = 0; v_attenuation[i] != 0; i++) { if (v_attenuation[i] >= v_atten)
[git:media_stage/master] media: netup_unidvb: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: netup_unidvb: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:54 2024 +0100 Simplify the code. Found by cocci: drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:138:26-27: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-15-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c index 46676f2c89c7..1c885d620b75 100644 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c @@ -135,7 +135,7 @@ static void netup_i2c_fifo_tx(struct netup_i2c *i2c) (readw(>regs->tx_fifo.stat_ctrl) & 0x3f); u32 msg_length = i2c->msg->len - i2c->xmit_size; - msg_length = (msg_length < fifo_space ? msg_length : fifo_space); + msg_length = min(msg_length, fifo_space); while (msg_length--) { data = i2c->msg->buf[i2c->xmit_size++]; writeb(data, >regs->tx_fifo.data8);
[git:media_stage/master] media: dvb-frontends: drx39xyj: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dvb-frontends: drx39xyj: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:53 2024 +0100 Replace ternary assignments with min() to simplify and make the code more readable. Found by cocci: drivers/media/dvb-frontends/drx39xyj/drxj.c:1447:23-24: WARNING opportunity for min() drivers/media/dvb-frontends/drx39xyj/drxj.c:1662:21-22: WARNING opportunity for min() drivers/media/dvb-frontends/drx39xyj/drxj.c:1685:24-25: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-14-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/drx39xyj/drxj.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) --- diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 1ef53754bc03..6fcaf07e1b82 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -1445,8 +1445,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, /* Read block from I2C */ do { - u16 todo = (datasize < DRXDAP_MAX_RCHUNKSIZE ? - datasize : DRXDAP_MAX_RCHUNKSIZE); + u16 todo = min(datasize, DRXDAP_MAX_RCHUNKSIZE); bufx = 0; @@ -1660,7 +1659,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, Address must be rewritten because HI is reset after data transport and expects an address. */ - todo = (block_size < datasize ? block_size : datasize); + todo = min(block_size, datasize); if (todo == 0) { u16 overhead_size_i2c_addr = 0; u16 data_block_size = 0; @@ -1682,9 +1681,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, first_err = st; } bufx = 0; - todo = - (data_block_size < -datasize ? data_block_size : datasize); + todo = min(data_block_size, datasize); } memcpy([bufx], data, todo); /* write (address if can do and) data */
[git:media_stage/master] media: au0828: Use umin macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: au0828: Use umin macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:55 2024 +0100 Simplifies the code. Found by cocci: drivers/media/usb/au0828/au0828-video.c:605:11-12: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-16-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/au0828/au0828-video.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) --- diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index fd9fc43d47e0..2ec49ea479d5 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -602,10 +602,7 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) vbi_field_size = dev->vbi_width * dev->vbi_height * 2; if (dev->vbi_read < vbi_field_size) { remain = vbi_field_size - dev->vbi_read; - if (len < remain) - lencopy = len; - else - lencopy = remain; + lencopy = umin(len, remain); if (vbi_buf != NULL) au0828_copy_vbi(dev, vbi_dma_q, vbi_buf, p,
[git:media_stage/master] media: flexcop-usb: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: flexcop-usb: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:56 2024 +0100 Simplifies the code. Found by cocci: drivers/media/usb/b2c2/flexcop-usb.c:201:8-9: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-17-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/b2c2/flexcop-usb.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) --- diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c index 43dd3c932a85..90f1aea99dac 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -197,10 +197,7 @@ static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb, return -EINVAL; } for (i = 0; i < len;) { - pagechunk = - wMax < bytes_left_to_read_on_page(addr, len) ? - wMax : - bytes_left_to_read_on_page(addr, len); + pagechunk = min(wMax, bytes_left_to_read_on_page(addr, len)); deb_info("%x\n", (addr & V8_MEMORY_PAGE_MASK) | (V8_MEMORY_EXTENDED*extended));
[git:media_stage/master] media: i2c: st-mipid02: Use the correct div function
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: st-mipid02: Use the correct div function Author: Ricardo Ribalda Date:Mon Apr 29 16:05:00 2024 +0100 link_freq does not fit in 32 bits. Found by cocci: drivers/media/i2c/st-mipid02.c:329:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_s64 instead. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-21-3c4865f5a...@chromium.org Reviewed-by: Benjamin Mugnier Reviewed-by: Sakari Ailus Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/st-mipid02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index f250640729ca..b947a55281f0 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -326,7 +326,7 @@ static int mipid02_configure_from_rx_speed(struct mipid02_dev *bridge, } dev_dbg(>dev, "detect link_freq = %lld Hz", link_freq); - do_div(ui_4, link_freq); + ui_4 = div64_u64(ui_4, link_freq); bridge->r.clk_lane_reg1 |= ui_4 << 2; return 0;
[git:media_stage/master] media: tegra-vde: Refactor timeout handling
This is an automatic generated email to let you know that the following patch were queued: Subject: media: tegra-vde: Refactor timeout handling Author: Ricardo Ribalda Date:Mon Apr 29 16:04:59 2024 +0100 Reorder the branches a bit, so cocci stops complaining about the code. drivers/media/platform/nvidia/tegra-vde/h264.c:645:20-21: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-20-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/nvidia/tegra-vde/h264.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/platform/nvidia/tegra-vde/h264.c b/drivers/media/platform/nvidia/tegra-vde/h264.c index 204e474d57f7..cfea5572a1b8 100644 --- a/drivers/media/platform/nvidia/tegra-vde/h264.c +++ b/drivers/media/platform/nvidia/tegra-vde/h264.c @@ -633,7 +633,9 @@ static int tegra_vde_decode_end(struct tegra_vde *vde) timeout = wait_for_completion_interruptible_timeout( >decode_completion, msecs_to_jiffies(1000)); - if (timeout == 0) { + if (timeout < 0) { + ret = timeout; + } else if (timeout == 0) { bsev_ptr = tegra_vde_readl(vde, vde->bsev, 0x10); macroblocks_nb = tegra_vde_readl(vde, vde->sxe, 0xC8) & 0x1FFF; read_bytes = bsev_ptr ? bsev_ptr - vde->bitstream_data_addr : 0; @@ -642,8 +644,6 @@ static int tegra_vde_decode_end(struct tegra_vde *vde) read_bytes, macroblocks_nb); ret = -EIO; - } else if (timeout < 0) { - ret = timeout; } else { ret = 0; }
[git:media_stage/master] media: stk1160: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: stk1160: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:58 2024 +0100 Instead of a custom min() implementation, use the real macro. Mitigates the following cocci WARNINGs: drivers/media/usb/stk1160/stk1160-video.c:133:12-13: WARNING opportunity for min() drivers/media/usb/stk1160/stk1160-video.c:176:13-14: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-19-3c4865f5a...@chromium.org Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/stk1160/stk1160-video.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) --- diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c index e79c45db60ab..9cbd957ecc90 100644 --- a/drivers/media/usb/stk1160/stk1160-video.c +++ b/drivers/media/usb/stk1160/stk1160-video.c @@ -130,10 +130,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len) dst += linesdone * bytesperline * 2 + lineoff; /* Copy the remaining of current line */ - if (remain < (bytesperline - lineoff)) - lencopy = remain; - else - lencopy = bytesperline - lineoff; + lencopy = min(remain, bytesperline - lineoff); /* * Check if we have enough space left in the buffer. @@ -178,10 +175,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len) src += lencopy; /* Copy one line at a time */ - if (remain < bytesperline) - lencopy = remain; - else - lencopy = bytesperline; + lencopy = min(remain, bytesperline); /* * Check if we have enough space left in the buffer.
[git:media_stage/master] media: gspca: cpia1: Use min macro
This is an automatic generated email to let you know that the following patch were queued: Subject: media: gspca: cpia1: Use min macro Author: Ricardo Ribalda Date:Mon Apr 29 16:04:57 2024 +0100 Simplifies the code. Found by cocci: drivers/media/usb/gspca/cpia1.c:607:30-31: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-18-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/gspca/cpia1.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) --- diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c index 5f5fa851ca64..14aaf36cde6e 100644 --- a/drivers/media/usb/gspca/cpia1.c +++ b/drivers/media/usb/gspca/cpia1.c @@ -604,10 +604,8 @@ static int find_over_exposure(int brightness) MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness - FLICKER_BRIGHTNESS_CONSTANT; - if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) - OverExposure = MaxAllowableOverExposure; - else - OverExposure = FLICKER_ALLOWABLE_OVER_EXPOSURE; + OverExposure = min(MaxAllowableOverExposure, + FLICKER_ALLOWABLE_OVER_EXPOSURE); return OverExposure; }
[git:media_stage/master] media: tc358746: Use the correct div_ function
This is an automatic generated email to let you know that the following patch were queued: Subject: media: tc358746: Use the correct div_ function Author: Ricardo Ribalda Date:Mon Apr 29 16:05:01 2024 +0100 fin does not fit in 32 bits in some arches. Found by cocci: drivers/media/i2c/tc358746.c:847:2-8: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead. Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-22-3c4865f5a...@chromium.org Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/tc358746.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- diff --git a/drivers/media/i2c/tc358746.c b/drivers/media/i2c/tc358746.c index d676adc4401b..edf79107adc5 100644 --- a/drivers/media/i2c/tc358746.c +++ b/drivers/media/i2c/tc358746.c @@ -844,8 +844,7 @@ static unsigned long tc358746_find_pll_settings(struct tc358746 *tc358746, continue; tmp = fout * postdiv; - do_div(tmp, fin); - mul = tmp; + mul = div64_ul(tmp, fin); if (mul > 511) continue;
[git:media_stage/master] media: mtk-vcodec: potential null pointer deference in SCP
This is an automatic generated email to let you know that the following patch were queued: Subject: media: mtk-vcodec: potential null pointer deference in SCP Author: Fullway Wang Date:Thu Jan 18 02:35:06 2024 + The return value of devm_kzalloc() needs to be checked to avoid NULL pointer deference. This is similar to CVE-2022-3113. Link: https://lore.kernel.org/linux-media/ph7pr20mb5925094dae3fd750c7e39e01bf...@ph7pr20mb5925.namprd20.prod.outlook.com Signed-off-by: Fullway Wang Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c | 2 ++ 1 file changed, 2 insertions(+) --- diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c index 6bbe55de6ce9..ff23b225db70 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c @@ -79,6 +79,8 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use } fw = devm_kzalloc(_dev->dev, sizeof(*fw), GFP_KERNEL); + if (!fw) + return ERR_PTR(-ENOMEM); fw->type = SCP; fw->ops = _vcodec_rproc_msg; fw->scp = scp;
[git:media_stage/master] media: mxl5xx: Move xpt structures off stack
This is an automatic generated email to let you know that the following patch were queued: Subject: media: mxl5xx: Move xpt structures off stack Author: Nathan Chancellor Date:Fri Jan 12 00:40:36 2024 + When building for LoongArch with clang 18.0.0, the stack usage of probe() is larger than the allowed 2048 bytes: drivers/media/dvb-frontends/mxl5xx.c:1698:12: warning: stack frame size (2368) exceeds limit (2048) in 'probe' [-Wframe-larger-than] 1698 | static int probe(struct mxl *state, struct mxl5xx_cfg *cfg) |^ 1 warning generated. This is the result of the linked LLVM commit, which changes how the arrays of structures in config_ts() get handled with CONFIG_INIT_STACK_ZERO and CONFIG_INIT_STACK_PATTERN, which causes the above warning in combination with inlining, as config_ts() gets inlined into probe(). This warning can be easily fixed by moving the array of structures off of the stackvia 'static const', which is a better location for these variables anyways because they are static data that is only ever read from, never modified, so allocating the stack space is wasteful. This drops the stack usage from 2368 bytes to 256 bytes with the same compiler and configuration. Link: https://lore.kernel.org/linux-media/20240111-dvb-mxl5xx-move-structs-off-stack-v1-1-ca4230e67...@kernel.org Cc: sta...@vger.kernel.org Closes: https://github.com/ClangBuiltLinux/linux/issues/1977 Link: https://github.com/llvm/llvm-project/commit/afe8b93ffdfef5d8879e1894b9d7dda40dee2b8d Signed-off-by: Nathan Chancellor Reviewed-by: Miguel Ojeda Tested-by: Miguel Ojeda Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/mxl5xx.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) --- diff --git a/drivers/media/dvb-frontends/mxl5xx.c b/drivers/media/dvb-frontends/mxl5xx.c index 4ebbcf05cc09..91e9c378397c 100644 --- a/drivers/media/dvb-frontends/mxl5xx.c +++ b/drivers/media/dvb-frontends/mxl5xx.c @@ -1381,57 +1381,57 @@ static int config_ts(struct mxl *state, enum MXL_HYDRA_DEMOD_ID_E demod_id, u32 nco_count_min = 0; u32 clk_type = 0; - struct MXL_REG_FIELD_T xpt_sync_polarity[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_sync_polarity[MXL_HYDRA_DEMOD_MAX] = { {0x90700010, 8, 1}, {0x90700010, 9, 1}, {0x90700010, 10, 1}, {0x90700010, 11, 1}, {0x90700010, 12, 1}, {0x90700010, 13, 1}, {0x90700010, 14, 1}, {0x90700010, 15, 1} }; - struct MXL_REG_FIELD_T xpt_clock_polarity[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_clock_polarity[MXL_HYDRA_DEMOD_MAX] = { {0x90700010, 16, 1}, {0x90700010, 17, 1}, {0x90700010, 18, 1}, {0x90700010, 19, 1}, {0x90700010, 20, 1}, {0x90700010, 21, 1}, {0x90700010, 22, 1}, {0x90700010, 23, 1} }; - struct MXL_REG_FIELD_T xpt_valid_polarity[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_valid_polarity[MXL_HYDRA_DEMOD_MAX] = { {0x90700014, 0, 1}, {0x90700014, 1, 1}, {0x90700014, 2, 1}, {0x90700014, 3, 1}, {0x90700014, 4, 1}, {0x90700014, 5, 1}, {0x90700014, 6, 1}, {0x90700014, 7, 1} }; - struct MXL_REG_FIELD_T xpt_ts_clock_phase[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_ts_clock_phase[MXL_HYDRA_DEMOD_MAX] = { {0x90700018, 0, 3}, {0x90700018, 4, 3}, {0x90700018, 8, 3}, {0x90700018, 12, 3}, {0x90700018, 16, 3}, {0x90700018, 20, 3}, {0x90700018, 24, 3}, {0x90700018, 28, 3} }; - struct MXL_REG_FIELD_T xpt_lsb_first[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_lsb_first[MXL_HYDRA_DEMOD_MAX] = { {0x907C, 16, 1}, {0x907C, 17, 1}, {0x907C, 18, 1}, {0x907C, 19, 1}, {0x907C, 20, 1}, {0x907C, 21, 1}, {0x907C, 22, 1}, {0x907C, 23, 1} }; - struct MXL_REG_FIELD_T xpt_sync_byte[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_sync_byte[MXL_HYDRA_DEMOD_MAX] = { {0x90700010, 0, 1}, {0x90700010, 1, 1}, {0x90700010, 2, 1}, {0x90700010, 3, 1}, {0x90700010, 4, 1}, {0x90700010, 5, 1}, {0x90700010, 6, 1}, {0x90700010, 7, 1} }; - struct MXL_REG_FIELD_T xpt_enable_output[MXL_HYDRA_DEMOD_MAX] = { + static const struct MXL_REG_FIELD_T xpt_enable_output[MXL_HYDRA_DEMOD_MAX] = { {0x907C, 0, 1}, {0x907C, 1, 1}, {0x907C, 2, 1}, {0x907C, 3, 1}, {0x907C, 4, 1}, {0x907C, 5, 1}, {0x907C, 6, 1}, {0x907C, 7, 1} }; - struct MXL_REG_FIELD_T xpt_err_replace_sync[MXL_HYDRA_DEMOD_MAX] = { + static const struct
[git:media_stage/master] media: cec: core: avoid recursive cec_claim_log_addrs
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: core: avoid recursive cec_claim_log_addrs Author: Hans Verkuil Date:Thu Feb 22 16:17:33 2024 + Keep track if cec_claim_log_addrs() is running, and return -EBUSY if it is when calling CEC_ADAP_S_LOG_ADDRS. This prevents a case where cec_claim_log_addrs() could be called while it was still in progress. Signed-off-by: Hans Verkuil Reported-by: Yang, Chenyuan Closes: https://lore.kernel.org/linux-media/ph7pr11mb57688e64ade4fe82e658d86da0...@ph7pr11mb5768.namprd11.prod.outlook.com/ Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)") Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/core/cec-adap.c | 6 +- drivers/media/cec/core/cec-api.c | 2 +- include/media/cec.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c index 6fc7de744ee9..a493cbce2456 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -1574,9 +1574,12 @@ unconfigure: */ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) { - if (WARN_ON(adap->is_configuring || adap->is_configured)) + if (WARN_ON(adap->is_claiming_log_addrs || + adap->is_configuring || adap->is_configured)) return; + adap->is_claiming_log_addrs = true; + init_completion(>config_completion); /* Ready to kick off the thread */ @@ -1591,6 +1594,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) wait_for_completion(>config_completion); mutex_lock(>lock); } + adap->is_claiming_log_addrs = false; } /* diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c index d64bb716f9c6..3ef915344304 100644 --- a/drivers/media/cec/core/cec-api.c +++ b/drivers/media/cec/core/cec-api.c @@ -178,7 +178,7 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh, CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU | CEC_LOG_ADDRS_FL_CDC_ONLY; mutex_lock(>lock); - if (!adap->is_configuring && + if (!adap->is_claiming_log_addrs && !adap->is_configuring && (!log_addrs.num_log_addrs || !adap->is_configured) && !cec_is_busy(adap, fh)) { err = __cec_s_log_addrs(adap, _addrs, block); diff --git a/include/media/cec.h b/include/media/cec.h index c8350258f10a..d3abe84c9c9e 100644 --- a/include/media/cec.h +++ b/include/media/cec.h @@ -258,6 +258,7 @@ struct cec_adapter { u16 phys_addr; bool needs_hpd; bool is_enabled; + bool is_claiming_log_addrs; bool is_configuring; bool must_reconfigure; bool is_configured;
[git:media_stage/master] media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: cec-adap: always cancel work in cec_transmit_msg_fh Author: Hans Verkuil Date:Fri Feb 23 12:24:38 2024 + Do not check for !data->completed, just always call cancel_delayed_work_sync(). This fixes a small race condition. Signed-off-by: Hans Verkuil Reported-by: Yang, Chenyuan Closes: https://lore.kernel.org/linux-media/ph7pr11mb57688e64ade4fe82e658d86da0...@ph7pr11mb5768.namprd11.prod.outlook.com/ Fixes: 490d84f6d73c ("media: cec: forgot to cancel delayed work") Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/core/cec-adap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c index 559a172ebc6c..6fc7de744ee9 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -936,8 +936,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, */ mutex_unlock(>lock); wait_for_completion_killable(>c); - if (!data->completed) - cancel_delayed_work_sync(>work); + cancel_delayed_work_sync(>work); mutex_lock(>lock); /* Cancel the transmit if it was interrupted */
[git:media_stage/master] media: cec: core: avoid confusing "transmit timed out" message
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: core: avoid confusing "transmit timed out" message Author: Hans Verkuil Date:Tue Apr 30 11:13:47 2024 +0100 If, when waiting for a transmit to finish, the wait is interrupted, then you might get a "transmit timed out" message, even though the transmit was interrupted and did not actually time out. Set transmit_in_progress_aborted to true if the wait_for_completion_killable() call was interrupted and ensure that the transmit is properly marked as ABORTED. Signed-off-by: Hans Verkuil Reported-by: Yang, Chenyuan Closes: https://lore.kernel.org/linux-media/ph7pr11mb57688e64ade4fe82e658d86da0...@ph7pr11mb5768.namprd11.prod.outlook.com/ Fixes: 590a8e564c6e ("media: cec: abort if the current transmit was canceled") Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/core/cec-adap.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) --- diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c index a493cbce2456..da09834990b8 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -490,6 +490,15 @@ int cec_thread_func(void *_adap) goto unlock; } + if (adap->transmit_in_progress && + adap->transmit_in_progress_aborted) { + if (adap->transmitting) + cec_data_cancel(adap->transmitting, + CEC_TX_STATUS_ABORTED, 0); + adap->transmit_in_progress = false; + adap->transmit_in_progress_aborted = false; + goto unlock; + } if (adap->transmit_in_progress && timeout) { /* * If we timeout, then log that. Normally this does @@ -771,6 +780,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, { struct cec_data *data; bool is_raw = msg_is_raw(msg); + int err; if (adap->devnode.unregistered) return -ENODEV; @@ -935,10 +945,13 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, * Release the lock and wait, retake the lock afterwards. */ mutex_unlock(>lock); - wait_for_completion_killable(>c); + err = wait_for_completion_killable(>c); cancel_delayed_work_sync(>work); mutex_lock(>lock); + if (err) + adap->transmit_in_progress_aborted = true; + /* Cancel the transmit if it was interrupted */ if (!data->completed) { if (data->msg.tx_status & CEC_TX_STATUS_OK)
[git:media_stage/master] media: cec: cec-api: add locking in cec_release()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec: cec-api: add locking in cec_release() Author: Hans Verkuil Date:Fri Feb 23 12:25:55 2024 + When cec_release() uses fh->msgs it has to take fh->lock, otherwise the list can get corrupted. Signed-off-by: Hans Verkuil Reported-by: Yang, Chenyuan Closes: https://lore.kernel.org/linux-media/ph7pr11mb57688e64ade4fe82e658d86da0...@ph7pr11mb5768.namprd11.prod.outlook.com/ Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)") Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/core/cec-api.c | 3 +++ 1 file changed, 3 insertions(+) --- diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c index 67dc79ef1705..d64bb716f9c6 100644 --- a/drivers/media/cec/core/cec-api.c +++ b/drivers/media/cec/core/cec-api.c @@ -664,6 +664,8 @@ static int cec_release(struct inode *inode, struct file *filp) list_del_init(>xfer_list); } mutex_unlock(>lock); + + mutex_lock(>lock); while (!list_empty(>msgs)) { struct cec_msg_entry *entry = list_first_entry(>msgs, struct cec_msg_entry, list); @@ -681,6 +683,7 @@ static int cec_release(struct inode *inode, struct file *filp) kfree(entry); } } + mutex_unlock(>lock); kfree(fh); cec_put_device(devnode);
[git:media_stage/master] media: verisilicon Correct a typo in H1_REG_ENC_CTRL2_DEBLOCKING_FILTER_MODE
This is an automatic generated email to let you know that the following patch were queued: Subject: media: verisilicon Correct a typo in H1_REG_ENC_CTRL2_DEBLOCKING_FILTER_MODE Author: Andrzej Pietrasiewicz Date:Thu Nov 16 15:48:11 2023 + It's a FILTER and not FILETER. Link: https://lore.kernel.org/linux-media/20231116154816.70959-2-andrze...@collabora.com Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Chen-Yu Tsai Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/verisilicon/hantro_h1_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/platform/verisilicon/hantro_h1_regs.h b/drivers/media/platform/verisilicon/hantro_h1_regs.h index 30e7e7b920b5..b45e6e104b23 100644 --- a/drivers/media/platform/verisilicon/hantro_h1_regs.h +++ b/drivers/media/platform/verisilicon/hantro_h1_regs.h @@ -62,7 +62,7 @@ #defineH1_REG_ENC_CTRL1_INTRA_PRED_MODE(x) ((x) << 16) #defineH1_REG_ENC_CTRL1_FRAME_NUM(x) ((x)) #define H1_REG_ENC_CTRL2 0x048 -#defineH1_REG_ENC_CTRL2_DEBLOCKING_FILETER_MODE(x) ((x) << 30) +#defineH1_REG_ENC_CTRL2_DEBLOCKING_FILTER_MODE(x) ((x) << 30) #defineH1_REG_ENC_CTRL2_H264_SLICE_SIZE(x) ((x) << 23) #defineH1_REG_ENC_CTRL2_DISABLE_QUARTER_PIXMV BIT(22) #defineH1_REG_ENC_CTRL2_TRANS8X8_MODE_EN BIT(21)
[git:media_stage/master] media: sunxi: a83-mips-csi2: also select GENERIC_PHY
This is an automatic generated email to let you know that the following patch were queued: Subject: media: sunxi: a83-mips-csi2: also select GENERIC_PHY Author: Randy Dunlap Date:Wed Sep 27 05:04:38 2023 +0100 When selecting GENERIC_PHY_MIPI_DPHY, also select GENERIC_PHY to prevent kconfig warnings: WARNING: unmet direct dependencies detected for GENERIC_PHY_MIPI_DPHY Depends on [n]: GENERIC_PHY [=n] Selected by [y]: - VIDEO_SUN8I_A83T_MIPI_CSI2 [=y] && MEDIA_SUPPORT [=y] && MEDIA_PLATFORM_SUPPORT [=y] && MEDIA_PLATFORM_DRIVERS [=y] && V4L_PLATFORM_DRIVERS [=y] && VIDEO_DEV [=y] && (ARCH_SUNXI || COMPILE_TEST [=y]) && PM [=y] && COMMON_CLK [=y] && RESET_CONTROLLER [=y] Fixes: 94d7fd9692b5 ("media: sunxi: Depend on GENERIC_PHY_MIPI_DPHY") Reported-by: kernel test robot Closes: https://lore.kernel.org/r/ZQ/WS8HC1A3F0Qn8@rli9-mobl Link: https://lore.kernel.org/linux-media/20230927040438.5589-1-rdun...@infradead.org Signed-off-by: Randy Dunlap Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig | 1 + 1 file changed, 1 insertion(+) --- diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig index 47a8c0fb7eb9..99c401e653bc 100644 --- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig +++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig @@ -8,6 +8,7 @@ config VIDEO_SUN8I_A83T_MIPI_CSI2 select VIDEO_V4L2_SUBDEV_API select V4L2_FWNODE select REGMAP_MMIO + select GENERIC_PHY select GENERIC_PHY_MIPI_DPHY help Support for the Allwinner A83T MIPI CSI-2 controller and D-PHY.
[git:media_stage/master] media: verisilicon: Correct a typo in H1_REG_MAD_CTRL_MAD_THRESHOLD
This is an automatic generated email to let you know that the following patch were queued: Subject: media: verisilicon: Correct a typo in H1_REG_MAD_CTRL_MAD_THRESHOLD Author: Andrzej Pietrasiewicz Date:Thu Nov 16 15:48:12 2023 + It's a THRESHOLD and not a THREDHOLD. Link: https://lore.kernel.org/linux-media/20231116154816.70959-3-andrze...@collabora.com Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Chen-Yu Tsai Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/verisilicon/hantro_h1_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/platform/verisilicon/hantro_h1_regs.h b/drivers/media/platform/verisilicon/hantro_h1_regs.h index b45e6e104b23..8650cc489392 100644 --- a/drivers/media/platform/verisilicon/hantro_h1_regs.h +++ b/drivers/media/platform/verisilicon/hantro_h1_regs.h @@ -89,7 +89,7 @@ #define H1_REG_STR_BUF_LIMIT 0x060 #define H1_REG_MAD_CTRL0x064 #defineH1_REG_MAD_CTRL_QP_ADJUST(x)((x) << 28) -#defineH1_REG_MAD_CTRL_MAD_THREDHOLD(x)((x) << 22) +#defineH1_REG_MAD_CTRL_MAD_THRESHOLD(x)((x) << 22) #defineH1_REG_MAD_CTRL_QP_SUM_DIV2(x) ((x)) #define H1_REG_ADDR_VP8_PROB_CNT 0x068 #define H1_REG_QP_VAL 0x06c
[git:media_tree/master] media: atomisp: Fix sh_css_config_input_network_2400() coding style
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Fix sh_css_config_input_network_2400() coding style Author: Hans de Goede Date:Tue Apr 16 10:19:52 2024 +0100 Fix the if (stream->config.mode == IA_CSS_INPUT_MODE_PRBS) {} block coding style. Specifically fix the weird declaration of variables split over multiple lines. While at it also split the multi-line width calculation at a more logical place. Reported-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/pci/sh_css.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) --- diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 6520a35b6e47..42a69b26db01 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -498,17 +498,15 @@ sh_css_config_input_network_2400(struct ia_css_stream *stream) } if (stream->config.mode == IA_CSS_INPUT_MODE_PRBS) { - unsigned int hblank_cycles = 100, - vblank_lines = 6, - width, - height, - vblank_cycles; - width = (stream->config.input_config.input_res.width) / (1 + - (stream->config.pixels_per_clock == 2)); + unsigned int width, height, vblank_cycles; + const unsigned int hblank_cycles = 100; + const unsigned int vblank_lines = 6; + + width = (stream->config.input_config.input_res.width) / + (1 + (stream->config.pixels_per_clock == 2)); height = stream->config.input_config.input_res.height; vblank_cycles = vblank_lines * (width + hblank_cycles); - sh_css_sp_configure_sync_gen(width, height, hblank_cycles, -vblank_cycles); + sh_css_sp_configure_sync_gen(width, height, hblank_cycles, vblank_cycles); } ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_config_input_network() leave:\n");
[git:media_tree/master] media: atomisp: Drop custom flash support
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Drop custom flash support Author: Hans de Goede Date:Sat Apr 13 16:10:41 2024 +0100 Remove the custom flash handling from the atomisp driver. There are only few Bay Trail / Cherry Trail devices with flash and if those will ever get supported then this should be done through the new standard include/linux/led-class-flash.h APIs instead of with atomisp specific custom APIs. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab .../staging/media/atomisp/include/linux/atomisp.h | 42 .../media/atomisp/include/linux/atomisp_platform.h | 1 - drivers/staging/media/atomisp/pci/atomisp_cmd.c| 117 + drivers/staging/media/atomisp/pci/atomisp_cmd.h| 4 - drivers/staging/media/atomisp/pci/atomisp_fops.c | 14 --- .../staging/media/atomisp/pci/atomisp_internal.h | 1 - drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 61 --- drivers/staging/media/atomisp/pci/atomisp_subdev.h | 13 --- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 7 -- .../media/atomisp/pci/ia_css_frame_public.h| 8 -- .../media/atomisp/pci/ia_css_stream_public.h | 14 --- drivers/staging/media/atomisp/pci/sh_css.c | 33 -- 12 files changed, 2 insertions(+), 313 deletions(-) --- diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/drivers/staging/media/atomisp/include/linux/atomisp.h index b2735a008052..db0c1b87c9ef 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp.h @@ -614,26 +614,6 @@ enum atomisp_camera_port { ATOMISP_CAMERA_NR_PORTS }; -/* Flash modes. Default is off. - * Setting a flash to TORCH or INDICATOR mode will automatically - * turn it on. Setting it to FLASH mode will not turn on the flash - * until the FLASH_STROBE command is sent. */ -enum atomisp_flash_mode { - ATOMISP_FLASH_MODE_OFF, - ATOMISP_FLASH_MODE_FLASH, - ATOMISP_FLASH_MODE_TORCH, - ATOMISP_FLASH_MODE_INDICATOR, -}; - -/* Flash statuses, used by atomisp driver to check before starting - * flash and after having started flash. */ -enum atomisp_flash_status { - ATOMISP_FLASH_STATUS_OK, - ATOMISP_FLASH_STATUS_HW_ERROR, - ATOMISP_FLASH_STATUS_INTERRUPTED, - ATOMISP_FLASH_STATUS_TIMEOUT, -}; - /* Frame status. This is used to detect corrupted frames and flash * exposed frames. Usually, the first 2 frames coming out of the sensor * are corrupted. When using flash, the frame before and the frame after @@ -661,7 +641,6 @@ enum atomisp_ext_isp_id { EXT_ISP_CID_AF_STATUS, EXT_ISP_CID_GET_AF_MODE, EXT_ISP_CID_CAPTURE_BURST, - EXT_ISP_CID_FLASH_MODE, EXT_ISP_CID_ZOOM, EXT_ISP_CID_SHOT_MODE }; @@ -694,12 +673,6 @@ enum atomisp_burst_capture_options { EXT_ISP_BURST_CAPTURE_CTRL_STOP }; -#define EXT_ISP_FLASH_MODE_OFF 0 -#define EXT_ISP_FLASH_MODE_ON 1 -#define EXT_ISP_FLASH_MODE_AUTO2 -#define EXT_ISP_LED_TORCH_OFF 3 -#define EXT_ISP_LED_TORCH_ON 4 - #define EXT_ISP_SHOT_MODE_AUTO 0 #define EXT_ISP_SHOT_MODE_BEAUTY_FACE 1 #define EXT_ISP_SHOT_MODE_BEST_PHOTO 2 @@ -894,18 +867,6 @@ enum atomisp_burst_capture_options { * Exposure, Flash and privacy (indicator) light controls, to be upstreamed */ #define V4L2_CID_CAMERA_LASTP1 (V4L2_CID_CAMERA_CLASS_BASE + 1024) -/* Flash related CIDs, see also: - * http://linuxtv.org/downloads/v4l-dvb-apis/extended-controls.html\ - * #flash-controls */ - -/* Request a number of flash-exposed frames. The frame status can be - * found in the reserved field in the v4l2_buffer struct. */ -#define V4L2_CID_REQUEST_FLASH (V4L2_CID_CAMERA_LASTP1 + 3) -/* Query flash driver status. See enum atomisp_flash_status above. */ -#define V4L2_CID_FLASH_STATUS (V4L2_CID_CAMERA_LASTP1 + 5) -/* Set the flash mode (see enum atomisp_flash_mode) */ -#define V4L2_CID_FLASH_MODE(V4L2_CID_CAMERA_LASTP1 + 10) - #define V4L2_CID_RUN_MODE (V4L2_CID_CAMERA_LASTP1 + 20) #define ATOMISP_RUN_MODE_VIDEO 1 #define ATOMISP_RUN_MODE_STILL_CAPTURE 2 @@ -925,9 +886,6 @@ enum atomisp_burst_capture_options { #define ATOMISP_VFPP_DISABLE_SCALER1 #define ATOMISP_VFPP_DISABLE_LOWLAT2 -/* Query real flash status register value */ -#define V4L2_CID_FLASH_STATUS_REGISTER (V4L2_CID_CAMERA_LASTP1 + 26) - #define V4L2_CID_START_ZSL_CAPTURE (V4L2_CID_CAMERA_LASTP1 + 28) /* Lock and unlock raw buffer */ #define V4L2_CID_ENABLE_RAW_BUFFER_LOCK (V4L2_CID_CAMERA_LASTP1 + 29) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index
[git:media_tree/master] media: atomisp: Remove unsused macros
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Remove unsused macros Author: Andy Shevchenko Date:Tue Mar 26 19:09:03 2024 + Entire defs.h can be killed, so do that. Also kill same macro definitions in hive_types.h Link: https://lore.kernel.org/r/20240326190903.1422069-1-andriy.shevche...@linux.intel.com Signed-off-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/pci/bits.h | 4 +-- drivers/staging/media/atomisp/pci/defs.h | 37 -- .../pci/hive_isp_css_common/host/dma_local.h | 1 - drivers/staging/media/atomisp/pci/hive_types.h | 19 --- .../atomisp/pci/runtime/debug/src/ia_css_debug.c | 3 +- 5 files changed, 4 insertions(+), 60 deletions(-) --- diff --git a/drivers/staging/media/atomisp/pci/bits.h b/drivers/staging/media/atomisp/pci/bits.h index 9fab02ebddc5..f7a66287d763 100644 --- a/drivers/staging/media/atomisp/pci/bits.h +++ b/drivers/staging/media/atomisp/pci/bits.h @@ -16,9 +16,9 @@ #ifndef _HRT_BITS_H #define _HRT_BITS_H -#include "defs.h" +#include -#define _hrt_ones(n) HRTCAT(_hrt_ones_, n) +#define _hrt_ones(n) CONCATENATE(_hrt_ones_, n) #define _hrt_ones_0x0 0xU #define _hrt_ones_0x1 0x0001U #define _hrt_ones_0x2 0x0003U diff --git a/drivers/staging/media/atomisp/pci/defs.h b/drivers/staging/media/atomisp/pci/defs.h deleted file mode 100644 index 785e7a670a00.. diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/dma_local.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/dma_local.h index 48a1ace79897..1a71dbebbbe2 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/dma_local.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/dma_local.h @@ -19,7 +19,6 @@ #include #include "dma_global.h" -#include /* HRTCAT() */ #include /* _hrt_get_bits() */ #include /* HIVE_DMA_NUM_CHANNELS */ #include diff --git a/drivers/staging/media/atomisp/pci/hive_types.h b/drivers/staging/media/atomisp/pci/hive_types.h index 55d36931f079..34f462c0c9f9 100644 --- a/drivers/staging/media/atomisp/pci/hive_types.h +++ b/drivers/staging/media/atomisp/pci/hive_types.h @@ -17,25 +17,6 @@ #define _HRT_HIVE_TYPES_H #include "version.h" -#include "defs.h" - -#ifndef HRTCAT3 -#define _HRTCAT3(m, n, o) m##n##o -#define HRTCAT3(m, n, o) _HRTCAT3(m, n, o) -#endif - -#ifndef HRTCAT4 -#define _HRTCAT4(m, n, o, p) m##n##o##p -#define HRTCAT4(m, n, o, p) _HRTCAT4(m, n, o, p) -#endif - -#ifndef HRTMIN -#define HRTMIN(a, b) (((a) < (b)) ? (a) : (b)) -#endif - -#ifndef HRTMAX -#define HRTMAX(a, b) (((a) > (b)) ? (a) : (b)) -#endif /* boolean data type */ typedef unsigned int hive_bool; diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 3e92794555ec..3807b31bb98f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -31,6 +31,7 @@ #define __INLINE_STREAM2MMIO__ #endif +#include #include /* for strscpy() */ #include "ia_css_debug.h" @@ -861,7 +862,7 @@ void ia_css_debug_wake_up_sp(void) } #define FIND_DMEM_PARAMS_TYPE(stream, kernel, type) \ - (struct HRTCAT(HRTCAT(sh_css_isp_, type), _params) *) \ + (struct CONCATENATE(CONCATENATE(sh_css_isp_, type), _params) *) \ findf_dmem_params(stream, offsetof(struct ia_css_memory_offsets, dmem.kernel)) #define FIND_DMEM_PARAMS(stream, kernel) FIND_DMEM_PARAMS_TYPE(stream, kernel, kernel)
[git:media_tree/master] media: atomisp: Remove input_port_ID_t
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Remove input_port_ID_t Author: Hans de Goede Date:Fri Apr 12 19:38:55 2024 +0100 Change the single, unexpected user of CSI_PORT0_ID for (port = CSI_PORT0_ID; port < N_CSI_PORTS; port++) to for (port = 0; port < N_CSI_PORTS; port++) { matching all the other for-loops iterating over the ports in the same file. And remove the now fully unused input_port_ID_t enum type. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/pci/sh_css_mipi.c | 2 +- drivers/staging/media/atomisp/pci/system_global.h | 12 2 files changed, 1 insertion(+), 13 deletions(-) --- diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c index 6e11fd771938..80f0395cc560 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -489,7 +489,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) } } else { /* pipe ==NULL */ /* AM TEMP: free-ing all mipi buffers just like a legacy code. */ - for (port = CSI_PORT0_ID; port < N_CSI_PORTS; port++) { + for (port = 0; port < N_CSI_PORTS; port++) { unsigned int i; for (i = 0; i < my_css.num_mipi_frames[port]; i++) { diff --git a/drivers/staging/media/atomisp/pci/system_global.h b/drivers/staging/media/atomisp/pci/system_global.h index 060b924023ec..e8a29f73d67a 100644 --- a/drivers/staging/media/atomisp/pci/system_global.h +++ b/drivers/staging/media/atomisp/pci/system_global.h @@ -201,18 +201,6 @@ enum mipi_port_id { #defineN_RX_CHANNEL_ID 4 -/* Generic port enumeration with an internal port type ID */ -typedef enum { - CSI_PORT0_ID = 0, - CSI_PORT1_ID, - CSI_PORT2_ID, - TPG_PORT0_ID, - PRBS_PORT0_ID, - FIFO_PORT0_ID, - MEMORY_PORT0_ID, - N_INPUT_PORT_ID -} input_port_ID_t; - typedef enum { CAPTURE_UNIT0_ID = 0, CAPTURE_UNIT1_ID,
[git:media_tree/master] media: atomisp: Remove empty s_stream() op from CSI subdev
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Remove empty s_stream() op from CSI subdev Author: Hans de Goede Date:Sun Apr 14 15:45:55 2024 +0100 Remove the empty csi2_set_stream() callback and remove the now empty csi2_video_ops struct. While at it also remove the empty csi2_core_ops struct. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/pci/atomisp_csi2.c | 23 --- 1 file changed, 23 deletions(-) --- diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2.c b/drivers/staging/media/atomisp/pci/atomisp_csi2.c index e939a09a279b..9288910eeb6c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2.c @@ -141,27 +141,6 @@ static int csi2_set_format(struct v4l2_subdev *sd, >format); } -/* - * csi2_set_stream - Enable/Disable streaming on the CSI2 module - * @sd: ISP CSI2 V4L2 subdevice - * @enable: Enable/disable stream (1/0) - * - * Return 0 on success or a negative error code otherwise. - */ -static int csi2_set_stream(struct v4l2_subdev *sd, int enable) -{ - return 0; -} - -/* subdev core operations */ -static const struct v4l2_subdev_core_ops csi2_core_ops = { -}; - -/* subdev video operations */ -static const struct v4l2_subdev_video_ops csi2_video_ops = { - .s_stream = csi2_set_stream, -}; - /* subdev pad operations */ static const struct v4l2_subdev_pad_ops csi2_pad_ops = { .enum_mbus_code = csi2_enum_mbus_code, @@ -172,8 +151,6 @@ static const struct v4l2_subdev_pad_ops csi2_pad_ops = { /* subdev operations */ static const struct v4l2_subdev_ops csi2_ops = { - .core = _core_ops, - .video = _video_ops, .pad = _pad_ops, };
[git:media_tree/master] media: atomisp: ov2722: Remove power on sensor from set_fmt() callback
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: ov2722: Remove power on sensor from set_fmt() callback Author: Hans de Goede Date:Fri Apr 12 15:38:14 2024 +0100 The atomisp driver now properly ensures s_power(1) is called before calling the set_fmt() callback, so this workaround is no longer necessary. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 12 drivers/staging/media/atomisp/i2c/ov2722.h | 1 - 2 files changed, 13 deletions(-) --- diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c index 133e346ae51b..d60630ea16df 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c @@ -528,9 +528,6 @@ static int power_up(struct v4l2_subdev *sd) return -ENODEV; } - if (dev->power_on == 1) - return 0; /* Already on */ - /* power control */ ret = power_ctrl(sd, 1); if (ret) @@ -555,7 +552,6 @@ static int power_up(struct v4l2_subdev *sd) /* according to DS, 20ms is needed between PWDN and i2c access */ msleep(20); - dev->power_on = 1; return 0; fail_clk: @@ -579,9 +575,6 @@ static int power_down(struct v4l2_subdev *sd) return -ENODEV; } - if (dev->power_on == 0) - return 0; /* Already off */ - ret = dev->platform_data->flisclk_ctrl(sd, 0); if (ret) dev_err(>dev, "flisclk failed\n"); @@ -599,7 +592,6 @@ static int power_down(struct v4l2_subdev *sd) if (ret) dev_err(>dev, "vprog failed.\n"); - dev->power_on = 0; return ret; } @@ -677,9 +669,6 @@ static int ov2722_set_fmt(struct v4l2_subdev *sd, mutex_lock(>input_lock); - /* s_power has not been called yet for std v4l2 clients (camorama) */ - power_up(sd); - dev->pixels_per_line = dev->res->pixels_per_line; dev->lines_per_frame = dev->res->lines_per_frame; @@ -978,7 +967,6 @@ static int ov2722_probe(struct i2c_client *client) return -ENOMEM; mutex_init(>input_lock); - dev->power_on = -1; dev->res = _res_preview[0]; v4l2_i2c_subdev_init(>sd, client, _ops); diff --git a/drivers/staging/media/atomisp/i2c/ov2722.h b/drivers/staging/media/atomisp/i2c/ov2722.h index 640d3ffcaa5c..5920a4d45d06 100644 --- a/drivers/staging/media/atomisp/i2c/ov2722.h +++ b/drivers/staging/media/atomisp/i2c/ov2722.h @@ -198,7 +198,6 @@ struct ov2722_device { struct ov2722_resolution *res; struct camera_sensor_platform_data *platform_data; - int power_on; u16 pixels_per_line; u16 lines_per_frame; u8 type;
[git:media_tree/master] media: atomisp: Remove test pattern generator (TPG) support
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Remove test pattern generator (TPG) support Author: Hans de Goede Date:Fri Apr 12 19:28:46 2024 +0100 The TPG support registers a v4l2-subdev for this, but this is not part of the media-controller graph in any way. After manually selecting the TPG as input using the s_input ioctl it does not work. Several supported sensors have their own working TPG and using the sensor's TPG means that the same data-flow is used as with actual sensors rather then the quite different data-flow from the ISP's builtin TPG. Remove the broken TPG support, when a test-pattern is needed for testing a sensor's TPG can be used. Using a sensor's TPG is actually better for testing since then the actual normal data-flow is being tested. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/Makefile | 1 - .../media/atomisp/include/linux/atomisp_platform.h | 1 - drivers/staging/media/atomisp/pci/atomisp_cmd.c| 37 +++-- .../media/atomisp/pci/atomisp_compat_css20.c | 31 +--- .../staging/media/atomisp/pci/atomisp_internal.h | 2 - drivers/staging/media/atomisp/pci/atomisp_tpg.c| 164 - drivers/staging/media/atomisp/pci/atomisp_tpg.h| 39 - drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 27 .../pci/hive_isp_css_common/host/input_system.c| 38 - drivers/staging/media/atomisp/pci/ia_css.h | 1 - .../media/atomisp/pci/ia_css_stream_public.h | 3 - drivers/staging/media/atomisp/pci/ia_css_tpg.h | 79 -- .../atomisp/pci/isp2400_input_system_global.h | 1 - .../atomisp/pci/isp2400_input_system_public.h | 15 -- .../atomisp/pci/isp2401_input_system_global.h | 1 - .../atomisp/pci/runtime/debug/src/ia_css_debug.c | 17 --- .../media/atomisp/pci/runtime/ifmtr/src/ifmtr.c| 11 -- .../atomisp/pci/runtime/isys/src/virtual_isys.c| 28 +--- drivers/staging/media/atomisp/pci/sh_css.c | 88 +-- .../staging/media/atomisp/pci/sh_css_internal.h| 1 - drivers/staging/media/atomisp/pci/sh_css_sp.c | 14 -- drivers/staging/media/atomisp/pci/sh_css_sp.h | 7 - 22 files changed, 21 insertions(+), 585 deletions(-) --- diff --git a/drivers/staging/media/atomisp/Makefile b/drivers/staging/media/atomisp/Makefile index fcd3e51ae9ce..43116c74781d 100644 --- a/drivers/staging/media/atomisp/Makefile +++ b/drivers/staging/media/atomisp/Makefile @@ -21,7 +21,6 @@ atomisp-objs += \ pci/atomisp_fops.o \ pci/atomisp_ioctl.o \ pci/atomisp_subdev.o \ - pci/atomisp_tpg.o \ pci/atomisp_v4l2.o \ pci/sh_css_firmware.o \ pci/sh_css_host_data.o \ diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index 2535402afd73..63dd7236e3a8 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h @@ -112,7 +112,6 @@ enum atomisp_input_format { enum intel_v4l2_subdev_type { RAW_CAMERA = 1, LED_FLASH = 2, - TEST_PATTERN = 3, }; struct intel_v4l2_subdev_id { diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index ecd521043021..38b7ebb186a5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -4133,6 +4133,7 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, unsigned int width, unsigned int height) = configure_pp_input_nop; const struct atomisp_in_fmt_conv *fc = NULL; + struct v4l2_mbus_framefmt *ffmt; int ret, i; isp_sink_crop = atomisp_subdev_get_rect( @@ -4143,28 +4144,26 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, if (!format) return -EINVAL; - if (input->type != TEST_PATTERN) { - mipi_info = atomisp_to_sensor_mipi_info(input->camera); + mipi_info = atomisp_to_sensor_mipi_info(input->camera); - if (atomisp_set_sensor_mipi_to_isp(asd, ATOMISP_INPUT_STREAM_GENERAL, - mipi_info)) - return -EINVAL; - - if (mipi_info) - fc = atomisp_find_in_fmt_conv_by_atomisp_in_fmt(mipi_info->input_format); + if (atomisp_set_sensor_mipi_to_isp(asd, ATOMISP_INPUT_STREAM_GENERAL, + mipi_info)) + return -EINVAL; - if (!fc) - fc = atomisp_find_in_fmt_conv( -atomisp_subdev_get_
[git:media_tree/master] media: atomisp: Ensure CSI-receiver[x] -> ISP links correctly reflect current sensor
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Ensure CSI-receiver[x] -> ISP links correctly reflect current sensor Author: Hans de Goede Date:Thu Apr 11 21:21:37 2024 +0100 Add a new atomisp_setup_input_links() helper which ensures that the CSI-receiver -> ISP link for input_curr is marked as enabled and the other CSI-receiver -> ISP links are disabled. And call this helper from atomisp_register_device_nodes() for the initial setup and from atomisp_select_input() for runtime input_curr changes. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/pci/atomisp_cmd.c | 34 +++ drivers/staging/media/atomisp/pci/atomisp_cmd.h | 3 ++ drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 6 +++- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 4 +++ 4 files changed, 46 insertions(+), 1 deletion(-) --- diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 6c93bab17955..b273234dc439 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3755,9 +3755,43 @@ int atomisp_select_input(struct atomisp_device *isp, unsigned int input) if (input != input_orig) atomisp_s_sensor_power(isp, input_orig, 0); + atomisp_setup_input_links(isp); return 0; } +/* + * Ensure the CSI-receiver -> ISP link for input_curr is marked as enabled and + * the other CSI-receiver -> ISP links are disabled. + */ +void atomisp_setup_input_links(struct atomisp_device *isp) +{ + struct media_link *link; + + lockdep_assert_held(>media_dev.graph_mutex); + + for (int i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++) { + link = media_entity_find_link( + >csi2_port[i].subdev.entity.pads[CSI2_PAD_SOURCE], + >asd.subdev.entity.pads[ATOMISP_SUBDEV_PAD_SINK]); + if (!link) { + dev_err(isp->dev, "Error cannot find CSI2-port[%d] -> ISP link\n", i); + continue; /* Should never happen */ + } + + /* +* Modify the flags directly, calling media_entity_setup_link() +* will end up calling atomisp_link_setup() which calls this +* function again leading to endless recursion. +*/ + if (isp->sensor_subdevs[i] == isp->inputs[isp->asd.input_curr].camera) + link->flags |= MEDIA_LNK_FL_ENABLED; + else + link->flags &= ~MEDIA_LNK_FL_ENABLED; + + link->reverse->flags = link->flags; + } +} + static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp, struct v4l2_mbus_framefmt *ffmt, int which) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h index f302763b7b2f..03703eed86fa 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h @@ -247,6 +247,9 @@ int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, bool /* Select which sensor to use, must be called with a valid input */ int atomisp_select_input(struct atomisp_device *isp, unsigned int input); +/* Setup media-controller links to reflect input_curr setting */ +void atomisp_setup_input_links(struct atomisp_device *isp); + /* This function looks up the closest available resolution. */ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, const struct atomisp_format_bridge **fmt_ret, diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 1f8d44900a82..c16942051cfb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -461,7 +461,11 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) if (ret) return ret; - return atomisp_select_input(isp, input); + mutex_lock(>media_dev.graph_mutex); + ret = atomisp_select_input(isp, input); + mutex_unlock(>media_dev.graph_mutex); + + return ret; } /* diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 1d7d38e2f904..1008a709b589 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1085,6 +1085,10 @@ int atomisp_register_device_nodes(struct atomisp_device *isp) dev_warn(isp->
[git:media_tree/master] media: atomisp: Propagate v4l2_mbus_framefmt.field to CSI port sink pad
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Propagate v4l2_mbus_framefmt.field to CSI port sink pad Author: Hans de Goede Date:Fri Apr 12 15:27:53 2024 +0100 Most sensor drivers report V4L2_FIELD_NONE as v4l2_mbus_framefmt.field value. Propagate this to the v4l2_mbus_framefmt for the CSI port to pass the link validation done by media_pipeline_start(). Keep the v4l2_mbus_framefmt.field for the source pad of the CSI port as V4L2_FIELD_ANY to match the ISP sink pad. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/pci/atomisp_csi2.c | 3 +++ 1 file changed, 3 insertions(+) --- diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2.c b/drivers/staging/media/atomisp/pci/atomisp_csi2.c index 89118438a3b6..e939a09a279b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2.c @@ -107,9 +107,12 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, actual_ffmt->height = clamp_t(u32, ffmt->height, ATOM_ISP_MIN_HEIGHT, ATOM_ISP_MAX_HEIGHT); + actual_ffmt->field = ffmt->field; tmp_ffmt = *ffmt = *actual_ffmt; + /* Always use V4L2_FIELD_ANY to match the ISP sink pad */ + tmp_ffmt.field = V4L2_FIELD_ANY; return atomisp_csi2_set_ffmt(sd, sd_state, which, CSI2_PAD_SOURCE, _ffmt);
[git:media_tree/master] media: atomisp: Drop the atomisp custom lm3554 flash driver
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Drop the atomisp custom lm3554 flash driver Author: Hans de Goede Date:Sat Apr 13 15:26:18 2024 +0100 Drop the atomisp custom lm3554 flash driver, support for flash drivers using the custom atomisp flash interface is going to be removed from the atomisp driver. If flash supports for the lm3554 turns out to be necessary on some atomisp devices in the future then this should be re-implemented using the new include/linux/led-class-flash.h APIs. The atomisp specific lm3554 driver could still be usable as a reference for how to use / driver the lm3554 for a future re-implementation using standardized APIs, but for that it can be retrieved from the git history. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/i2c/Kconfig | 15 - drivers/staging/media/atomisp/i2c/Makefile | 5 - drivers/staging/media/atomisp/i2c/atomisp-lm3554.c | 955 - .../staging/media/atomisp/include/media/lm3554.h | 132 --- 4 files changed, 1107 deletions(-) --- diff --git a/drivers/staging/media/atomisp/i2c/Kconfig b/drivers/staging/media/atomisp/i2c/Kconfig index f62d183b787f..8710c483015c 100644 --- a/drivers/staging/media/atomisp/i2c/Kconfig +++ b/drivers/staging/media/atomisp/i2c/Kconfig @@ -56,18 +56,3 @@ config VIDEO_ATOMISP_GC0310 help This is a Video4Linux2 sensor-level driver for the Galaxycore GC0310 0.3MP sensor. - -# -# Kconfig for flash drivers -# - -config VIDEO_ATOMISP_LM3554 - tristate "LM3554 flash light driver" - depends on ACPI - depends on VIDEO_DEV && I2C - help -This is a Video4Linux2 sub-dev driver for the LM3554 -flash light driver. - -To compile this driver as a module, choose M here: the -module will be called lm3554 diff --git a/drivers/staging/media/atomisp/i2c/Makefile b/drivers/staging/media/atomisp/i2c/Makefile index e946cc91e5ff..3073cfa75ecf 100644 --- a/drivers/staging/media/atomisp/i2c/Makefile +++ b/drivers/staging/media/atomisp/i2c/Makefile @@ -9,8 +9,3 @@ obj-$(CONFIG_VIDEO_ATOMISP_OV2722) += atomisp-ov2722.o obj-$(CONFIG_VIDEO_ATOMISP_GC0310) += atomisp-gc0310.o obj-$(CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER) += atomisp-libmsrlisthelper.o - -# Makefile for flash drivers -# - -obj-$(CONFIG_VIDEO_ATOMISP_LM3554) += atomisp-lm3554.o diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c deleted file mode 100644 index cf5d9317b11a.. diff --git a/drivers/staging/media/atomisp/include/media/lm3554.h b/drivers/staging/media/atomisp/include/media/lm3554.h deleted file mode 100644 index 711b7d7c9950..
[git:media_tree/master] media: i2c: ov4689: Fix typo in a comment
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: ov4689: Fix typo in a comment Author: Mikhail Rudenko Date:Tue Apr 16 23:45:11 2024 +0100 Fix a spelling error in a comment. Signed-off-by: Mikhail Rudenko Reviewed-by: Laurent Pinchart Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov4689.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c index c4d4afd38906..f826571f8f68 100644 --- a/drivers/media/i2c/ov4689.c +++ b/drivers/media/i2c/ov4689.c @@ -692,7 +692,7 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) switch (ctrl->id) { case V4L2_CID_EXPOSURE: - /* 4 least significant bits of expsoure are fractional part */ + /* 4 least significant bits of exposure are fractional part */ ret = ov4689_write_reg(ov4689->client, OV4689_REG_EXPOSURE, OV4689_REG_VALUE_24BIT, ctrl->val << 4); break;
[git:media_tree/master] media: atomisp: Propagate set_fmt on sensor results to CSI port
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Propagate set_fmt on sensor results to CSI port Author: Hans de Goede Date:Fri Apr 12 14:51:15 2024 +0100 So far the CSI port sink and source pads have not had their fmt set at all, leaving things at the default of SBGGR8_1X8/0x0. This means that pipeline validation such as e.g. done when calling media_pipeline_start() will fail since the links to / from the CSI ports have different fmts on each end. Store a pointer to the CSI port v4l2-subdev in struct atomisp_input_subdev, and use this in atomisp_set_sensor_crop_and_fmt() to propagate the sensors new fmt after a successful set_fmt to the CSI port it is connected too. The input->csi_port pointer also allows simplifying atomisp_link_setup(). Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/pci/atomisp_cmd.c | 7 +++ drivers/staging/media/atomisp/pci/atomisp_internal.h | 1 + drivers/staging/media/atomisp/pci/atomisp_subdev.c | 17 +++-- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 1 + 4 files changed, 12 insertions(+), 14 deletions(-) --- diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index b273234dc439..ecd521043021 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3858,6 +3858,13 @@ set_fmt: if (sd_state) v4l2_subdev_unlock_state(sd_state); + /* Propagate new fmt to CSI port */ + if (which == V4L2_SUBDEV_FORMAT_ACTIVE) { + ret = v4l2_subdev_call(input->csi_port, pad, set_fmt, NULL, ); + if (ret) + return ret; + } + *ffmt = format.format; return ret; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index 02fffa7f65e1..c81a1c5f2864 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -129,6 +129,7 @@ struct atomisp_input_subdev { bool crop_support; bool camera_on; struct v4l2_subdev *camera; + struct v4l2_subdev *csi_port; /* Sensor rects for sensors which support crop */ struct v4l2_rect native_rect; struct v4l2_rect active_rect; diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index aabffd6a424d..53225958c23b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -644,7 +644,7 @@ static int atomisp_link_setup(struct media_entity *entity, entity); struct atomisp_sub_device *asd = v4l2_get_subdevdata(sd); struct atomisp_device *isp = asd->isp; - int i, csi_idx, ret; + int i, ret; /* ISP's source is immutable */ if (local != >pads[ATOMISP_SUBDEV_PAD_SINK]) { @@ -653,24 +653,13 @@ static int atomisp_link_setup(struct media_entity *entity, return -EINVAL; } - for (csi_idx = 0; csi_idx < ATOMISP_CAMERA_NR_PORTS; csi_idx++) { - if (>csi2_port[csi_idx].pads[CSI2_PAD_SOURCE] == remote) - break; - } - - if (csi_idx == ATOMISP_CAMERA_NR_PORTS) { - v4l2_err(sd, "Error cannot find CSI receiver for remote pad\n"); - return -EINVAL; - } - - for (i = 0; i < isp->input_cnt; i++) { - if (isp->inputs[i].camera == isp->sensor_subdevs[csi_idx]) + if (>inputs[i].csi_port->entity.pads[CSI2_PAD_SOURCE] == remote) break; } if (i == isp->input_cnt) { - v4l2_err(sd, "Error no sensor for CSI receiver %d\n", csi_idx); + v4l2_err(sd, "Error no sensor for selected CSI receiver\n"); return -EINVAL; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 1008a709b589..809b9c4e7a92 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1058,6 +1058,7 @@ int atomisp_register_device_nodes(struct atomisp_device *isp) input->type = RAW_CAMERA; input->port = i; input->camera = isp->sensor_subdevs[i]; + input->csi_port = >csi2_port[i].subdev; atomisp_init_sensor(input);