You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/06/01 18:27:42 UTC

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1170: include/nuttx/video/video.h: Move global variable definition out of header file

patacongo commented on a change in pull request #1170:
URL: https://github.com/apache/incubator-nuttx/pull/1170#discussion_r433411098



##########
File path: boards/arm/cxd56xx/spresense/src/cxd56_bringup.c
##########
@@ -139,6 +139,14 @@
  #endif
 #endif
 
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifdef CONFIG_VIDEO_ISX012
+FAR const struct video_devops_s *g_video_devops;

Review comment:
       I thought about that, but then it could force video.o into the link even if it were not used.  I also though about a separate C file that contains nothing but the g_video_devops definition.
   
   The real solution is to remove the global variable altogether.  It is very bad style for a driver interface.  For one thing, it limits the use of the driver to a single instance.  That is something that I have been careful to avoid in all drivers.  This breaks that rule.  See Issue #439.  Anything else is as band-aid to work around a very bad design.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org