netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Yuval Mintz <Yuval.Mintz@qlogic.com>,
	Ariel Elior <ariel.elior@cavium.com>,
	everest-linux-l2@cavium.com,
	"David S . Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH v1 2/3] bnx2x: Reuse bnx2x_null_format_ver()
Date: Thu, 27 Apr 2017 16:37:00 +0300	[thread overview]
Message-ID: <20170427133701.72701-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20170427133701.72701-1-andriy.shevchenko@linux.intel.com>

From: Andy Shevchenko <andy.shevchenko@gmail.com>

Reuse bnx2x_null_format_ver() in functions where it's appropriated
instead of open coded variant.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 2acc4f081818..6d11a958200f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -6161,14 +6161,20 @@ static void bnx2x_link_int_ack(struct link_params *params,
 	}
 }
 
+static int bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len)
+{
+	str[0] = '\0';
+	(*len)--;
+	return 0;
+}
+
 static int bnx2x_format_ver(u32 num, u8 *str, u16 *len)
 {
 	u16 ret;
 
 	if (*len < 10) {
 		/* Need more than 10chars for this format */
-		*str = '\0';
-		(*len)--;
+		bnx2x_null_format_ver(num, str, len);
 		return -EINVAL;
 	}
 
@@ -6183,8 +6189,7 @@ static int bnx2x_3_seq_format_ver(u32 num, u8 *str, u16 *len)
 
 	if (*len < 10) {
 		/* Need more than 10chars for this format */
-		*str = '\0';
-		(*len)--;
+		bnx2x_null_format_ver(num, str, len);
 		return -EINVAL;
 	}
 
@@ -6193,13 +6198,6 @@ static int bnx2x_3_seq_format_ver(u32 num, u8 *str, u16 *len)
 	return 0;
 }
 
-static int bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len)
-{
-	str[0] = '\0';
-	(*len)--;
-	return 0;
-}
-
 int bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 *version,
 				 u16 len)
 {
-- 
2.11.0

  reply	other threads:[~2017-04-27 13:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27 13:36 [PATCH v1 1/3] bnx2x: Replace custom scnprintf() Andy Shevchenko
2017-04-27 13:37 ` Andy Shevchenko [this message]
2017-05-01  2:29   ` [PATCH v1 2/3] bnx2x: Reuse bnx2x_null_format_ver() David Miller
2017-04-27 13:37 ` [PATCH v1 3/3] bnx2x: Get rid of useless temporary variable Andy Shevchenko
2017-05-01  2:29   ` David Miller
2017-04-30  8:16 ` [PATCH v1 1/3] bnx2x: Replace custom scnprintf() Mintz, Yuval
2017-04-30 12:58   ` Andy Shevchenko
2017-04-30 15:32     ` David Miller
2017-05-02  8:45       ` Andy Shevchenko
2017-05-02 14:42         ` David Miller
2017-05-01  2:29 ` David Miller

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=20170427133701.72701-2-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Yuval.Mintz@qlogic.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=ariel.elior@cavium.com \
    --cc=davem@davemloft.net \
    --cc=everest-linux-l2@cavium.com \
    --cc=netdev@vger.kernel.org \
    /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).