From patchwork Fri Aug 30 13:18:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 21083 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 79578C324C for ; Fri, 30 Aug 2024 13:19:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 997B86341E; Fri, 30 Aug 2024 15:19:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="Yu1QCXDW"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AC82B61E4A for ; Fri, 30 Aug 2024 15:19:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725023958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T+Q9zx3bGyVl/J9R2a6oMfY9+uOPJdNW26Wil0HtPUo=; b=Yu1QCXDW7neAfP68xi0jXPb258KeDsdn9R8b2BiPZ7DoN2Ikms4N9Y7adhicBXx2bnjbXl 2ZRIgYPEPmK8hhCrJS3vQxda+rDg/DlqVHhHCvKOZsB1JIEtX6FaqoqrOb+qzY+bGgzOKw +zHpXWpwe2hacJuwHKHnVac8aRTcc10= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-568-YFZEZuztPtKhcccPExNGfA-1; Fri, 30 Aug 2024 09:19:17 -0400 X-MC-Unique: YFZEZuztPtKhcccPExNGfA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2F1101955BF9 for ; Fri, 30 Aug 2024 13:19:16 +0000 (UTC) Received: from nuthatch.redhat.com (unknown [10.45.225.65]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DF8A919560AE; Fri, 30 Aug 2024 13:19:14 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal Subject: [PATCH 00/19] Remove unused includes Date: Fri, 30 Aug 2024 15:18:37 +0200 Message-ID: <20240830131904.1090330-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" There is quite a lot of include’s that are actually unused. They don’t cause much trouble but they should still be removed in order to: - keep order, - avoid LSP warnings when working with the code, - to remove unneeded extra lines. I have identified the unused includes by inspecting warnings issued by LSP. LSP understands the difference between direct and indirect imports. I have inspected its reports in some cases and it seems to be correct most of the time so I trust it and haven’t inspected everything, which would be waste of resources. I have noticed only two problems: - LSP reports in my environment unused includes despite of presence of using std::literals::chrono_literals; or using std::chrono_literals; (these two should be probably unified but this is out of scope of this series). This happens also in a trivial code and is most likely a bug. - LSP may report unnecessary inclusion of "libcamera/internal/framebuffer.h" although it is actually needed to be able to access something from FrameBuffer::Private. It’s interesting that in both the cases LSP reports the corresponding problems when the supposedly unused include is removed. I’m also not sure whether header include removal can affect Doxygen output in some way. I supposed it doesn’t but if it does then the patches must be inspected for such cases. I haven’t removed includes of "FOO.h" in FOO.cpp files even if the include is unused (which happens when FOO.cpp contains only documentation). My LSP based autoformatter reformatted some of the modified files. Many of the suggested changes look right so I kept most of them (and helped the autoformatter to do a better thing in some cases), in separate commits, rather than discarding them. It’s annoying when editing a source file and the autoformatter changes the code elsewhere; if the autoformatter is wrong anywhere then the autoformatting rules should be fixed if possible. I have inspected many source files but not all of them. Although the cleanup is most likely a bit incomplete, it should still make things significantly better. I’m sorry for another long patch series but I tried to split the patches in order to make them reasonably sized (and easy to review!) and by possible areas of responsibility. Milan Zamazal (19): libcamera: ipu3: Remove unused includes libcamera: ipu3: Replace wrong include libcamera: ipu3: Formatting improvements libcamera: rkisp1: Remove unused includes libcamera: rkisp1: Formatting improvements libcamera: libipa: Remove unused includes libcamera: uvcvideo: Remove unused includes libcamera: uvcvideo: Formatting improvement libcamera: v4l2: Remove unused includes libcamera: v4l2: Formatting improvements libcamera: v4l2_subdevice: Formatting improvements libcamera: v4l2: Fix indirect include libcamera: ipa: Remove unused includes libcamera: libcamera: Remove unused includes libcamera: libcamera: Add missing includes libcamera: libcamera: Formatting improvements libcamera: includes: Add missing includes libcamera: includes: Remove unused includes libcamera: includes: Formatting improvements include/libcamera/base/event_dispatcher.h | 2 - include/libcamera/base/log.h | 23 +- include/libcamera/base/memfd.h | 2 - include/libcamera/base/signal.h | 1 - include/libcamera/base/span.h | 41 +- include/libcamera/base/timer.h | 1 - include/libcamera/base/utils.h | 3 +- include/libcamera/framebuffer.h | 1 - include/libcamera/internal/camera_manager.h | 5 +- include/libcamera/internal/camera_sensor.h | 1 - .../internal/device_enumerator_sysfs.h | 1 - .../libcamera/internal/dma_buf_allocator.h | 2 - include/libcamera/internal/formats.h | 1 - .../libcamera/internal/ipa_data_serializer.h | 11 +- include/libcamera/internal/ipa_proxy.h | 2 - .../libcamera/internal/ipc_pipe_unixsocket.h | 1 - include/libcamera/internal/media_device.h | 1 - include/libcamera/internal/pipeline_handler.h | 3 - include/libcamera/internal/request.h | 1 + .../libcamera/internal/shared_mem_object.h | 1 - include/libcamera/ipa/ipa_interface.h | 5 - include/libcamera/logging.h | 2 + include/libcamera/pixel_format.h | 1 - include/libcamera/request.h | 1 - include/libcamera/stream.h | 1 - include/libcamera/transform.h | 2 - src/ipa/ipu3/algorithms/af.cpp | 3 - src/ipa/ipu3/algorithms/agc.cpp | 32 +- src/ipa/ipu3/algorithms/blc.cpp | 6 +- src/ipa/ipu3/ipu3.cpp | 16 +- src/ipa/libipa/histogram.h | 1 - src/ipa/libipa/matrix.h | 1 - src/ipa/libipa/matrix_interpolator.cpp | 7 - src/ipa/libipa/matrix_interpolator.h | 2 - src/ipa/libipa/pwl.cpp | 2 - src/ipa/libipa/pwl.h | 3 - src/ipa/libipa/vector.h | 2 - src/ipa/rkisp1/algorithms/agc.h | 1 - src/ipa/rkisp1/algorithms/awb.cpp | 20 +- src/ipa/rkisp1/algorithms/ccm.cpp | 4 - src/ipa/rkisp1/algorithms/dpf.cpp | 6 +- src/ipa/rkisp1/rkisp1.cpp | 22 +- src/ipa/rkisp1/utils.h | 1 - src/libcamera/base/event_dispatcher_poll.cpp | 4 +- src/libcamera/camera.cpp | 6 +- src/libcamera/controls.cpp | 32 +- .../converter/converter_v4l2_m2m.cpp | 1 - src/libcamera/formats.cpp | 3 +- src/libcamera/ipa_data_serializer.cpp | 97 +- src/libcamera/ipa_module.cpp | 16 +- src/libcamera/ipa_proxy.cpp | 1 - src/libcamera/orientation.cpp | 17 +- src/libcamera/pipeline/ipu3/frames.cpp | 3 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 41 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 - src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 6 +- src/libcamera/pipeline_handler.cpp | 6 +- src/libcamera/process.cpp | 8 +- src/libcamera/sensor/camera_sensor.cpp | 8 +- src/libcamera/shared_mem_object.cpp | 5 +- src/libcamera/stream.cpp | 8 +- src/libcamera/v4l2_device.cpp | 19 +- src/libcamera/v4l2_subdevice.cpp | 1311 +++++++++-------- src/libcamera/v4l2_videodevice.cpp | 37 +- src/v4l2/v4l2_camera.h | 1 - src/v4l2/v4l2_camera_proxy.cpp | 46 +- src/v4l2/v4l2_compat.cpp | 20 +- src/v4l2/v4l2_compat_manager.cpp | 5 +- 68 files changed, 966 insertions(+), 982 deletions(-)