media: atomisp: More cleanups / code removal
Subsystems (4)
cover media: atomisp: More cleanups / code removal
Hi Mauro,
Here is a second set of atomisp cleanups / code removal. This applies on top of my previous v2 series from here:
https://lore.kernel.org/linux-media/[email protected]/
I plan to do more atomisp work the coming few weeks. So I'm thinking it might be better / easier for you if I just send you a pull-req based on 6.0-rc1 with all atomisp patches bundled around rc5/rc6 time.
Would that work for you ?
I do plan to keep sending out (incremental) patch-sets with my work (like this one) for review / comments.
Regards,
Hans
Dan Carpenter (1):
media: atomisp: prevent integer overflow in sh_css_set_black_frame()
Hans de Goede (13):
media: atomisp: Fix device_caps reporting of the registered video-devs
media: atomisp: Remove file-injection support
media: atomisp: Remove atomisp_file_fops and atomisp_file_ioctl_ops
media: atomisp: Remove the outq videobuf queue
media: atomisp: Remove never set file_input flag
media: atomisp: Remove the ACC device node
media: atomisp: Remove some further ATOMISP_ACC_* related dead code
media: atomisp: Remove empty atomisp_css_set_cont_prev_start_time()
function
media: atomisp: Split subdev and video-node registration into 2 steps
media: atomisp: Register /dev/* nodes at the end of
atomisp_pci_probe()
media: atomisp: Remove loading mutex
media: atomisp: Fix v4l2_fh resource leak on open errors
media: atomisp: Simplify v4l2_fh_open() error handling
drivers/staging/media/atomisp/Makefile | 1 - .../media/atomisp/include/linux/atomisp.h | 14 -- .../staging/media/atomisp/pci/atomisp_cmd.c | 134 +--------- .../staging/media/atomisp/pci/atomisp_cmd.h | 2 - .../media/atomisp/pci/atomisp_compat.h | 6 - .../media/atomisp/pci/atomisp_compat_css20.c | 26 -- .../staging/media/atomisp/pci/atomisp_file.c | 229 ------------------ .../staging/media/atomisp/pci/atomisp_file.h | 44 ---- .../staging/media/atomisp/pci/atomisp_fops.c | 187 ++------------ .../media/atomisp/pci/atomisp_internal.h | 16 +- .../staging/media/atomisp/pci/atomisp_ioctl.c | 192 ++------------- .../staging/media/atomisp/pci/atomisp_ioctl.h | 4 - .../media/atomisp/pci/atomisp_subdev.c | 95 ++------ .../media/atomisp/pci/atomisp_subdev.h | 47 +--- .../staging/media/atomisp/pci/atomisp_v4l2.c | 99 +++----- .../staging/media/atomisp/pci/atomisp_v4l2.h | 3 - .../staging/media/atomisp/pci/sh_css_params.c | 4 +- 17 files changed, 104 insertions(+), 999 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_file.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_file.h
Signature · 1 line
2.37.2
PATCH 1/14 media: atomisp: Fix device_caps reporting of the registered video-devs
atomisp_subdev_register_entities() had V4L2_CAP_VIDEO_CAPTURE / V4L2_CAP_VIDEO_OUT swapped. Or-ing in V4L2_CAP_VIDEO_OUT for the nodes which allow capturing from the camera and or-ing in V4L2_CAP_VIDEO_CAPTURE for the file-injection node (mem2mem use of the ISP).
Things happen to still work for the capture device-nodes because the "shared" caps also included V4L2_CAP_VIDEO_CAPTURE, so those shared nodes advertised V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUT.
Fix things so that only the correct caps are advertised.
--- .../media/atomisp/pci/atomisp_subdev.c | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +7 -17
@@ -1314,16 +1314,12 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd, struct v4l2_device *vdev) {int ret; -u32 device_caps;/* * FIXME: check if all device caps are properly initialized. -* Should any of those use V4L2_CAP_META_OUTPUT? Probably yes. +* Should any of those use V4L2_CAP_META_CAPTURE? Probably yes. */ - device_caps =V4L2_CAP_VIDEO_CAPTURE | -V4L2_CAP_STREAMING ; -/* Register the subdev and video node. */ ret =v4l2_device_register_subdev (vdev, &asd->subdev);
@@ -1331,39 +1327,34 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd, goto error; asd->video_out_preview.vdev.v4l2_dev = vdev; - asd->video_out_preview.vdev.device_caps = device_caps | -V4L2_CAP_VIDEO_OUTPUT ; + asd->video_out_preview.vdev.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; ret =video_register_device (&asd->video_out_preview.vdev,VFL_TYPE_VIDEO ,-1 );if (ret <0 ) goto error; asd->video_out_capture.vdev.v4l2_dev = vdev; - asd->video_out_capture.vdev.device_caps = device_caps | -V4L2_CAP_VIDEO_OUTPUT ; + asd->video_out_capture.vdev.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; ret =video_register_device (&asd->video_out_capture.vdev,VFL_TYPE_VIDEO ,-1 );if (ret <0 ) goto error; asd->video_out_vf.vdev.v4l2_dev = vdev; - asd->video_out_vf.vdev.device_caps = device_caps | -V4L2_CAP_VIDEO_OUTPUT ; + asd->video_out_vf.vdev.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; ret =video_register_device (&asd->video_out_vf.vdev,VFL_TYPE_VIDEO ,-1 );if (ret <0 ) goto error; asd->video_out_video_capture.vdev.v4l2_dev = vdev; - asd->video_out_video_capture.vdev.device_caps = device_caps | -V4L2_CAP_VIDEO_OUTPUT ; + asd->video_out_video_capture.vdev.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; ret =video_register_device (&asd->video_out_video_capture.vdev,VFL_TYPE_VIDEO ,-1 );if (ret <0 ) goto error; asd->video_acc.vdev.v4l2_dev = vdev; - asd->video_acc.vdev.device_caps = device_caps | -V4L2_CAP_VIDEO_OUTPUT ; + asd->video_acc.vdev.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; ret =video_register_device (&asd->video_acc.vdev,VFL_TYPE_VIDEO ,-1 );if (ret <0 )
@@ -1377,8 +1368,7 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,return 0 ; asd->video_in.vdev.v4l2_dev = vdev; - asd->video_in.vdev.device_caps = device_caps | -V4L2_CAP_VIDEO_CAPTURE ; + asd->video_in.vdev.device_caps =V4L2_CAP_VIDEO_OUT |V4L2_CAP_STREAMING ; ret =video_register_device (&asd->video_in.vdev,VFL_TYPE_VIDEO ,-1 );if (ret <0 )
Signature · 1 line
2.37.2
PATCH 2/14 media: atomisp: Remove file-injection support
In reply to Hans de GoedeThe file-injection support of the atomisp driver has not been tested and is not necessary for camera support, remove it.
Note the main reason for removing this is because it depends on the videobuf (version 1) outq and we want to remove or replace all videobuf usage in the driver.
--- drivers/staging/media/atomisp/Makefile | 1 - .../staging/media/atomisp/pci/atomisp_file.c | 229 ------------------ .../staging/media/atomisp/pci/atomisp_file.h | 44 ---- .../staging/media/atomisp/pci/atomisp_fops.c | 3 +- .../media/atomisp/pci/atomisp_internal.h | 4 +- .../staging/media/atomisp/pci/atomisp_ioctl.c | 3 +- .../media/atomisp/pci/atomisp_subdev.c | 40 +-- .../media/atomisp/pci/atomisp_subdev.h | 1 - .../staging/media/atomisp/pci/atomisp_v4l2.c | 30 --- 9 files changed, 8 insertions(+), 347 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_file.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_file.h
drivers/staging/media/atomisp/Makefile +0 -1
@@ -17,7 +17,6 @@ atomisp-objs += \ pci/atomisp_compat_css20.o \ pci/atomisp_csi2.o \ pci/atomisp_drvfs.o \ - pci/atomisp_file.o \ pci/atomisp_fops.o \ pci/atomisp_ioctl.o \ pci/atomisp_subdev.o \
drivers/staging/media/atomisp/pci/atomisp_file.c deleted +0 -229
229 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_file.h deleted +0 -44
44 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_fops.c +1 -2
@@ -742,8 +742,7 @@ static unsigned int atomisp_subdev_users(struct atomisp_sub_device *asd) asd->video_out_vf.users + asd->video_out_capture.users + asd->video_out_video_capture.users + - asd->video_acc.users + - asd->video_in.users; + asd->video_acc.users; }unsigned int atomisp_dev_users (struct atomisp_device *isp)
drivers/staging/media/atomisp/pci/atomisp_internal.h +1 -3
@@ -34,7 +34,6 @@#include "sh_css_legacy.h" #include "atomisp_csi2.h" -#include "atomisp_file.h" #include "atomisp_subdev.h" #include "atomisp_tpg.h" #include "atomisp_compat.h"
@@ -86,7 +85,7 @@#define ATOM_ISP_POWER_DOWN 0#define ATOM_ISP_POWER_UP 1 -#define ATOM_ISP_MAX_INPUTS 4 +#define ATOM_ISP_MAX_INPUTS 3#define ATOMISP_SC_TYPE_SIZE 2
@@ -241,7 +240,6 @@ struct atomisp_device {struct atomisp_mipi_csi2_device csi2_port[ATOMISP_CAMERA_NR_PORTS ];struct atomisp_tpg_device tpg; -struct atomisp_file_device file_dev;/* Purpose of mutex is to protect and serialize use of isp data * structures and css API calls. */
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +1 -2
@@ -609,8 +609,7 @@ atomisp_subdev_streaming_count(struct atomisp_sub_device *asd)return asd->video_out_preview.capq.streaming + asd->video_out_capture.capq.streaming + asd->video_out_video_capture.capq.streaming - + asd->video_out_vf.capq.streaming - + asd->video_in.capq.streaming; + + asd->video_out_vf.capq.streaming; }unsigned int atomisp_streaming_count (struct atomisp_device *isp)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +5 -35
@@ -1126,9 +1126,6 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)if (ret <0 )return ret; -atomisp_init_subdev_pipe (asd, &asd->video_in, -V4L2_BUF_TYPE_VIDEO_OUTPUT ); -atomisp_init_subdev_pipe (asd, &asd->video_out_preview,V4L2_BUF_TYPE_VIDEO_CAPTURE );
@@ -1143,11 +1140,6 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)atomisp_init_acc_pipe (asd, &asd->video_acc); - ret =atomisp_video_init (&asd->video_in,"MEMORY" , -ATOMISP_RUN_MODE_SDV ); -if (ret <0 ) -return ret; - ret =atomisp_video_init (&asd->video_out_capture,"CAPTURE" ,ATOMISP_RUN_MODE_STILL_CAPTURE );if (ret <0 )
@@ -1226,7 +1218,11 @@ int atomisp_create_pads_links(struct atomisp_device *isp)return ret; } } -for (i =0 ; i < isp->input_cnt -2 ; i++) { +for (i =0 ; i < isp->input_cnt; i++) { +/* Don't create links for the test-pattern-generator */ +if (isp->inputs[i].type ==TEST_PATTERN ) +continue ; + ret = media_create_pad_link(&isp->inputs[i].camera->entity, 0, &isp->csi2_port[isp->inputs[i]. port].subdev.entity,
@@ -1262,17 +1258,6 @@ int atomisp_create_pads_links(struct atomisp_device *isp) entity, 0, 0);if (ret <0 )return ret; -/* -* file input only supported on subdev0 -* so do not create pad link for subdevs other then subdev0 -*/ -if (asd->index) -return 0 ; - ret =media_create_pad_link (&asd->video_in.vdev.entity, -0 , &asd->subdev.entity, -ATOMISP_SUBDEV_PAD_SINK ,0 ); -if (ret <0 ) -return ret; }return 0 ; }
@@ -1302,7 +1287,6 @@ void atomisp_subdev_unregister_entities(struct atomisp_sub_device *asd) {atomisp_subdev_cleanup_entities (asd);v4l2_device_unregister_subdev (&asd->subdev); -atomisp_video_unregister (&asd->video_in);atomisp_video_unregister (&asd->video_out_preview);atomisp_video_unregister (&asd->video_out_vf);atomisp_video_unregister (&asd->video_out_capture);
@@ -1360,20 +1344,6 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,if (ret <0 ) goto error; -/* -* file input only supported on subdev0 -* so do not create video node for subdevs other then subdev0 -*/ -if (asd->index) -return 0 ; - - asd->video_in.vdev.v4l2_dev = vdev; - asd->video_in.vdev.device_caps =V4L2_CAP_VIDEO_OUT |V4L2_CAP_STREAMING ; - ret =video_register_device (&asd->video_in.vdev, -VFL_TYPE_VIDEO ,-1 ); -if (ret <0 ) - goto error; -return 0 ; error:
drivers/staging/media/atomisp/pci/atomisp_subdev.h +0 -1
@@ -297,7 +297,6 @@ struct atomisp_sub_device {enum atomisp_subdev_input_entity input;unsigned int output; -struct atomisp_video_pipe video_in;struct atomisp_video_pipe video_out_capture;/* capture output */ struct atomisp_video_pipe video_out_vf;/* viewfinder output */ struct atomisp_video_pipe video_out_preview;/* preview output */
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +0 -30
@@ -34,7 +34,6 @@#include "atomisp_cmd.h" #include "atomisp_common.h" #include "atomisp_fops.h" -#include "atomisp_file.h" #include "atomisp_ioctl.h" #include "atomisp_internal.h" #include "atomisp-regs.h"
@@ -1158,7 +1157,6 @@ static void atomisp_unregister_entities(struct atomisp_device *isp)for (i =0 ; i < isp->num_of_streams; i++)atomisp_subdev_unregister_entities (&isp->asd[i]);atomisp_tpg_unregister_entities (&isp->tpg); -atomisp_file_input_unregister_entities (&isp->file_dev);for (i =0 ; i <ATOMISP_CAMERA_NR_PORTS ; i++)atomisp_mipi_csi2_unregister_entities (&isp->csi2_port[i]);
@@ -1210,13 +1208,6 @@ static int atomisp_register_entities(struct atomisp_device *isp) goto csi_and_subdev_probe_failed; } - ret = -atomisp_file_input_register_entities (&isp->file_dev, &isp->v4l2_dev); -if (ret <0 ) { -dev_err (isp->dev,"atomisp_file_input_register_entities\n" ); - goto file_input_register_failed; - } - ret =atomisp_tpg_register_entities (&isp->tpg, &isp->v4l2_dev);if (ret <0 ) {dev_err (isp->dev,"atomisp_tpg_register_entities\n" );
@@ -1267,14 +1258,6 @@ static int atomisp_register_entities(struct atomisp_device *isp) } } -dev_dbg (isp->dev, -"FILE_INPUT enable, camera_cnt: %d\n" , isp->input_cnt); - isp->inputs[isp->input_cnt].type =FILE_INPUT ; - isp->inputs[isp->input_cnt].port =-1 ; - isp->inputs[isp->input_cnt].camera_caps = -atomisp_get_default_camera_caps (); - isp->inputs[isp->input_cnt++].camera = &isp->file_dev.sd; -if (isp->input_cnt <ATOM_ISP_MAX_INPUTS ) {dev_dbg (isp->dev,"TPG detected, camera_cnt: %d\n" , isp->input_cnt);
@@ -1304,8 +1287,6 @@ static int atomisp_register_entities(struct atomisp_device *isp) subdev_register_failed:atomisp_tpg_unregister_entities (&isp->tpg); tpg_register_failed: -atomisp_file_input_unregister_entities (&isp->file_dev); -file_input_register_failed:for (i =0 ; i <ATOMISP_CAMERA_NR_PORTS ; i++)atomisp_mipi_csi2_unregister_entities (&isp->csi2_port[i]); csi_and_subdev_probe_failed:
@@ -1326,13 +1307,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp) goto error_mipi_csi2; } - ret =atomisp_file_input_init (isp); -if (ret <0 ) { -dev_err (isp->dev, -"file input device initialization failed\n" ); - goto error_file_input; - } - ret =atomisp_tpg_init (isp);if (ret <0 ) {dev_err (isp->dev,"tpg initialization failed\n" );
@@ -1350,8 +1324,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp) error_isp_subdev: error_tpg:atomisp_tpg_cleanup (isp); -error_file_input: -atomisp_file_input_cleanup (isp); error_mipi_csi2:atomisp_mipi_csi2_cleanup (isp);return ret;
@@ -1360,7 +1332,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp)static void atomisp_uninitialize_modules (struct atomisp_device *isp) {atomisp_tpg_cleanup (isp); -atomisp_file_input_cleanup (isp);atomisp_mipi_csi2_cleanup (isp); }
@@ -1852,7 +1823,6 @@ static void atomisp_pci_remove(struct pci_dev *pdev)atomisp_unregister_entities (isp);destroy_workqueue (isp->wdt_work_queue); -atomisp_file_input_cleanup (isp);release_firmware (isp->firmware); }
Signature · 1 line
2.37.2
PATCH 3/14 media: atomisp: Remove atomisp_file_fops and atomisp_file_ioctl_ops
In reply to Hans de GoedeAfter the file-injection support removal, atomisp_video_pipe->type never is V4L2_BUF_TYPE_VIDEO_OUTPUT anymore, so the V4L2_BUF_TYPE_VIDEO_OUTPUT support path in atomisp_video_init() is never hit and this path is the only user of atomisp_file_fops and atomisp_file_ioctl_ops.
Remove atomisp_file_fops and atomisp_file_ioctl_ops and all of the functions which are only referenced by these ops structs.
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 84 ------------ .../staging/media/atomisp/pci/atomisp_cmd.h | 1 - .../staging/media/atomisp/pci/atomisp_fops.c | 20 --- .../staging/media/atomisp/pci/atomisp_ioctl.c | 122 ------------------ .../staging/media/atomisp/pci/atomisp_ioctl.h | 4 - .../staging/media/atomisp/pci/atomisp_v4l2.c | 6 - 6 files changed, 237 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +0 -84
@@ -4906,41 +4906,6 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,return 0 ; } -static int -atomisp_try_fmt_file (struct atomisp_device *isp,struct v4l2_format *f) -{ -u32 width = f->fmt.pix.width; -u32 height = f->fmt.pix.height; -u32 pixelformat = f->fmt.pix.pixelformat; -enum v4l2_field field = f->fmt.pix.field; -u32 depth; - -if (!atomisp_get_format_bridge (pixelformat)) { -dev_err (isp->dev,"Wrong output pixelformat\n" ); -return -EINVAL ; - } - - depth =atomisp_get_pixel_depth (pixelformat); - -if (field ==V4L2_FIELD_ANY ) { - field =V4L2_FIELD_NONE ; - }else if (field !=V4L2_FIELD_NONE ) { -dev_err (isp->dev,"Wrong output field\n" ); -return -EINVAL ; - } - - f->fmt.pix.field = field; - f->fmt.pix.width =clamp_t (u32, -rounddown (width, (u32 )ATOM_ISP_STEP_WIDTH ), -ATOM_ISP_MIN_WIDTH ,ATOM_ISP_MAX_WIDTH ); - f->fmt.pix.height =clamp_t (u32,rounddown (height, - (u32 )ATOM_ISP_STEP_HEIGHT ), -ATOM_ISP_MIN_HEIGHT ,ATOM_ISP_MAX_HEIGHT ); - f->fmt.pix.bytesperline = (width * depth) >>3 ; - -return 0 ; -} -enum mipi_port_id __get_mipi_port (struct atomisp_device *isp,enum atomisp_camera_port port) {
@@ -6078,55 +6043,6 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)return 0 ; } -int atomisp_set_fmt_file (struct video_device *vdev,struct v4l2_format *f) -{ -struct atomisp_device *isp =video_get_drvdata (vdev); -struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev); -struct atomisp_sub_device *asd = pipe->asd; -struct v4l2_mbus_framefmt ffmt = {0 }; -const struct atomisp_format_bridge *format_bridge; -struct v4l2_subdev_fh fh; -int ret; - -if (!asd) { -dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , - __func__, vdev->name); -return -EINVAL ; - } - -v4l2_fh_init (&fh.vfh, vdev); - -dev_dbg (isp->dev,"setting fmt %ux%u 0x%x for file inject\n" , - f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); - ret =atomisp_try_fmt_file (isp, f); -if (ret) { -dev_err (isp->dev,"atomisp_try_fmt_file err: %d\n" , ret); -return ret; - } - - format_bridge =atomisp_get_format_bridge (f->fmt.pix.pixelformat); -if (!format_bridge) { -dev_dbg (isp->dev,"atomisp_get_format_bridge err! fmt:0x%x\n" , - f->fmt.pix.pixelformat); -return -EINVAL ; - } - - pipe->pix = f->fmt.pix; -atomisp_css_input_set_mode (asd,IA_CSS_INPUT_MODE_FIFO ); -atomisp_css_input_configure_port (asd, -__get_mipi_port (isp,ATOMISP_CAMERA_PORT_PRIMARY ),2 ,0xffff4 , -0 ,0 ,0 ,0 ); - ffmt.width = f->fmt.pix.width; - ffmt.height = f->fmt.pix.height; - ffmt.code = format_bridge->mbus_code; - -atomisp_subdev_set_ffmt (&asd->subdev, fh.state, -V4L2_SUBDEV_FORMAT_ACTIVE , -ATOMISP_SUBDEV_PAD_SINK , &ffmt); - -return 0 ; -} -int atomisp_set_shading_table (struct atomisp_sub_device *asd,struct atomisp_shading_table *user_shading_table) {
drivers/staging/media/atomisp/pci/atomisp_cmd.h +0 -1
@@ -269,7 +269,6 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f, bool *res_overflow);int atomisp_set_fmt (struct video_device *vdev,struct v4l2_format *f); -int atomisp_set_fmt_file (struct video_device *vdev,struct v4l2_format *f);int atomisp_set_shading_table (struct atomisp_sub_device *asd,struct atomisp_shading_table *shading_table);
drivers/staging/media/atomisp/pci/atomisp_fops.c +0 -20
@@ -1269,14 +1269,6 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma)return ret; } -static int atomisp_file_mmap (struct file *file,struct vm_area_struct *vma) -{ -struct video_device *vdev =video_devdata (file); -struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev); - -return videobuf_mmap_mapper (&pipe->outq, vma); -} -static __poll_t atomisp_poll (struct file *file,struct poll_table_struct *pt) {
@@ -1309,15 +1301,3 @@ const struct v4l2_file_operations atomisp_fops = {#endif .poll = atomisp_poll, }; - -const struct v4l2_file_operations atomisp_file_fops = { - .owner =THIS_MODULE , - .open = atomisp_open, - .release = atomisp_release, - .mmap = atomisp_file_mmap, - .unlocked_ioctl = video_ioctl2, -#ifdef CONFIG_COMPAT -/* .compat_ioctl32 = atomisp_compat_ioctl32, */ -#endif - .poll = atomisp_poll, -};
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +0 -122
161 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_ioctl.h +0 -4
@@ -49,12 +49,8 @@ enum ia_css_pipe_id atomisp_get_css_pipe_id(struct atomisp_sub_devicevoid atomisp_videobuf_free_buf (struct videobuf_buffer *vb); -extern const struct v4l2_file_operations atomisp_file_fops; -extern const struct v4l2_ioctl_ops atomisp_ioctl_ops; -extern const struct v4l2_ioctl_ops atomisp_file_ioctl_ops; -unsigned int atomisp_streaming_count (struct atomisp_device *isp);/* compat_ioctl for 32bit userland app and 64bit kernel */
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +0 -6
@@ -442,12 +442,6 @@ int atomisp_video_init(struct atomisp_video_pipe *video, const char *name, video->vdev.fops = &atomisp_fops; video->vdev.ioctl_ops = &atomisp_ioctl_ops;break ; -case V4L2_BUF_TYPE_VIDEO_OUTPUT : - direction ="input" ; - video->pad.flags =MEDIA_PAD_FL_SOURCE ; - video->vdev.fops = &atomisp_file_fops; - video->vdev.ioctl_ops = &atomisp_file_ioctl_ops; -break ;default :return -EINVAL ; }
Signature · 1 line
2.37.2
PATCH 4/14 media: atomisp: Remove the outq videobuf queue
In reply to Hans de GoedeAfter the file-injection support removal the outq videobuf queue is no longer used, remove it.
--- .../staging/media/atomisp/pci/atomisp_fops.c | 62 ------------------- .../media/atomisp/pci/atomisp_subdev.c | 1 - .../media/atomisp/pci/atomisp_subdev.h | 9 ++- 3 files changed, 4 insertions(+), 68 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_fops.c +0 -62
@@ -593,47 +593,6 @@ static void atomisp_buf_release(struct videobuf_queue *vq,atomisp_videobuf_free_buf (vb); } -static int atomisp_buf_setup_output (struct videobuf_queue *vq, -unsigned int *count,unsigned int *size) -{ -struct atomisp_video_pipe *pipe = vq->priv_data; - - *size = pipe->pix.sizeimage; - -return 0 ; -} - -static int atomisp_buf_prepare_output (struct videobuf_queue *vq, -struct videobuf_buffer *vb, -enum v4l2_field field) -{ -struct atomisp_video_pipe *pipe = vq->priv_data; - - vb->size = pipe->pix.sizeimage; - vb->width = pipe->pix.width; - vb->height = pipe->pix.height; - vb->field = field; - vb->state =VIDEOBUF_PREPARED ; - -return 0 ; -} - -static void atomisp_buf_queue_output (struct videobuf_queue *vq, -struct videobuf_buffer *vb) -{ -struct atomisp_video_pipe *pipe = vq->priv_data; - -list_add_tail (&vb->queue, &pipe->activeq_out); - vb->state =VIDEOBUF_QUEUED ; -} - -static void atomisp_buf_release_output (struct videobuf_queue *vq, -struct videobuf_buffer *vb) -{ -videobuf_vmalloc_free (vb); - vb->state =VIDEOBUF_NEEDS_INIT ; -} -static const struct videobuf_queue_ops videobuf_qops = { .buf_setup = atomisp_buf_setup, .buf_prepare = atomisp_buf_prepare,
@@ -641,13 +600,6 @@ static const struct videobuf_queue_ops videobuf_qops = { .buf_release = atomisp_buf_release, }; -static const struct videobuf_queue_ops videobuf_qops_output = { - .buf_setup = atomisp_buf_setup_output, - .buf_prepare = atomisp_buf_prepare_output, - .buf_queue = atomisp_buf_queue_output, - .buf_release = atomisp_buf_release_output, -}; -static int atomisp_init_pipe (struct atomisp_video_pipe *pipe) {/* init locks */
@@ -660,15 +612,7 @@ static int atomisp_init_pipe(struct atomisp_video_pipe *pipe)sizeof (struct atomisp_buffer ), pipe, NULL); /* ext_lock: NULL */ -videobuf_queue_vmalloc_init (&pipe->outq, &videobuf_qops_output,NULL , - &pipe->irq_lock, -V4L2_BUF_TYPE_VIDEO_OUTPUT , -V4L2_FIELD_NONE , -sizeof (struct atomisp_buffer ), pipe, -NULL );/* ext_lock: NULL */ -INIT_LIST_HEAD (&pipe->activeq); -INIT_LIST_HEAD (&pipe->activeq_out);INIT_LIST_HEAD (&pipe->buffers_waiting_for_param);INIT_LIST_HEAD (&pipe->per_frame_params); memset(pipe->frame_request_config_id, 0,
@@ -964,12 +908,6 @@ static int atomisp_release(struct file *file) goto done; } -if (pipe->outq.bufs[0 ]) { -mutex_lock (&pipe->outq.vb_lock); -videobuf_queue_cancel (&pipe->outq); -mutex_unlock (&pipe->outq.vb_lock); - } -/* * A little trick here: * file injection input resolution is recorded in the sink pad,
drivers/staging/media/atomisp/pci/atomisp_subdev.c +0 -1
@@ -1066,7 +1066,6 @@ static void atomisp_init_subdev_pipe(struct atomisp_sub_device *asd, pipe->isp = asd->isp;spin_lock_init (&pipe->irq_lock);INIT_LIST_HEAD (&pipe->activeq); -INIT_LIST_HEAD (&pipe->activeq_out);INIT_LIST_HEAD (&pipe->buffers_waiting_for_param);INIT_LIST_HEAD (&pipe->per_frame_params); memset(pipe->frame_request_config_id,
drivers/staging/media/atomisp/pci/atomisp_subdev.h +4 -5
@@ -70,9 +70,7 @@ struct atomisp_video_pipe {enum v4l2_buf_type type;struct media_pad pad;struct videobuf_queue capq; -struct videobuf_queue outq;struct list_head activeq; -struct list_head activeq_out;/* * the buffers waiting for per-frame parameters, this is only valid * in per-frame setting mode.
@@ -86,9 +84,10 @@ struct atomisp_video_pipe {unsigned int buffers_in_css; -/* irq_lock is used to protect video buffer state change operations and -* also to make activeq, activeq_out, capq and outq list -* operations atomic. */ +/* +* irq_lock is used to protect video buffer state change operations and +* also to make activeq and capq operations atomic. +*/ spinlock_t irq_lock;unsigned int users;
Signature · 1 line
2.37.2
PATCH 5/14 media: atomisp: Remove never set file_input flag
In reply to Hans de GoedeAfter the file-injection support removal the file_input flag is always false.
Remove the flag and replace any code checking it with the code-path for when it is false.
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 41 +++----------- .../staging/media/atomisp/pci/atomisp_fops.c | 12 +--- .../media/atomisp/pci/atomisp_internal.h | 2 - .../staging/media/atomisp/pci/atomisp_ioctl.c | 56 ++++++------------- 4 files changed, 28 insertions(+), 83 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +9 -32
@@ -1308,9 +1308,7 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)bool depth_mode = false;int i, ret, depth_cnt =0 ; -if (!isp->sw_contex.file_input) -atomisp_css_irq_enable (isp, -IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF , false); +atomisp_css_irq_enable (isp,IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF , false);BUG_ON (isp->num_of_streams >MAX_STREAM_NUM );
@@ -1396,16 +1394,11 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)atomisp_csi2_configure (asd); } -if (!isp->sw_contex.file_input) { -atomisp_css_irq_enable (isp,IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF , -atomisp_css_valid_sof (isp)); +atomisp_css_irq_enable (isp,IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF , +atomisp_css_valid_sof (isp)); -if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_AUTO , true) <0 ) -dev_dbg (isp->dev,"DFS auto failed while recovering!\n" ); - }else { -if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_MAX , true) <0 ) -dev_dbg (isp->dev,"DFS max failed while recovering!\n" ); - } +if (atomisp_freq_scaling (isp,ATOMISP_DFS_MODE_AUTO , true) <0 ) +dev_dbg (isp->dev,"DFS auto failed while recovering!\n" );for (i =0 ; i < isp->num_of_streams; i++) {struct atomisp_sub_device *asd;
@@ -1610,10 +1603,7 @@ void atomisp_wdt_work(struct work_struct *work)if (asd->streaming !=ATOMISP_DEVICE_STREAMING_ENABLED )continue ; -atomisp_wdt_refresh (asd, - isp->sw_contex.file_input ? -ATOMISP_ISP_FILE_TIMEOUT_DURATION : -ATOMISP_ISP_TIMEOUT_DURATION ); +atomisp_wdt_refresh (asd,ATOMISP_ISP_TIMEOUT_DURATION ); } }
@@ -1643,14 +1633,10 @@ void atomisp_css_flush(struct atomisp_device *isp)for (i =0 ; i < isp->num_of_streams; i++) {struct atomisp_sub_device *asd = &isp->asd[i]; -if (asd->streaming != -ATOMISP_DEVICE_STREAMING_ENABLED ) +if (asd->streaming !=ATOMISP_DEVICE_STREAMING_ENABLED )continue ; -atomisp_wdt_refresh (asd, - isp->sw_contex.file_input ? -ATOMISP_ISP_FILE_TIMEOUT_DURATION : -ATOMISP_ISP_TIMEOUT_DURATION ); +atomisp_wdt_refresh (asd,ATOMISP_ISP_TIMEOUT_DURATION ); }dev_dbg (isp->dev,"atomisp css flush done\n" ); }
@@ -1896,14 +1882,6 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) } out:rt_mutex_unlock (&isp->mutex); -for (i =0 ; i < isp->num_of_streams; i++) { - asd = &isp->asd[i]; -if (asd->streaming ==ATOMISP_DEVICE_STREAMING_ENABLED - && css_pipe_done[asd->index] - && isp->sw_contex.file_input) -v4l2_subdev_call (isp->inputs[asd->input_curr].camera, - video, s_stream,1 ); - }dev_dbg (isp->dev,"<%s\n" , __func__);return IRQ_HANDLED ;
@@ -5377,8 +5355,7 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev,ia_css_frame_free (asd->raw_output_frame); asd->raw_output_frame =NULL ; -if (!asd->continuous_mode->val && - !asd->params.online_process && !isp->sw_contex.file_input && +if (!asd->continuous_mode->val && !asd->params.online_process &&ia_css_frame_allocate_from_info (&asd->raw_output_frame, raw_output_info))return -ENOMEM ;
drivers/staging/media/atomisp/pci/atomisp_fops.c +1 -11
@@ -628,7 +628,6 @@ static void atomisp_dev_init_struct(struct atomisp_device *isp) {unsigned int i; - isp->sw_contex.file_input = false; isp->need_gfx_throttle = true; isp->isp_fatal_error = false; isp->mipi_frame_size =0 ;
@@ -915,7 +914,7 @@ static int atomisp_release(struct file *file)* The sink pad setting can only be cleared when all device nodes * get released. */ -if (!isp->sw_contex.file_input && asd->fmt_auto->val) { +if (asd->fmt_auto->val) {struct v4l2_mbus_framefmt isp_sink_fmt = {0 }; atomisp_subdev_set_ffmt(&asd->subdev, fh.state,
@@ -926,15 +925,6 @@ static int atomisp_release(struct file *file)if (atomisp_subdev_users (asd)) goto done; -/* clear the sink pad for file input */ -if (isp->sw_contex.file_input && asd->fmt_auto->val) { -struct v4l2_mbus_framefmt isp_sink_fmt = {0 }; - -atomisp_subdev_set_ffmt (&asd->subdev, fh.state, -V4L2_SUBDEV_FORMAT_ACTIVE , -ATOMISP_SUBDEV_PAD_SINK , &isp_sink_fmt); - } -atomisp_css_free_stat_buffers (asd);atomisp_free_internal_buffers (asd); ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
drivers/staging/media/atomisp/pci/atomisp_internal.h +0 -2
@@ -91,7 +91,6 @@#define ATOMISP_ISP_TIMEOUT_DURATION (2 * HZ)#define ATOMISP_EXT_ISP_TIMEOUT_DURATION (6 * HZ) -#define ATOMISP_ISP_FILE_TIMEOUT_DURATION (60 * HZ)#define ATOMISP_WDT_KEEP_CURRENT_DELAY 0#define ATOMISP_ISP_MAX_TIMEOUT_COUNT 2#define ATOMISP_CSS_STOP_TIMEOUT_US 200000
@@ -202,7 +201,6 @@ struct atomisp_regs { };struct atomisp_sw_contex { -bool file_input;int power_state;int running_freq; };
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +18 -38
93 lines not on this page · raw message
Signature · 1 line
2.37.2
PATCH 6/14 media: atomisp: Remove the ACC device node
In reply to Hans de GoedeThe ACC /dev/video# device node uses a struct video_device embedded in an atomisp_acc_pipe struct instead of in an atomisp_video_pipe struct. Yet it uses the same file-ops and ioctl-ops even though it does not have a videobuf queue, which makes e.g. the mmap fop nonsense.
Worse the only file-ops / ioctls which differentiate between the 2 types and correctly do container_of on the right type are the open/release fops and the vidioc_default handler.
The mmap and poll fops and *all* other ioctl handlers unconditionally do container_of on the passed in struct video_device blindly assuming they are dealing with the one embedded in the atomisp_video_pipe struct.
This makes it trivial for userspace to cause all sort of undefined behavior by calling mmap, poll or the other ioctls on the ACC device node!
Presumably the use of the ACC device node was to allow making the special ioctls to load custom programs while the other /dev/video# nodes were already open, since the /dev/video# nodes can currently all be opened only once (which needs to be fixed).
commit 4bbca788b6eb ("media: atomisp: remove private acceleration ioctls") has removed the custom ATOMISP_ACC_* ioctls, so there no longer is any reason to keep the ACC device node.
As explained above its presence can easily cause the kernel to crash, so remove the ACC device node and the code for handling it.
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 9 --- .../staging/media/atomisp/pci/atomisp_cmd.h | 1 - .../staging/media/atomisp/pci/atomisp_fops.c | 69 ++++--------------- .../staging/media/atomisp/pci/atomisp_ioctl.c | 9 +-- .../media/atomisp/pci/atomisp_subdev.c | 18 ----- .../media/atomisp/pci/atomisp_subdev.h | 9 --- .../staging/media/atomisp/pci/atomisp_v4l2.c | 18 ----- .../staging/media/atomisp/pci/atomisp_v4l2.h | 3 - 8 files changed, 16 insertions(+), 120 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +0 -9
@@ -98,15 +98,6 @@ struct atomisp_video_pipe *atomisp_to_video_pipe(struct video_device *dev) container_of(dev, struct atomisp_video_pipe, vdev); } -/* -* get struct atomisp_acc_pipe from v4l2 video_device -*/ -struct atomisp_acc_pipe *atomisp_to_acc_pipe (struct video_device *dev) -{ -return (struct atomisp_acc_pipe *) - container_of(dev, struct atomisp_acc_pipe, vdev); -} -static unsigned short atomisp_get_sensor_fps (struct atomisp_sub_device *asd) {struct v4l2_subdev_frame_interval fi = {0 };
drivers/staging/media/atomisp/pci/atomisp_cmd.h +0 -1
@@ -54,7 +54,6 @@ void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr, unsigned int size);struct camera_mipi_info *atomisp_to_sensor_mipi_info (struct v4l2_subdev *sd);struct atomisp_video_pipe *atomisp_to_video_pipe (struct video_device *dev); -struct atomisp_acc_pipe *atomisp_to_acc_pipe (struct video_device *dev);int atomisp_reset (struct atomisp_device *isp);void atomisp_flush_bufs_and_wakeup (struct atomisp_sub_device *asd);void atomisp_clear_css_buffer_counters (struct atomisp_sub_device *asd);
drivers/staging/media/atomisp/pci/atomisp_fops.c +15 -54
133 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +1 -8
@@ -2773,17 +2773,10 @@ static long atomisp_vidioc_default(struct file *file, void *fh, {struct video_device *vdev =video_devdata (file);struct atomisp_device *isp =video_get_drvdata (vdev); -struct atomisp_sub_device *asd; +struct atomisp_sub_device *asd =atomisp_to_video_pipe (vdev)->asd;struct v4l2_subdev *motor; -bool acc_node;int err; - acc_node = !strcmp (vdev->name,"ATOMISP ISP ACC" ); -if (acc_node) - asd =atomisp_to_acc_pipe (vdev)->asd; -else - asd =atomisp_to_video_pipe (vdev)->asd; -if (!IS_ISP2401 ) motor = isp->inputs[asd->input_curr].motor;else
drivers/staging/media/atomisp/pci/atomisp_subdev.c +0 -18
@@ -1075,13 +1075,6 @@ static void atomisp_init_subdev_pipe(struct atomisp_sub_device *asd, sizeof(struct atomisp_css_params_with_list *)); } -static void atomisp_init_acc_pipe (struct atomisp_sub_device *asd, -struct atomisp_acc_pipe *pipe) -{ - pipe->asd = asd; - pipe->isp = asd->isp; -} -/* * isp_subdev_init_entities - Initialize V4L2 subdev and media entity * @asd: ISP CCDC module
@@ -1137,8 +1130,6 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)atomisp_init_subdev_pipe (asd, &asd->video_out_video_capture,V4L2_BUF_TYPE_VIDEO_CAPTURE ); -atomisp_init_acc_pipe (asd, &asd->video_acc); - ret =atomisp_video_init (&asd->video_out_capture,"CAPTURE" ,ATOMISP_RUN_MODE_STILL_CAPTURE );if (ret <0 )
@@ -1159,8 +1150,6 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)if (ret <0 )return ret; -atomisp_acc_init (&asd->video_acc,"ACC" ); - ret =v4l2_ctrl_handler_init (&asd->ctrl_handler,1 );if (ret)return ret;
@@ -1290,7 +1279,6 @@ void atomisp_subdev_unregister_entities(struct atomisp_sub_device *asd)atomisp_video_unregister (&asd->video_out_vf);atomisp_video_unregister (&asd->video_out_capture);atomisp_video_unregister (&asd->video_out_video_capture); -atomisp_acc_unregister (&asd->video_acc); } int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,
@@ -1336,12 +1324,6 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd, VFL_TYPE_VIDEO, -1);if (ret <0 ) goto error; - asd->video_acc.vdev.v4l2_dev = vdev; - asd->video_acc.vdev.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; - ret =video_register_device (&asd->video_acc.vdev, -VFL_TYPE_VIDEO ,-1 ); -if (ret <0 ) - goto error;return 0 ;
drivers/staging/media/atomisp/pci/atomisp_subdev.h +0 -9
@@ -119,14 +119,6 @@ struct atomisp_video_pipe {atomic_t wdt_count; }; -struct atomisp_acc_pipe { -struct video_device vdev; -unsigned int users; -bool running; -struct atomisp_sub_device *asd; -struct atomisp_device *isp; -}; -struct atomisp_pad_format {struct v4l2_mbus_framefmt fmt;struct v4l2_rect crop;
@@ -299,7 +291,6 @@ struct atomisp_sub_device {struct atomisp_video_pipe video_out_capture;/* capture output */ struct atomisp_video_pipe video_out_vf;/* viewfinder output */ struct atomisp_video_pipe video_out_preview;/* preview output */ -struct atomisp_acc_pipe video_acc;/* video pipe main output */ struct atomisp_video_pipe video_out_video_capture;/* struct isp_subdev_params params; */
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +0 -18
@@ -460,18 +460,6 @@ int atomisp_video_init(struct atomisp_video_pipe *video, const char *name,return 0 ; } -void atomisp_acc_init (struct atomisp_acc_pipe *video,const char *name) -{ - video->vdev.fops = &atomisp_fops; - video->vdev.ioctl_ops = &atomisp_ioctl_ops; - -/* Initialize the video device. */ -snprintf (video->vdev.name,sizeof (video->vdev.name), -"ATOMISP ISP %s" , name); - video->vdev.release = video_device_release_empty; -video_set_drvdata (&video->vdev, video->isp); -} -void atomisp_video_unregister (struct atomisp_video_pipe *video) {if (video_is_registered (&video->vdev)) {
@@ -480,12 +468,6 @@ void atomisp_video_unregister(struct atomisp_video_pipe *video) } } -void atomisp_acc_unregister (struct atomisp_acc_pipe *video) -{ -if (video_is_registered (&video->vdev)) -video_unregister_device (&video->vdev); -} -static int atomisp_save_iunit_reg (struct atomisp_device *isp) {struct pci_dev *pdev =to_pci_dev (isp->dev);
drivers/staging/media/atomisp/pci/atomisp_v4l2.h +0 -3
@@ -22,16 +22,13 @@#define __ATOMISP_V4L2_H__struct atomisp_video_pipe ; -struct atomisp_acc_pipe ;struct v4l2_device ;struct atomisp_device ;struct firmware ;int atomisp_video_init (struct atomisp_video_pipe *video,const char *name,unsigned int run_mode); -void atomisp_acc_init (struct atomisp_acc_pipe *video,const char *name);void atomisp_video_unregister (struct atomisp_video_pipe *video); -void atomisp_acc_unregister (struct atomisp_acc_pipe *video);const struct firmware *atomisp_load_firmware (struct atomisp_device *isp);int atomisp_csi_lane_config (struct atomisp_device *isp);
Signature · 1 line
2.37.2
PATCH 7/14 media: atomisp: Remove some further ATOMISP_ACC_* related dead code
In reply to Hans de GoedeRemove some more code which is no longer referenced after the removal of the ATOMISP_ACC_* custom ioctls.
--- .../media/atomisp/include/linux/atomisp.h | 14 ------------ .../media/atomisp/pci/atomisp_compat.h | 3 --- .../media/atomisp/pci/atomisp_compat_css20.c | 18 --------------- .../media/atomisp/pci/atomisp_subdev.h | 22 ------------------- 4 files changed, 57 deletions(-)
drivers/staging/media/atomisp/include/linux/atomisp.h +0 -14
@@ -740,20 +740,6 @@ enum atomisp_frame_status { ATOMISP_FRAME_STATUS_FLASH_FAILED, }; -/* ISP memories, isp2400 */ -enum atomisp_acc_memory { -ATOMISP_ACC_MEMORY_PMEM0 =0 , -ATOMISP_ACC_MEMORY_DMEM0 , -/* for backward compatibility */ -ATOMISP_ACC_MEMORY_DMEM =ATOMISP_ACC_MEMORY_DMEM0 , -ATOMISP_ACC_MEMORY_VMEM0 , -ATOMISP_ACC_MEMORY_VAMEM0 , -ATOMISP_ACC_MEMORY_VAMEM1 , -ATOMISP_ACC_MEMORY_VAMEM2 , -ATOMISP_ACC_MEMORY_HMEM0 , -ATOMISP_ACC_NR_MEMORY -}; -enum atomisp_ext_isp_id {EXT_ISP_CID_ISO =0 ,EXT_ISP_CID_CAPTURE_HDR ,
drivers/staging/media/atomisp/pci/atomisp_compat.h +0 -3
@@ -442,9 +442,6 @@ int atomisp_css_get_dis_stat(struct atomisp_sub_device *asd,int atomisp_css_update_stream (struct atomisp_sub_device *asd); -struct atomisp_acc_fw ; -int atomisp_css_set_acc_parameters (struct atomisp_acc_fw *acc_fw); -int atomisp_css_isr_thread (struct atomisp_device *isp,bool *frame_done_found,bool *css_pipe_done);
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +0 -18
@@ -3771,24 +3771,6 @@ void atomisp_css_set_cont_prev_start_time(struct atomisp_device *isp,return ; } -/* Set the ACC binary arguments */ -int atomisp_css_set_acc_parameters (struct atomisp_acc_fw *acc_fw) -{ -unsigned int mem; - -for (mem =0 ; mem <ATOMISP_ACC_NR_MEMORY ; mem++) { -if (acc_fw->args[mem].length ==0 ) -continue ; - -ia_css_isp_param_set_css_mem_init (&acc_fw->fw->mem_initializers, -IA_CSS_PARAM_CLASS_PARAM , mem, - acc_fw->args[mem].css_ptr, - acc_fw->args[mem].length); - } - -return 0 ; -} - static struct atomisp_sub_device *__get_atomisp_subdev( struct ia_css_pipe *css_pipe, struct atomisp_device *isp,
drivers/staging/media/atomisp/pci/atomisp_subdev.h +0 -22
@@ -258,28 +258,6 @@ struct atomisp_css_params_with_list {struct list_head list; }; -struct atomisp_acc_fw { -struct ia_css_fw_info *fw; -unsigned int handle; -unsigned int flags; -unsigned int type; -struct { -size_t length; -unsigned long css_ptr; - } args[ATOMISP_ACC_NR_MEMORY ]; -struct list_head list; -}; - -struct atomisp_map { -ia_css_ptr ptr; -size_t length; -struct list_head list; -/* FIXME: should keep book which maps are currently used -* by binaries and not allow releasing those -* which are in use. Implement by reference counting. -*/ -}; -struct atomisp_sub_device {struct v4l2_subdev subdev;struct media_pad pads[ATOMISP_SUBDEV_PADS_NUM ];
Signature · 1 line
2.37.2
PATCH 8/14 media: atomisp: Remove empty atomisp_css_set_cont_prev_start_time() function
In reply to Hans de Goedeatomisp_css_set_cont_prev_start_time() is a no-op, remove it.
--- drivers/staging/media/atomisp/pci/atomisp_compat.h | 3 --- drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 8 -------- drivers/staging/media/atomisp/pci/atomisp_internal.h | 3 --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 2 -- 4 files changed, 16 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_compat.h +0 -3
@@ -434,9 +434,6 @@ void atomisp_css_get_morph_table(struct atomisp_sub_device *asd,void atomisp_css_morph_table_free (struct ia_css_morph_table *table); -void atomisp_css_set_cont_prev_start_time (struct atomisp_device *isp, -unsigned int overlap); -int atomisp_css_get_dis_stat (struct atomisp_sub_device *asd,struct atomisp_dis_statistics *stats);
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +0 -8
@@ -3763,14 +3763,6 @@ void atomisp_css_morph_table_free(struct ia_css_morph_table *table)ia_css_morph_table_free (table); } -void atomisp_css_set_cont_prev_start_time (struct atomisp_device *isp, -unsigned int overlap) -{ -/* CSS 2.0 doesn't support this API. */ -dev_dbg (isp->dev,"set cont prev start time is not supported.\n" ); -return ; -} - static struct atomisp_sub_device *__get_atomisp_subdev( struct ia_css_pipe *css_pipe, struct atomisp_device *isp,
drivers/staging/media/atomisp/pci/atomisp_internal.h +0 -3
@@ -105,9 +105,6 @@#define ATOMISP_DELAYED_INIT_QUEUED 1#define ATOMISP_DELAYED_INIT_DONE 2 -#define ATOMISP_CALC_CSS_PREV_OVERLAP (lines) \ - ((lines) * 38 / 100 & 0xfffffe) -/* * Define how fast CPU should be able to serve ISP interrupts. * The bigger the value, the higher risk that the ISP is not
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +0 -2
@@ -1934,8 +1934,6 @@ static int atomisp_streamon(struct file *file, void *fh,reinit_completion (&asd->init_done); asd->delayed_init =ATOMISP_DELAYED_INIT_QUEUED ;queue_work (asd->delayed_init_workq, &asd->delayed_init_work); -atomisp_css_set_cont_prev_start_time (isp, -ATOMISP_CALC_CSS_PREV_OVERLAP (sink->height)); }else { asd->delayed_init =ATOMISP_DELAYED_INIT_NOT_QUEUED ; }
Signature · 1 line
2.37.2
PATCH 9/14 media: atomisp: Split subdev and video-node registration into 2 steps
In reply to Hans de GoedeSplit subdev and video-node registration into 2 steps, this is a preparation step for moving video-node registration to the end of probe() so that the loading() mutex can be removed.
--- .../staging/media/atomisp/pci/atomisp_subdev.c | 16 ++++++++-------- .../staging/media/atomisp/pci/atomisp_subdev.h | 6 ++++-- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 4 +++- 3 files changed, 15 insertions(+), 11 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +8 -8
@@ -1281,8 +1281,14 @@ void atomisp_subdev_unregister_entities(struct atomisp_sub_device *asd)atomisp_video_unregister (&asd->video_out_video_capture); } -int atomisp_subdev_register_entities (struct atomisp_sub_device *asd, -struct v4l2_device *vdev) +int atomisp_subdev_register_subdev (struct atomisp_sub_device *asd, +struct v4l2_device *vdev) +{ +return v4l2_device_register_subdev (vdev, &asd->subdev); +} + +int atomisp_subdev_register_video_nodes (struct atomisp_sub_device *asd, +struct v4l2_device *vdev) {int ret;
@@ -1291,12 +1297,6 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,* Should any of those use V4L2_CAP_META_CAPTURE? Probably yes. */ -/* Register the subdev and video node. */ - - ret =v4l2_device_register_subdev (vdev, &asd->subdev); -if (ret <0 ) - goto error; - asd->video_out_preview.vdev.v4l2_dev = vdev; asd->video_out_preview.vdev.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; ret = video_register_device(&asd->video_out_preview.vdev,
drivers/staging/media/atomisp/pci/atomisp_subdev.h +4 -2
@@ -417,8 +417,10 @@ int atomisp_update_run_mode(struct atomisp_sub_device *asd);void atomisp_subdev_cleanup_pending_events (struct atomisp_sub_device *asd);void atomisp_subdev_unregister_entities (struct atomisp_sub_device *asd); -int atomisp_subdev_register_entities (struct atomisp_sub_device *asd, -struct v4l2_device *vdev); +int atomisp_subdev_register_subdev (struct atomisp_sub_device *asd, +struct v4l2_device *vdev); +int atomisp_subdev_register_video_nodes (struct atomisp_sub_device *asd, +struct v4l2_device *vdev);int atomisp_subdev_init (struct atomisp_device *isp);void atomisp_subdev_cleanup (struct atomisp_device *isp);int atomisp_create_pads_links (struct atomisp_device *isp);
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +3 -1
@@ -1193,7 +1193,9 @@ static int atomisp_register_entities(struct atomisp_device *isp)for (i =0 ; i < isp->num_of_streams; i++) {struct atomisp_sub_device *asd = &isp->asd[i]; - ret =atomisp_subdev_register_entities (asd, &isp->v4l2_dev); + ret =atomisp_subdev_register_subdev (asd, &isp->v4l2_dev); +if (ret ==0 ) + ret =atomisp_subdev_register_video_nodes (asd, &isp->v4l2_dev);if (ret <0 ) {dev_err (isp->dev,"atomisp_subdev_register_entities fail\n" );
Signature · 1 line
2.37.2
PATCH 10/14 media: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe()
In reply to Hans de GoedeRegister /dev/* nodes at the end of atomisp_pci_probe(), this is a prerequisite for dropping the loading mutex + ready flag kludge for delaying open() calls on the /dev/* nodes .
--- .../staging/media/atomisp/pci/atomisp_v4l2.c | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +28 -12
@@ -1194,11 +1194,8 @@ static int atomisp_register_entities(struct atomisp_device *isp)struct atomisp_sub_device *asd = &isp->asd[i]; ret =atomisp_subdev_register_subdev (asd, &isp->v4l2_dev); -if (ret ==0 ) - ret =atomisp_subdev_register_video_nodes (asd, &isp->v4l2_dev);if (ret <0 ) { -dev_err (isp->dev, -"atomisp_subdev_register_entities fail\n" ); +dev_err (isp->dev,"atomisp_subdev_register_subdev fail\n" );for (; i >0 ; i--)atomisp_subdev_unregister_entities ( &isp->asd[i -1 ]);
@@ -1248,11 +1245,7 @@ static int atomisp_register_entities(struct atomisp_device *isp)dev_warn (isp->dev,"too many atomisp inputs, TPG ignored.\n" ); } - ret =v4l2_device_register_subdev_nodes (&isp->v4l2_dev); -if (ret <0 ) - goto link_failed; - -return media_device_register (&isp->media_dev); +return 0 ; link_failed:for (i =0 ; i < isp->num_of_streams; i++)
@@ -1275,6 +1268,27 @@ static int atomisp_register_entities(struct atomisp_device *isp)return ret; } +static int atomisp_register_device_nodes (struct atomisp_device *isp) +{ +int i, err; + +for (i =0 ; i < isp->num_of_streams; i++) { + err =atomisp_subdev_register_video_nodes (&isp->asd[i], &isp->v4l2_dev); +if (err) +return err; + } + + err =atomisp_create_pads_links (isp); +if (err) +return err; + + err =v4l2_device_register_subdev_nodes (&isp->v4l2_dev); +if (err) +return err; + +return media_device_register (&isp->media_dev); +} +static int atomisp_initialize_modules (struct atomisp_device *isp) {int ret;
@@ -1687,9 +1701,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *idev_err (&pdev->dev,"atomisp_register_entities failed (%d)\n" , err); goto register_entities_fail; } - err =atomisp_create_pads_links (isp); -if (err <0 ) - goto register_entities_fail;/* init atomisp wdts */ err =init_atomisp_wdts (isp);if (err !=0 )
@@ -1727,8 +1738,13 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i isp->firmware =NULL ; isp->css_env.isp_css_fw.data =NULL ; isp->ready = true; +rt_mutex_unlock (&isp->loading); + err =atomisp_register_device_nodes (isp); +if (err) + goto css_init_fail; +atomisp_drvfs_init (isp);return 0 ;
Signature · 1 line
2.37.2
Re: [PATCH 10/14] media: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe()
Quoted 3 lines · Hans de Goede
Register
/dev/*nodes at the end ofatomisp_pci_probe(), this is a prerequisite for dropping the loading mutex + ready flag kludge for delayingopen()calls on the/dev/*nodes .
...
drivers/staging/media/atomisp/pci/atomisp_v4l2.c static int atomisp_register_entities(struct atomisp_device *isp) · line 1201
Quoted 3 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +0
-0for (; i >0 ; i--)atomisp_subdev_unregister_entities ( &isp->asd[i -1 ]);
This...
drivers/staging/media/atomisp/pci/atomisp_v4l2.c static int atomisp_register_entities(struct atomisp_device *isp) · line 1279
Quoted 5 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +5
-0+for (i =0 ; i < isp->num_of_streams; i++) { + err =atomisp_subdev_register_video_nodes (&isp->asd[i], &isp->v4l2_dev); +if (err) +return err; + }
...and this looks like a dup.
Perhaps a helper?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 10/14] media: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe()
Hi,
Thank you for reviewing this series.
Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Hans de Goede
Register
/dev/*nodes at the end ofatomisp_pci_probe(), this is a prerequisite for dropping the loading mutex + ready flag kludge for delayingopen()calls on the/dev/*nodes .
Quoted 7 lines
...
drivers/staging/media/atomisp/pci/atomisp_v4l2.c static int atomisp_register_entities(struct atomisp_device *isp) · line 1201
Quoted 3 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +0
-0for (; i >0 ; i--)atomisp_subdev_unregister_entities ( &isp->asd[i -1 ]);This...
I presume you mean the few lines above that actually:
@@ -1194,11 +1194,8 @@ static int atomisp_register_entities(struct atomisp_device *isp)
struct atomisp_sub_device *asd = &isp->asd[i];
ret = atomisp_subdev_register_subdev(asd, &isp->v4l2_dev);
- if (ret == 0)
- ret = atomisp_subdev_register_video_nodes(asd, &isp->v4l2_dev);
if (ret < 0) {
- dev_err(isp->dev,
- "atomisp_subdev_register_entities fail\n");
+ dev_err(isp->dev, "atomisp_subdev_register_subdev fail\n");
for (; i > 0; i--)
atomisp_subdev_unregister_entities(
&isp->asd[i - 1]);
Notice the atomisp_subdev_register_video_nodes() call is removed there, leaving only atomisp_subdev_register_subdev() (which is also why the dev_err msg is changed).
Actually moving that call (+ a few others) to later is the whole purpose of this patch.
Quoted 8 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c static int atomisp_register_entities(struct atomisp_device *isp) · line 1279
Quoted 6 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +5
-0+for (i =0 ; i < isp->num_of_streams; i++) { + err =atomisp_subdev_register_video_nodes (&isp->asd[i], &isp->v4l2_dev); +if (err) +return err; + }...and this looks like a dup.
Where as this time while looping over the stream the code is calling atomisp_subdev_register_video_nodes().
So yes we have 2 "for (i = 0; i < isp->num_of_streams; i++) {}" loops, but:
Loop 1 does: atomisp_subdev_register_subdev() Loop 2 does: atomisp_subdev_register_video_nodes()
So I see no duplication here?
Regards,
Hans
Re: [PATCH 10/14] media: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe()
Quoted 2 lines · Hans de Goede
Quoted 1 line · Andy Shevchenko
On Thu, Sep 01, 2022 at 11:46:22AM +0200, Hans de Goede wrote:
...
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
for (; i > 0; i--) atomisp_subdev_unregister_entities( &isp->asd[i - 1]);This...
I presume you mean the few lines above that actually:
No, I cited a not modified code in the upper part. That said, it's a remark for further improvements, but a helper can be introduced in this patch due to the below part.
Quoted 7 lines
Quoted 7 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c static int atomisp_register_entities(struct atomisp_device *isp) · line 1279
Quoted 5 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +5
-0+for (i =0 ; i < isp->num_of_streams; i++) { + err =atomisp_subdev_register_video_nodes (&isp->asd[i], &isp->v4l2_dev); +if (err) +return err; + }...and this looks like a dup.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 10/14] media: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe()
Quoted 10 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede
Quoted 1 line · Andy Shevchenko
On Thu, Sep 01, 2022 at 11:46:22AM +0200, Hans de Goede wrote:
...
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
for (; i > 0; i--) atomisp_subdev_unregister_entities( &isp->asd[i - 1]);
Quoted 15 lines
Quoted 3 lines
Quoted 1 line
This...
I presume you mean the few lines above that actually:
No, I cited a not modified code in the upper part. That said, it's a remark for further improvements, but a helper can be introduced in this patch due to the below part.
Quoted 7 lines
Quoted 7 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c static int atomisp_register_entities(struct atomisp_device *isp) · line 1279
Quoted 5 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +5
-0+for (i =0 ; i < isp->num_of_streams; i++) { + err =atomisp_subdev_register_video_nodes (&isp->asd[i], &isp->v4l2_dev); +if (err) +return err; + }...and this looks like a dup.
Pushed "enter" too early to send.
But with your explanation I see the difference now.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 11/14 media: atomisp: Remove loading mutex
In reply to Hans de GoedeNow that the registering of the /dev/* video / subdev nodes has been moved to the end of atomisp_pci_probe() the workaround with the loading mutex to delay opens until init is done is no longer necessary.
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 16 ---------------- .../staging/media/atomisp/pci/atomisp_internal.h | 7 ------- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 7 ------- 3 files changed, 30 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_fops.c +0 -16
@@ -707,29 +707,13 @@ static int atomisp_open(struct file *file)dev_dbg (isp->dev,"open device %s\n" , vdev->name); -/* -* Ensure that if we are still loading we block. Once the loading -* is over we can proceed. We can't blindly hold the lock until -* that occurs as if the load fails we'll deadlock the unload -*/ -rt_mutex_lock (&isp->loading); -/* -* FIXME: revisit this with a better check once the code structure -* is cleaned up a bit more -*/ ret =v4l2_fh_open (file);if (ret) {dev_err (isp->dev,"%s: v4l2_fh_open() returned error %d\n" , __func__, ret); -rt_mutex_unlock (&isp->loading);return ret; } -if (!isp->ready) { -rt_mutex_unlock (&isp->loading); -return -ENXIO ; - } -rt_mutex_unlock (&isp->loading);rt_mutex_lock (&isp->mutex);
drivers/staging/media/atomisp/pci/atomisp_internal.h +0 -7
@@ -239,13 +239,6 @@ struct atomisp_device {/* Purpose of mutex is to protect and serialize use of isp data * structures and css API calls. */ struct rt_mutex mutex; -/* -* This mutex ensures that we don't allow an open to succeed while -* the initialization process is incomplete -*/ -struct rt_mutex loading; -/* Set once the ISP is ready to allow opens */ -bool ready;/* * Serialise streamoff: mutex is dropped during streamoff to * cancel the watchdog queue. MUST be acquired BEFORE
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +0 -7
@@ -1515,7 +1515,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *idev_dbg (&pdev->dev,"atomisp mmio base: %p\n" , isp->base);rt_mutex_init (&isp->mutex); -rt_mutex_init (&isp->loading);mutex_init (&isp->streamoff_mutex);spin_lock_init (&isp->lock);
@@ -1688,8 +1687,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ipci_write_config_dword (pdev,MRFLD_PCI_CSI_AFE_TRIM_CONTROL , csi_afe_trim); } -rt_mutex_lock (&isp->loading); - err =atomisp_initialize_modules (isp);if (err <0 ) {dev_err (&pdev->dev,"atomisp_initialize_modules (%d)\n" , err);
@@ -1737,9 +1734,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *irelease_firmware (isp->firmware); isp->firmware =NULL ; isp->css_env.isp_css_fw.data =NULL ; - isp->ready = true; - -rt_mutex_unlock (&isp->loading); err =atomisp_register_device_nodes (isp);if (err)
@@ -1760,7 +1754,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i register_entities_fail:atomisp_uninitialize_modules (isp); initialize_modules_fail: -rt_mutex_unlock (&isp->loading);cpu_latency_qos_remove_request (&isp->pm_qos);atomisp_msi_irq_uninit (isp);pci_free_irq_vectors (pdev);
Signature · 1 line
2.37.2
PATCH 12/14 media: atomisp: Fix v4l2_fh resource leak on open errors
In reply to Hans de GoedeWhen atomisp_open() fails then it must call v4l2_fh_release() to undo the results of v4l2_fh_open().
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/atomisp/pci/atomisp_fops.c +1 -0
@@ -804,6 +804,7 @@ static int atomisp_open(struct file *file)pm_runtime_put (vdev->v4l2_dev->dev); error:rt_mutex_unlock (&isp->mutex); +v4l2_fh_release (file);return ret; }
Signature · 1 line
2.37.2
PATCH 13/14 media: atomisp: Simplify v4l2_fh_open() error handling
In reply to Hans de Goedev4l2_fh_open() can only fail with -ENOMEM and as a generic rule drivers do not log their own errors for -ENOMEM since the kernel will already have complained loudly about this before the -ENOMEM return.
Remove the unnecessary error logging from atomisp_open().
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_fops.c +1 -5
@@ -708,12 +708,8 @@ static int atomisp_open(struct file *file)dev_dbg (isp->dev,"open device %s\n" , vdev->name); ret =v4l2_fh_open (file); -if (ret) { -dev_err (isp->dev, -"%s: v4l2_fh_open() returned error %d\n" , - __func__, ret); +if (ret)return ret; - }rt_mutex_lock (&isp->mutex);
Signature · 1 line
2.37.2
PATCH 14/14 media: atomisp: prevent integer overflow in sh_css_set_black_frame()
In reply to Hans de GoedeFrom: Dan Carpenter <[email protected]>
The "height" and "width" values come from the user so the "height * width" multiplication can overflow.
--- drivers/staging/media/atomisp/pci/sh_css_params.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/sh_css_params.c +2 -2
@@ -950,8 +950,8 @@ sh_css_set_black_frame(struct ia_css_stream *stream, params->fpn_config.data =NULL ; }if (!params->fpn_config.data) { - params->fpn_config.data =kvmalloc (height * width * -sizeof (short ),GFP_KERNEL ); + params->fpn_config.data =kvmalloc (array3_size (height, width,sizeof (short )), +GFP_KERNEL );if (!params->fpn_config.data) {IA_CSS_ERROR ("out of memory" );IA_CSS_LEAVE_ERR_PRIVATE (-ENOMEM );
Signature · 1 line
2.37.2
Mauro Carvalho Chehab
maintainerEm Thu, 1 Sep 2022 11:46:12 +0200
Hans de Goede <[email protected]> escreveu:
Quoted 11 lines
Hi Mauro,
Here is a second set of atomisp cleanups / code removal. This applies on top of my previous v2 series from here:
https://lore.kernel.org/linux-media/[email protected]/I plan to do more atomisp work the coming few weeks. So I'm thinking it might be better / easier for you if I just send you a pull-req based on 6.0-rc1 with all atomisp patches bundled around rc5/rc6 time.
Would that work for you ?
Yes, that works for me. I'm actually proritizing PRs over normal patches from media maintainers. As you're doing most of work on it, I can start picking PRs from you related to atomisp.
This will help to speedup merging atomisp patches, as I usually pick PRs once per week.
Quoted 3 lines
I do plan to keep sending out (incremental) patch-sets with my work (like this one) for review / comments.
Perfect.
Quoted 38 lines
Regards,
Hans
Dan Carpenter (1):
media: atomisp: prevent integer overflow insh_css_set_black_frame()Hans de Goede (13):
media: atomisp: Fixdevice_capsreporting of the registered video-devs
media: atomisp: Remove file-injection support
media: atomisp: Removeatomisp_file_fopsandatomisp_file_ioctl_ops
media: atomisp: Remove the outq videobuf queue
media: atomisp: Remove never setfile_inputflag
media: atomisp: Remove the ACC device node
media: atomisp: Remove some further ATOMISP_ACC_* related dead code
media: atomisp: Remove emptyatomisp_css_set_cont_prev_start_time()
function
media: atomisp: Split subdev and video-node registration into 2 steps
media: atomisp: Register/dev/*nodes at the end of
atomisp_pci_probe()
media: atomisp: Remove loading mutex
media: atomisp: Fixv4l2_fhresource leak on open errors
media: atomisp: Simplifyv4l2_fh_open()error handlingdrivers/staging/media/atomisp/Makefile | 1 - .../media/atomisp/include/linux/atomisp.h | 14 -- .../staging/media/atomisp/pci/atomisp_cmd.c | 134 +--------- .../staging/media/atomisp/pci/atomisp_cmd.h | 2 - .../media/atomisp/pci/atomisp_compat.h | 6 - .../media/atomisp/pci/atomisp_compat_css20.c | 26 -- .../staging/media/atomisp/pci/atomisp_file.c | 229 ------------------ .../staging/media/atomisp/pci/atomisp_file.h | 44 ---- .../staging/media/atomisp/pci/atomisp_fops.c | 187 ++------------ .../media/atomisp/pci/atomisp_internal.h | 16 +- .../staging/media/atomisp/pci/atomisp_ioctl.c | 192 ++------------- .../staging/media/atomisp/pci/atomisp_ioctl.h | 4 -
Quoted 9 lines
.../media/atomisp/pci/atomisp_subdev.c | 95 ++------ .../media/atomisp/pci/atomisp_subdev.h | 47 +--- .../staging/media/atomisp/pci/atomisp_v4l2.c | 99 +++----- .../staging/media/atomisp/pci/atomisp_v4l2.h | 3 - .../staging/media/atomisp/pci/sh_css_params.c | 4 +- 17 files changed, 104 insertions(+), 999 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_file.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_file.h
Thanks,
Mauro
Hi,
Quoted 13 lines · Mauro Carvalho Chehab
Em Thu, 1 Sep 2022 11:46:12 +0200
Hans de Goede <[email protected]> escreveu:Quoted 10 lines
Hi Mauro,
Here is a second set of atomisp cleanups / code removal. This applies on top of my previous v2 series from here:
https://lore.kernel.org/linux-media/[email protected]/I plan to do more atomisp work the coming few weeks. So I'm thinking it might be better / easier for you if I just send you a pull-req based on 6.0-rc1 with all atomisp patches bundled around rc5/rc6 time.
Quoted 5 lines
Quoted 1 line
Would that work for you ?
Yes, that works for me. I'm actually proritizing PRs over normal patches from media maintainers. As you're doing most of work on it, I can start picking PRs from you related to atomisp.
Sounds good.
Note I have also been picking up various small fixes from others both for testing and to make sure they don't get lost. So I plan to include those into the pull-req around rc5/6 time too.
Regards,
Hans
Quoted 47 lines
Quoted 32 lines
Dan Carpenter (1):
media: atomisp: prevent integer overflow insh_css_set_black_frame()Hans de Goede (13):
media: atomisp: Fixdevice_capsreporting of the registered video-devs
media: atomisp: Remove file-injection support
media: atomisp: Removeatomisp_file_fopsandatomisp_file_ioctl_ops
media: atomisp: Remove the outq videobuf queue
media: atomisp: Remove never setfile_inputflag
media: atomisp: Remove the ACC device node
media: atomisp: Remove some further ATOMISP_ACC_* related dead code
media: atomisp: Remove emptyatomisp_css_set_cont_prev_start_time()
function
media: atomisp: Split subdev and video-node registration into 2 steps
media: atomisp: Register/dev/*nodes at the end of
atomisp_pci_probe()
media: atomisp: Remove loading mutex
media: atomisp: Fixv4l2_fhresource leak on open errors
media: atomisp: Simplifyv4l2_fh_open()error handlingdrivers/staging/media/atomisp/Makefile | 1 - .../media/atomisp/include/linux/atomisp.h | 14 -- .../staging/media/atomisp/pci/atomisp_cmd.c | 134 +--------- .../staging/media/atomisp/pci/atomisp_cmd.h | 2 - .../media/atomisp/pci/atomisp_compat.h | 6 - .../media/atomisp/pci/atomisp_compat_css20.c | 26 -- .../staging/media/atomisp/pci/atomisp_file.c | 229 ------------------ .../staging/media/atomisp/pci/atomisp_file.h | 44 ---- .../staging/media/atomisp/pci/atomisp_fops.c | 187 ++------------ .../media/atomisp/pci/atomisp_internal.h | 16 +- .../staging/media/atomisp/pci/atomisp_ioctl.c | 192 ++------------- .../staging/media/atomisp/pci/atomisp_ioctl.h | 4 -Quoted 9 lines
.../media/atomisp/pci/atomisp_subdev.c | 95 ++------ .../media/atomisp/pci/atomisp_subdev.h | 47 +--- .../staging/media/atomisp/pci/atomisp_v4l2.c | 99 +++----- .../staging/media/atomisp/pci/atomisp_v4l2.h | 3 - .../staging/media/atomisp/pci/sh_css_params.c | 4 +- 17 files changed, 104 insertions(+), 999 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_file.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_file.hThanks,
Mauro
Quoted 5 lines · Hans de Goede
Hi Mauro,
Here is a second set of atomisp cleanups / code removal. This applies on top of my previous v2 series from here:
https://lore.kernel.org/linux-media/[email protected]/
I looked into the code (mostly commit message and patches that not only delete the stuff) and it LGTM, hence
Quoted 8 lines
I plan to do more atomisp work the coming few weeks. So I'm thinking it might be better / easier for you if I just send you a pull-req based on 6.0-rc1 with all atomisp patches bundled around rc5/rc6 time.
Would that work for you ?
I do plan to keep sending out (incremental) patch-sets with my work (like this one) for review / comments.
Perhaps it's a time you add yourself as AtomISP2 (co-?)maintainer?
Signature · 2 lines
With Best Regards, Andy Shevchenko