From patchwork Tue May 26 03:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3855 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 28BC1603CF for ; Tue, 26 May 2020 05:26:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nDi0iG23"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9993F562 for ; Tue, 26 May 2020 05:26:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590463612; bh=dhJ+DsgAsSfbNoL1stDRvqbaSIuruV0KXcgXman1Y2U=; h=From:To:Subject:Date:From; b=nDi0iG23FzWqDJW4FPqvemkXPpSF6nRYEgryua+WOr7cYj/LfobHfnTzJhpltucQw 8f8iZfvQrO1TtxH7dNlekMgn1C7q/t9Ziac5yZiQ3OM9/vN8DFkBgEXmbYU5epELWL 0yBGSIffTXHKIj7xzXZMo8+b7J7nPXegcpb2VJ+M= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 26 May 2020 06:26:35 +0300 Message-Id: <20200526032635.13599-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: Declare functions before variables in class definitions 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: , X-List-Received-Date: Tue, 26 May 2020 03:26:53 -0000 The preferred coding style in libcamera is to declare private functions before private variables in class definitions. This rule isn't followed by some of the internal classes. Update them accordingly. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain --- .../internal/device_enumerator_udev.h | 16 ++++++------ .../internal/event_dispatcher_poll.h | 12 ++++----- include/libcamera/internal/ipa_manager.h | 4 +-- include/libcamera/internal/ipa_module.h | 4 +-- include/libcamera/internal/media_device.h | 26 +++++++++---------- include/libcamera/internal/media_object.h | 4 +-- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/libcamera/internal/device_enumerator_udev.h b/include/libcamera/internal/device_enumerator_udev.h index fdaa20968ef0..10d17ed2abac 100644 --- a/include/libcamera/internal/device_enumerator_udev.h +++ b/include/libcamera/internal/device_enumerator_udev.h @@ -36,10 +36,6 @@ public: int enumerate() final; private: - struct udev *udev_; - struct udev_monitor *monitor_; - EventNotifier *notifier_; - using DependencyMap = std::map>; struct MediaDeviceDeps { @@ -58,16 +54,20 @@ private: DependencyMap deps_; }; - std::set orphans_; - std::list pending_; - std::map devMap_; - int addUdevDevice(struct udev_device *dev); int populateMediaDevice(MediaDevice *media, DependencyMap *deps); std::string lookupDeviceNode(dev_t devnum); int addV4L2Device(dev_t devnum); void udevNotify(EventNotifier *notifier); + + struct udev *udev_; + struct udev_monitor *monitor_; + EventNotifier *notifier_; + + std::set orphans_; + std::list pending_; + std::map devMap_; }; } /* namespace libcamera */ diff --git a/include/libcamera/internal/event_dispatcher_poll.h b/include/libcamera/internal/event_dispatcher_poll.h index 1f0738617425..3c9099660c4d 100644 --- a/include/libcamera/internal/event_dispatcher_poll.h +++ b/include/libcamera/internal/event_dispatcher_poll.h @@ -41,16 +41,16 @@ private: EventNotifier *notifiers[3]; }; - std::map notifiers_; - std::list timers_; - int eventfd_; - - bool processingEvents_; - int poll(std::vector *pollfds); void processInterrupt(const struct pollfd &pfd); void processNotifiers(const std::vector &pollfds); void processTimers(); + + std::map notifiers_; + std::list timers_; + int eventfd_; + + bool processingEvents_; }; } /* namespace libcamera */ diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h index 2412d75746ac..16d742918cf2 100644 --- a/include/libcamera/internal/ipa_manager.h +++ b/include/libcamera/internal/ipa_manager.h @@ -29,8 +29,6 @@ public: uint32_t minVersion); private: - std::vector modules_; - IPAManager(); ~IPAManager(); @@ -40,6 +38,8 @@ private: bool isSignatureValid(IPAModule *ipa) const; + std::vector modules_; + #if HAVE_IPA_PUBKEY static const uint8_t publicKeyData_[]; static const PubKey pubKey_; diff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h index 5b54cb31a48a..788e31d8bf03 100644 --- a/include/libcamera/internal/ipa_module.h +++ b/include/libcamera/internal/ipa_module.h @@ -42,6 +42,8 @@ protected: std::string logPrefix() const override; private: + int loadIPAModuleInfo(); + struct IPAModuleInfo info_; std::vector signature_; @@ -52,8 +54,6 @@ private: void *dlHandle_; typedef struct ipa_context *(*IPAIntfFactory)(void); IPAIntfFactory ipaCreate_; - - int loadIPAModuleInfo(); }; } /* namespace libcamera */ diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h index 9fe76c514b17..19af059d9291 100644 --- a/include/libcamera/internal/media_device.h +++ b/include/libcamera/internal/media_device.h @@ -58,26 +58,13 @@ protected: std::string logPrefix() const; private: - std::string driver_; - std::string deviceNode_; - std::string model_; - unsigned int version_; - - int fd_; - bool valid_; - bool acquired_; - bool lockOwner_; - int open(); void close(); - std::map objects_; MediaObject *object(unsigned int id); bool addObject(MediaObject *object); void clear(); - std::vector entities_; - struct media_v2_interface *findInterface(const struct media_v2_topology &topology, unsigned int entityId); bool populateEntities(const struct media_v2_topology &topology); @@ -87,6 +74,19 @@ private: friend int MediaLink::setEnabled(bool enable); int setupLink(const MediaLink *link, unsigned int flags); + + std::string driver_; + std::string deviceNode_; + std::string model_; + unsigned int version_; + + int fd_; + bool valid_; + bool acquired_; + bool lockOwner_; + + std::map objects_; + std::vector entities_; }; } /* namespace libcamera */ diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h index 748eafdc880b..e8f2f27ce99e 100644 --- a/include/libcamera/internal/media_object.h +++ b/include/libcamera/internal/media_object.h @@ -107,6 +107,8 @@ private: MediaEntity(const MediaEntity &) = delete; ~MediaEntity(); + void addPad(MediaPad *pad); + std::string name_; unsigned int function_; unsigned int flags_; @@ -115,8 +117,6 @@ private: unsigned int minor_; std::vector pads_; - - void addPad(MediaPad *pad); }; } /* namespace libcamera */