Re: [PATCH 05/13] media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Steve,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.16-rc2 next-20180223]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Steve-Longerbeam/media-imx-Switch-to-subdev-notifiers/20180223-120401
base:   git://linuxtv.org/media_tree.git master
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sh 

All warnings (new ones prefixed by >>):

   In file included from drivers/media/platform/ti-vpe/cal.c:24:0:
>> include/media/v4l2-fwnode.h:399:9: warning: 'struct v4l2_subdev' declared inside parameter list will not be visible outside of this definition or declaration
     struct v4l2_subdev *sd, size_t asd_struct_size,
            ^~~~~~~~~~~
--
   In file included from drivers/media/platform/davinci/vpif_capture.c:25:0:
>> include/media/v4l2-fwnode.h:399:9: warning: 'struct v4l2_subdev' declared inside parameter list will not be visible outside of this definition or declaration
     struct v4l2_subdev *sd, size_t asd_struct_size,
            ^~~~~~~~~~~
   In file included from arch/sh/include/asm/string.h:3:0,
                    from include/linux/string.h:20,
                    from include/linux/bitmap.h:9,
                    from include/linux/nodemask.h:95,
                    from include/linux/mmzone.h:17,
                    from include/linux/gfp.h:6,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:22,
                    from include/linux/module.h:13,
                    from drivers/media/platform/davinci/vpif_capture.c:19:
   drivers/media/platform/davinci/vpif_capture.c: In function 'vpif_s_dv_timings':
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~

vim +399 include/media/v4l2-fwnode.h

   215	
   216	
   217	/**
   218	 * typedef parse_endpoint_func - Driver's callback function to be called on
   219	 *	each V4L2 fwnode endpoint.
   220	 *
   221	 * @dev: pointer to &struct device
   222	 * @vep: pointer to &struct v4l2_fwnode_endpoint
   223	 * @asd: pointer to &struct v4l2_async_subdev
   224	 *
   225	 * Return:
   226	 * * %0 on success
   227	 * * %-ENOTCONN if the endpoint is to be skipped but this
   228	 *   should not be considered as an error
   229	 * * %-EINVAL if the endpoint configuration is invalid
   230	 */
   231	typedef int (*parse_endpoint_func)(struct device *dev,
   232					  struct v4l2_fwnode_endpoint *vep,
   233					  struct v4l2_async_subdev *asd);
   234	
   235	
   236	/**
   237	 * v4l2_async_notifier_parse_fwnode_endpoints - Parse V4L2 fwnode endpoints in a
   238	 *						device node
   239	 * @dev: the device the endpoints of which are to be parsed
   240	 * @notifier: notifier for @dev
   241	 * @asd_struct_size: size of the driver's async sub-device struct, including
   242	 *		     sizeof(struct v4l2_async_subdev). The &struct
   243	 *		     v4l2_async_subdev shall be the first member of
   244	 *		     the driver's async sub-device struct, i.e. both
   245	 *		     begin at the same memory address.
   246	 * @parse_endpoint: Driver's callback function called on each V4L2 fwnode
   247	 *		    endpoint. Optional.
   248	 *
   249	 * Parse the fwnode endpoints of the @dev device and populate the async sub-
   250	 * devices list in the notifier. The @parse_endpoint callback function is
   251	 * called for each endpoint with the corresponding async sub-device pointer to
   252	 * let the caller initialize the driver-specific part of the async sub-device
   253	 * structure.
   254	 *
   255	 * The notifier memory shall be zeroed before this function is called on the
   256	 * notifier.
   257	 *
   258	 * This function may not be called on a registered notifier and may be called on
   259	 * a notifier only once.
   260	 *
   261	 * Do not allocate the notifier's subdevs array, or change the notifier's
   262	 * num_subdevs field. This is because this function uses
   263	 * @v4l2_async_notifier_add_subdev to populate the notifier's asd_list,
   264	 * which is in-place-of the subdevs array which must remain unallocated
   265	 * and unused.
   266	 *
   267	 * The &struct v4l2_fwnode_endpoint passed to the callback function
   268	 * @parse_endpoint is released once the function is finished. If there is a need
   269	 * to retain that configuration, the user needs to allocate memory for it.
   270	 *
   271	 * Any notifier populated using this function must be released with a call to
   272	 * v4l2_async_notifier_cleanup() after it has been unregistered and the async
   273	 * sub-devices are no longer in use, even if the function returned an error.
   274	 *
   275	 * Return: %0 on success, including when no async sub-devices are found
   276	 *	   %-ENOMEM if memory allocation failed
   277	 *	   %-EINVAL if graph or endpoint parsing failed
   278	 *	   Other error codes as returned by @parse_endpoint
   279	 */
   280	int v4l2_async_notifier_parse_fwnode_endpoints(
   281		struct device *dev, struct v4l2_async_notifier *notifier,
   282		size_t asd_struct_size,
   283		parse_endpoint_func parse_endpoint);
   284	
   285	/**
   286	 * v4l2_async_notifier_parse_fwnode_endpoints_by_port - Parse V4L2 fwnode
   287	 *							endpoints of a port in a
   288	 *							device node
   289	 * @dev: the device the endpoints of which are to be parsed
   290	 * @notifier: notifier for @dev
   291	 * @asd_struct_size: size of the driver's async sub-device struct, including
   292	 *		     sizeof(struct v4l2_async_subdev). The &struct
   293	 *		     v4l2_async_subdev shall be the first member of
   294	 *		     the driver's async sub-device struct, i.e. both
   295	 *		     begin at the same memory address.
   296	 * @port: port number where endpoints are to be parsed
   297	 * @parse_endpoint: Driver's callback function called on each V4L2 fwnode
   298	 *		    endpoint. Optional.
   299	 *
   300	 * This function is just like v4l2_async_notifier_parse_fwnode_endpoints() with
   301	 * the exception that it only parses endpoints in a given port. This is useful
   302	 * on devices that have both sinks and sources: the async sub-devices connected
   303	 * to sources have already been configured by another driver (on capture
   304	 * devices). In this case the driver must know which ports to parse.
   305	 *
   306	 * Parse the fwnode endpoints of the @dev device on a given @port and populate
   307	 * the async sub-devices list of the notifier. The @parse_endpoint callback
   308	 * function is called for each endpoint with the corresponding async sub-device
   309	 * pointer to let the caller initialize the driver-specific part of the async
   310	 * sub-device structure.
   311	 *
   312	 * The notifier memory shall be zeroed before this function is called on the
   313	 * notifier the first time.
   314	 *
   315	 * This function may not be called on a registered notifier and may be called on
   316	 * a notifier only once per port.
   317	 *
   318	 * Do not allocate the notifier's subdevs array, or change the notifier's
   319	 * num_subdevs field. This is because this function uses
   320	 * @v4l2_async_notifier_add_subdev to populate the notifier's asd_list,
   321	 * which is in-place-of the subdevs array which must remain unallocated
   322	 * and unused.
   323	 *
   324	 * The &struct v4l2_fwnode_endpoint passed to the callback function
   325	 * @parse_endpoint is released once the function is finished. If there is a need
   326	 * to retain that configuration, the user needs to allocate memory for it.
   327	 *
   328	 * Any notifier populated using this function must be released with a call to
   329	 * v4l2_async_notifier_cleanup() after it has been unregistered and the async
   330	 * sub-devices are no longer in use, even if the function returned an error.
   331	 *
   332	 * Return: %0 on success, including when no async sub-devices are found
   333	 *	   %-ENOMEM if memory allocation failed
   334	 *	   %-EINVAL if graph or endpoint parsing failed
   335	 *	   Other error codes as returned by @parse_endpoint
   336	 */
   337	int v4l2_async_notifier_parse_fwnode_endpoints_by_port(
   338		struct device *dev, struct v4l2_async_notifier *notifier,
   339		size_t asd_struct_size, unsigned int port,
   340		parse_endpoint_func parse_endpoint);
   341	
   342	/**
   343	 * v4l2_fwnode_reference_parse_sensor_common - parse common references on
   344	 *					       sensors for async sub-devices
   345	 * @dev: the device node the properties of which are parsed for references
   346	 * @notifier: the async notifier where the async subdevs will be added
   347	 *
   348	 * Parse common sensor properties for remote devices related to the
   349	 * sensor and set up async sub-devices for them.
   350	 *
   351	 * Any notifier populated using this function must be released with a call to
   352	 * v4l2_async_notifier_release() after it has been unregistered and the async
   353	 * sub-devices are no longer in use, even in the case the function returned an
   354	 * error.
   355	 *
   356	 * Return: 0 on success
   357	 *	   -ENOMEM if memory allocation failed
   358	 *	   -EINVAL if property parsing failed
   359	 */
   360	int v4l2_async_notifier_parse_fwnode_sensor_common(
   361		struct device *dev, struct v4l2_async_notifier *notifier);
   362	
   363	/**
   364	 * v4l2_async_register_fwnode_subdev - registers a sub-device to the
   365	 *					asynchronous sub-device framework
   366	 *					and parses fwnode endpoints
   367	 *
   368	 * @sd: pointer to struct &v4l2_subdev
   369	 * @asd_struct_size: size of the driver's async sub-device struct, including
   370	 *		     sizeof(struct v4l2_async_subdev). The &struct
   371	 *		     v4l2_async_subdev shall be the first member of
   372	 *		     the driver's async sub-device struct, i.e. both
   373	 *		     begin at the same memory address.
   374	 * @ports: array of port id's to parse for fwnode endpoints. If NULL, will
   375	 *	   parse all ports owned by the sub-device.
   376	 * @num_ports: number of ports in @ports array. Ignored if @ports is NULL.
   377	 * @parse_endpoint: Driver's callback function called on each V4L2 fwnode
   378	 *		    endpoint. Optional.
   379	 *
   380	 * This function is just like v4l2_async_register_subdev() with the exception
   381	 * that calling it will also parse the sub-device's firmware node endpoints
   382	 * using v4l2_async_notifier_parse_fwnode_endpoints() or
   383	 * v4l2_async_notifier_parse_fwnode_endpoints_by_port(), and registers the
   384	 * async sub-devices. The sub-device is similarly unregistered by calling
   385	 * v4l2_async_unregister_subdev().
   386	 *
   387	 * This function will work as expected if the sub-device fwnode is
   388	 * itself a port. The endpoints of this single port are parsed using
   389	 * v4l2_async_notifier_parse_fwnode_endpoints_by_port(), passing the
   390	 * parent of the sub-device as the port's owner. The caller must not
   391	 * provide a @ports array, since the sub-device owns only this port.
   392	 *
   393	 * While registered, the subdev module is marked as in-use.
   394	 *
   395	 * An error is returned if the module is no longer loaded on any attempts
   396	 * to register it.
   397	 */
   398	int v4l2_async_register_fwnode_subdev(
 > 399		struct v4l2_subdev *sd, size_t asd_struct_size,
   400		unsigned int *ports, unsigned int num_ports,
   401		int (*parse_endpoint)(struct device *dev,
   402				      struct v4l2_fwnode_endpoint *vep,
   403				      struct v4l2_async_subdev *asd));
   404	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux