[dpdk-dev,1/2] mlx5: don't pass unused argument to sub-functions

Message ID 20180102205310.3586-2-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Stephen Hemminger Jan. 2, 2018, 8:53 p.m. UTC
  Since wait_to_complete is unused, don't pass it to helper functions.
Use the standard RTE macro to indicate this is an unused parameter.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/mlx5/mlx5_ethdev.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
  

Comments

Nélio Laranjeiro Jan. 3, 2018, 7:35 a.m. UTC | #1
Hi Stephen,

On Tue, Jan 02, 2018 at 12:53:09PM -0800, Stephen Hemminger wrote:
> Since wait_to_complete is unused, don't pass it to helper functions.
> Use the standard RTE macro to indicate this is an unused parameter.

I would suggest to use the (void) as it is done in the whole driver, a
specific patch should be done to use the rte_unused macro in all the
sources at once.

Thanks,
  
Stephen Hemminger Jan. 3, 2018, 3:21 p.m. UTC | #2
On Wed, 3 Jan 2018 08:35:23 +0100
Nelio Laranjeiro <nelio.laranjeiro@6wind.com> wrote:

> Hi Stephen,
> 
> On Tue, Jan 02, 2018 at 12:53:09PM -0800, Stephen Hemminger wrote:
> > Since wait_to_complete is unused, don't pass it to helper functions.
> > Use the standard RTE macro to indicate this is an unused parameter.  
> 
> I would suggest to use the (void) as it is done in the whole driver, a
> specific patch should be done to use the rte_unused macro in all the
> sources at once.
> 
> Thanks,
> 

There is a standard in DPDK using RTE macros. The whole driver should
follow that rather than trying to be different.
  
Nélio Laranjeiro Jan. 4, 2018, 8:52 a.m. UTC | #3
On Wed, Jan 03, 2018 at 07:21:58AM -0800, Stephen Hemminger wrote:
> On Wed, 3 Jan 2018 08:35:23 +0100
> Nelio Laranjeiro <nelio.laranjeiro@6wind.com> wrote:
> 
> > Hi Stephen,
> > 
> > On Tue, Jan 02, 2018 at 12:53:09PM -0800, Stephen Hemminger wrote:
> > > Since wait_to_complete is unused, don't pass it to helper functions.
> > > Use the standard RTE macro to indicate this is an unused parameter.  
> > 
> > I would suggest to use the (void) as it is done in the whole driver, a
> > specific patch should be done to use the rte_unused macro in all the
> > sources at once.
> > 
> > Thanks,
> > 
> 
> There is a standard in DPDK using RTE macros. The whole driver should
> follow that rather than trying to be different.

The standard was introduced after the driver have been submitted, I
agree that a new way is present, but when it was introduced a
modification on the whole code though DPDK should have been done to
avoid mixed ways.

I prefer to have a single commit replacing the (void)foo by
__rte_unused, it will also help the backports to the stable branches.

Thanks,
  

Patch

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index a3cef6891d03..388507f109f7 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -755,11 +755,9 @@  mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
- * @param wait_to_complete
- *   Wait for request completion (ignored).
  */
 static int
-mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, int wait_to_complete)
+mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev)
 {
 	struct priv *priv = mlx5_get_priv(dev);
 	struct ethtool_cmd edata = {
@@ -771,7 +769,6 @@  mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, int wait_to_complete)
 
 	/* priv_lock() is not taken to allow concurrent calls. */
 
-	(void)wait_to_complete;
 	if (priv_ifreq(priv, SIOCGIFFLAGS, &ifr)) {
 		WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(errno));
 		return -1;
@@ -821,11 +818,9 @@  mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, int wait_to_complete)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
- * @param wait_to_complete
- *   Wait for request completion (ignored).
  */
 static int
-mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
+mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev)
 {
 	struct priv *priv = mlx5_get_priv(dev);
 	struct ethtool_link_settings gcmd = { .cmd = ETHTOOL_GLINKSETTINGS };
@@ -833,7 +828,6 @@  mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
 	struct rte_eth_link dev_link;
 	uint64_t sc;
 
-	(void)wait_to_complete;
 	if (priv_ifreq(priv, SIOCGIFFLAGS, &ifr)) {
 		WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(errno));
 		return -1;
@@ -921,7 +915,7 @@  mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
  *   Wait for request completion (ignored).
  */
 int
-mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete)
+mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 {
 	struct utsname utsname;
 	int ver[3];
@@ -930,8 +924,8 @@  mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	    sscanf(utsname.release, "%d.%d.%d",
 		   &ver[0], &ver[1], &ver[2]) != 3 ||
 	    KERNEL_VERSION(ver[0], ver[1], ver[2]) < KERNEL_VERSION(4, 9, 0))
-		return mlx5_link_update_unlocked_gset(dev, wait_to_complete);
-	return mlx5_link_update_unlocked_gs(dev, wait_to_complete);
+		return mlx5_link_update_unlocked_gset(dev);
+	return mlx5_link_update_unlocked_gs(dev);
 }
 
 /**