[dpdk-dev,1/2] mlx5: don't pass unused argument to sub-functions
Checks
Commit Message
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
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,
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.
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,
@@ -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);
}
/**