linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: linux-next: build warning after merge of the v4l-dvb tree
Date: Mon, 15 Feb 2021 11:42:57 +0100	[thread overview]
Message-ID: <20210215114257.5dc0fd00@coco.lan> (raw)
In-Reply-To: <20210215112024.22ebdd4c@coco.lan>

Em Mon, 15 Feb 2021 11:20:24 +0100
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:

> Em Mon, 08 Feb 2021 15:53:00 -0300
> Ezequiel Garcia <ezequiel@collabora.com> escreveu:
> 
> > On Mon, 2021-02-08 at 18:40 +0100, Mauro Carvalho Chehab wrote:
> > > Em Mon, 08 Feb 2021 13:57:56 -0300
> > > Ezequiel Garcia <ezequiel@collabora.com> escreveu:
> > >   
> > > > On Mon, 2021-02-08 at 18:46 +0200, Sakari Ailus wrote:  
> > > > > Hi Ezequiel,
> > > > > 
> > > > > Thanks for addressing this.
> > > > > 
> > > > > On Mon, Feb 08, 2021 at 01:42:21PM -0300, Ezequiel Garcia wrote:    
> > > > > > Hi Stephen,
> > > > > > 
> > > > > > On Mon, 2021-02-08 at 23:37 +1100, Stephen Rothwell wrote:    
> > > > > > > Hi all,
> > > > > > > 
> > > > > > > After merging the v4l-dvb tree, today's linux-next build (htmldocs)
> > > > > > > produced this warning:
> > > > > > > 
> > > > > > > include/media/v4l2-async.h:178: warning: expecting prototype for v4l2_async_notifier_add_fwnode_subdev(). Prototype was for
> > > > > > > __v4l2_async_notifier_add_fwnode_subdev() instead
> > > > > > > include/media/v4l2-async.h:207: warning: expecting prototype for v4l2_async_notifier_add_fwnode_remote_subdev(). Prototype was for
> > > > > > > __v4l2_async_notifier_add_fwnode_remote_subdev() instead
> > > > > > > include/media/v4l2-async.h:230: warning: expecting prototype for v4l2_async_notifier_add_i2c_subdev(). Prototype was for
> > > > > > > __v4l2_async_notifier_add_i2c_subdev() instead
> > > > > > > 
> > > > > > > Maybe introduced by commit
> > > > > > > 
> > > > > > >   c1cc23625062 ("media: v4l2-async: Discourage use of v4l2_async_notifier_add_subdev")
> > > > > > >     
> > > > > > 
> > > > > > Thanks for spotting this. Should be fixed by:
> > > > > > 
> > > > > > diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
> > > > > > index 6f22daa6f067..3785445282fc 100644
> > > > > > --- a/include/media/v4l2-async.h
> > > > > > +++ b/include/media/v4l2-async.h
> > > > > > @@ -157,7 +157,7 @@ int __v4l2_async_notifier_add_subdev(struct v4l2_async_notifier *notifier,
> > > > > >                                    struct v4l2_async_subdev *asd);
> > > > > >  
> > > > > >  /**
> > > > > > - * v4l2_async_notifier_add_fwnode_subdev - Allocate and add a fwnode async
> > > > > > + * __v4l2_async_notifier_add_fwnode_subdev - Allocate and add a fwnode async    
> > > > > 
> > > > > The problem with the approach is that this no longer documents the API that
> > > > > drivers are intended to use, but the intermediate one.  
> > > 
> > > Yep. the better would be to keep documenting what will be used.
> > >   
> > 
> > Is there a way to silence/ignore the warning for a specific function(s)?
> 
> No. The warning is there for a very good reason: if you do something like:
> 
> 
> 	/**
> 	 * delete - delete some file
> 	 *
> 	 * This function deletes something.
> 	 */
> 	void insert() {}
> 	/**
> 	 * insert - creates a new file
> 	 *
> 	 * This function creates a file and inserts something.
> 	 */
> 	void delete() {}
> 
> the output of it will be:
> 
> 	$ ./scripts/kernel-doc -sphinx-version 3.0.0 silly.c
> 	.. c:function:: void insert ()
> 	
> 	   delete some file
> 	
> 	**Parameters**
> 	
> 	**Description**
> 	
> 	
> 	This function deletes something.
> 	
> 	
> 	.. c:function:: void delete ()
> 	
> 	   creates a new file
> 	
> 	**Parameters**
> 	
> 	**Description**
> 	
> 	
> 	This function creates a file and inserts something.
> 
> Which is completely wrong. If someone tries to write a code using the
> above, the result will be just the opposite than what it was documented.
> 
> Btw, I noticed several places where things like that happened, because
> some code were added between a Kernel-doc markup and some function.

Btw, in the specific case of this change, something like the above
quick hack would fix it.

PS:  I didn't think much when I wrote the __type description.

Also, keeping the symbols that should be documented as __foo
doesn't seem the right thing to me :-)


---

[PATCH] v4l2-async.h: Fix kerneldoc markups

Document the functions that should be used by the kAPI clients,
instead of the internal functions.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index 6f22daa6f067..91dbeaa4e6ee 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -156,42 +156,38 @@ void v4l2_async_notifier_init(struct v4l2_async_notifier *notifier);
 int __v4l2_async_notifier_add_subdev(struct v4l2_async_notifier *notifier,
 				   struct v4l2_async_subdev *asd);
 
+struct v4l2_async_subdev *
+__v4l2_async_notifier_add_fwnode_subdev(struct v4l2_async_notifier *notifier,
+					struct fwnode_handle *fwnode,
+					unsigned int asd_struct_size);
 /**
  * v4l2_async_notifier_add_fwnode_subdev - Allocate and add a fwnode async
  *				subdev to the notifier's master asd_list.
  *
- * @notifier: pointer to &struct v4l2_async_notifier
- * @fwnode: fwnode handle of the sub-device to be matched
- * @asd_struct_size: size of the driver's async sub-device struct, including
- *		     sizeof(struct v4l2_async_subdev). The &struct
- *		     v4l2_async_subdev shall be the first member of
- *		     the driver's async sub-device struct, i.e. both
- *		     begin at the same memory address.
+ * @__notifier: pointer to &struct v4l2_async_notifier
+ * @__fwnode: fwnode handle of the sub-device to be matched
+ * @__type: type of the struct that contains a struct v4l2_async_subdev.
  *
  * Allocate a fwnode-matched asd of size asd_struct_size, and add it to the
  * notifiers @asd_list. The function also gets a reference of the fwnode which
  * is released later at notifier cleanup time.
  */
-struct v4l2_async_subdev *
-__v4l2_async_notifier_add_fwnode_subdev(struct v4l2_async_notifier *notifier,
-					struct fwnode_handle *fwnode,
-					unsigned int asd_struct_size);
 #define v4l2_async_notifier_add_fwnode_subdev(__notifier, __fwnode, __type)	\
 ((__type *)__v4l2_async_notifier_add_fwnode_subdev(__notifier, __fwnode,	\
 						   sizeof(__type)))
 
+struct v4l2_async_subdev *
+__v4l2_async_notifier_add_fwnode_remote_subdev(struct v4l2_async_notifier *notif,
+					       struct fwnode_handle *endpoint,
+					       unsigned int asd_struct_size);
 /**
  * v4l2_async_notifier_add_fwnode_remote_subdev - Allocate and add a fwnode
  *						  remote async subdev to the
  *						  notifier's master asd_list.
  *
- * @notif: pointer to &struct v4l2_async_notifier
- * @endpoint: local endpoint pointing to the remote sub-device to be matched
- * @asd_struct_size: size of the driver's async sub-device struct, including
- *		     sizeof(struct v4l2_async_subdev). The &struct
- *		     v4l2_async_subdev shall be the first member of
- *		     the driver's async sub-device struct, i.e. both
- *		     begin at the same memory address.
+ * @__notifier: pointer to &struct v4l2_async_notifier
+ * @__ep: local endpoint pointing to the remote sub-device to be matched
+ * @__type: type of the struct that contains a struct v4l2_async_subdev.
  *
  * Gets the remote endpoint of a given local endpoint, set it up for fwnode
  * matching and adds the async sub-device to the notifier's @asd_list. The
@@ -201,33 +197,25 @@ __v4l2_async_notifier_add_fwnode_subdev(struct v4l2_async_notifier *notifier,
  * This is just like @v4l2_async_notifier_add_fwnode_subdev, but with the
  * exception that the fwnode refers to a local endpoint, not the remote one.
  */
-struct v4l2_async_subdev *
-__v4l2_async_notifier_add_fwnode_remote_subdev(struct v4l2_async_notifier *notif,
-					       struct fwnode_handle *endpoint,
-					       unsigned int asd_struct_size);
 #define v4l2_async_notifier_add_fwnode_remote_subdev(__notifier, __ep, __type)	\
 ((__type *)__v4l2_async_notifier_add_fwnode_remote_subdev(__notifier, __ep,	\
 							  sizeof(__type)))
 
+struct v4l2_async_subdev *
+__v4l2_async_notifier_add_i2c_subdev(struct v4l2_async_notifier *notifier,
+				     int adapter_id, unsigned short address,
+				     unsigned int asd_struct_size);
 /**
  * v4l2_async_notifier_add_i2c_subdev - Allocate and add an i2c async
  *				subdev to the notifier's master asd_list.
  *
- * @notifier: pointer to &struct v4l2_async_notifier
- * @adapter_id: I2C adapter ID to be matched
- * @address: I2C address of sub-device to be matched
- * @asd_struct_size: size of the driver's async sub-device struct, including
- *		     sizeof(struct v4l2_async_subdev). The &struct
- *		     v4l2_async_subdev shall be the first member of
- *		     the driver's async sub-device struct, i.e. both
- *		     begin at the same memory address.
+ * @__notifier: pointer to &struct v4l2_async_notifier
+ * @__adap: I2C adapter ID to be matched
+ * @__addr: I2C address of sub-device to be matched
+ * @__type: type of the struct that contains a struct v4l2_async_subdev.
  *
  * Same as above but for I2C matched sub-devices.
  */
-struct v4l2_async_subdev *
-__v4l2_async_notifier_add_i2c_subdev(struct v4l2_async_notifier *notifier,
-				     int adapter_id, unsigned short address,
-				     unsigned int asd_struct_size);
 #define v4l2_async_notifier_add_i2c_subdev(__notifier, __adap, __addr, __type)	\
 ((__type *)__v4l2_async_notifier_add_i2c_subdev(__notifier, __adap, __addr,	\
 						sizeof(__type)))


Thanks,
Mauro

  reply	other threads:[~2021-02-15 10:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 12:37 linux-next: build warning after merge of the v4l-dvb tree Stephen Rothwell
2021-02-08 16:42 ` Ezequiel Garcia
2021-02-08 16:46   ` Sakari Ailus
2021-02-08 16:57     ` Ezequiel Garcia
2021-02-08 17:40       ` Mauro Carvalho Chehab
2021-02-08 18:53         ` Ezequiel Garcia
2021-02-15 10:20           ` Mauro Carvalho Chehab
2021-02-15 10:42             ` Mauro Carvalho Chehab [this message]
2021-02-14 22:44 ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2021-05-10 23:46 Stephen Rothwell
2021-05-21  0:48 ` Stephen Rothwell
2021-03-23  5:56 Stephen Rothwell
2021-02-08  0:32 Stephen Rothwell
2021-02-08  6:30 ` Mauro Carvalho Chehab
2021-02-08  8:33   ` Geert Uytterhoeven
2021-02-08  8:49     ` Mauro Carvalho Chehab
2021-02-08  8:52       ` Geert Uytterhoeven
2021-02-08  9:14         ` Mauro Carvalho Chehab
2021-01-13  4:10 Stephen Rothwell
2021-01-20  6:14 ` Stephen Rothwell
2020-11-18  5:29 Stephen Rothwell
2020-11-26  6:54 ` Stephen Rothwell
2020-11-27 10:11   ` Sean Young
2020-05-21  2:07 Stephen Rothwell
2020-04-17  0:22 Stephen Rothwell
2020-04-17  5:13 ` Ezequiel Garcia
2020-04-17  7:01   ` Mauro Carvalho Chehab
2020-04-15  1:29 Stephen Rothwell
2019-01-31 23:25 Stephen Rothwell
2011-03-17  0:29 Stephen Rothwell
2010-12-31  0:59 Stephen Rothwell
2010-10-08  0:49 Stephen Rothwell
2010-10-08  3:13 ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210215114257.5dc0fd00@coco.lan \
    --to=mchehab@kernel.org \
    --cc=ezequiel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).