From patchwork Mon Sep 2 15:41:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 21130 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 ACF6FBF415 for ; Mon, 2 Sep 2024 15:42:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C5007618FF; Mon, 2 Sep 2024 17:42:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="HEXp1ops"; 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 89E3B618FD for ; Mon, 2 Sep 2024 17:42:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725291748; 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=yFCAKel0mGIlYEvOZp53tZ3FhoC00hKLiB27WauHo5w=; b=HEXp1opsTS7LKixW51zjSkko5p6XEJX+b5MhInojLnny/ddRbPASUWJxke0caDpcYpuRhg RU7fAGzXqxDZ/XuwqP4ilijTQyERidWcaIZdqUUS/EXA3fnHLQnNDJtOzoZ+8lp+yTHA/N E46QBC5DY31GYmKFUpPgkbgWioLh+kc= 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-292-NpoYo1m_NrW882zjzuIHlA-1; Mon, 02 Sep 2024 11:42:27 -0400 X-MC-Unique: NpoYo1m_NrW882zjzuIHlA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 13B8B1955D4C; Mon, 2 Sep 2024 15:42:26 +0000 (UTC) Received: from nuthatch.redhat.com (unknown [10.45.224.69]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 665A21955F1B; Mon, 2 Sep 2024 15:42:24 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Laurent Pinchart Subject: [PATCH v3 00/18] Remove unused includes Date: Mon, 2 Sep 2024 17:41:53 +0200 Message-ID: <20240902154212.1281257-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 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. Changes in v3: - Comments from Laurent’s review addressed: More include’s removed, more added and many formatting changes reverted. - Some more missing include’s added. Changes in v2: - Add a missing include in tests. Milan Zamazal (18): tests: Add a missing iostream include 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: Fix includes libcamera: v4l2: Remove unused includes libcamera: v4l2: Fix an include placement 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 | 1 - include/libcamera/base/memfd.h | 2 -- include/libcamera/base/signal.h | 1 - include/libcamera/base/span.h | 1 - include/libcamera/base/timer.h | 1 - include/libcamera/base/utils.h | 3 +-- include/libcamera/framebuffer.h | 1 - include/libcamera/internal/camera_manager.h | 1 - include/libcamera/internal/camera_sensor.h | 1 - .../internal/device_enumerator_sysfs.h | 1 - include/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 + include/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 | 3 +-- src/ipa/ipu3/algorithms/blc.cpp | 6 ++---- src/ipa/ipu3/ipu3.cpp | 18 +++++++----------- 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 | 4 ++-- src/ipa/rkisp1/algorithms/agc.h | 1 - src/ipa/rkisp1/algorithms/awb.cpp | 7 ++++--- src/ipa/rkisp1/algorithms/ccm.cpp | 6 +----- src/ipa/rkisp1/algorithms/dpf.cpp | 4 +++- src/ipa/rkisp1/rkisp1.cpp | 11 ++++++----- src/ipa/rkisp1/utils.h | 1 - src/libcamera/base/event_dispatcher_poll.cpp | 3 +-- src/libcamera/camera.cpp | 7 +++++-- src/libcamera/controls.cpp | 3 +-- src/libcamera/converter/converter_v4l2_m2m.cpp | 1 - src/libcamera/formats.cpp | 3 +-- src/libcamera/ipa_data_serializer.cpp | 5 +++-- src/libcamera/ipa_module.cpp | 5 ++--- src/libcamera/ipa_proxy.cpp | 1 - src/libcamera/orientation.cpp | 13 ++++++++----- src/libcamera/pipeline/ipu3/frames.cpp | 3 ++- src/libcamera/pipeline/ipu3/ipu3.cpp | 18 +++++++++--------- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 3 +-- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 6 ++++-- src/libcamera/pipeline_handler.cpp | 1 - src/libcamera/process.cpp | 6 ++---- src/libcamera/sensor/camera_sensor.cpp | 8 +++----- src/libcamera/shared_mem_object.cpp | 5 ++--- src/libcamera/stream.cpp | 6 ++++-- src/libcamera/v4l2_device.cpp | 2 -- src/libcamera/v4l2_subdevice.cpp | 5 ++--- src/libcamera/v4l2_videodevice.cpp | 1 - src/v4l2/v4l2_camera.h | 3 ++- src/v4l2/v4l2_camera_proxy.cpp | 3 +-- src/v4l2/v4l2_compat.cpp | 1 - src/v4l2/v4l2_compat_manager.cpp | 1 - .../generated_serializer_test.cpp | 1 + 69 files changed, 88 insertions(+), 156 deletions(-)