From: Felix Manlunas <felix.manlunas@cavium.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Derek Chickles <derek.chickles@caviumnetworks.com>,
Satanand Burla <satananda.burla@caviumnetworks.com>,
Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] liquidio: fix duplicated code for different branches
Date: Mon, 14 Aug 2017 00:14:34 -0700 [thread overview]
Message-ID: <20170814071434.GA1046@felix-thinkpad.cavium.com> (raw)
In-Reply-To: <20170813013855.GA6686@embeddedgus>
On Sat, Aug 12, 2017 at 08:38:55PM -0500, Gustavo A. R. Silva wrote:
> Refactor code in order to avoid identical code for different branches.
>
> This issue was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> This code was tested by compilation only.
>
> drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> index b78e296..4f65c08 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> @@ -578,23 +578,18 @@ static int lio_set_phys_id(struct net_device *netdev,
> break;
>
> case ETHTOOL_ID_ON:
> - if (oct->chip_id == OCTEON_CN66XX) {
> + if (oct->chip_id == OCTEON_CN66XX)
> octnet_gpio_access(netdev, VITESSE_PHY_GPIO_CFG,
> VITESSE_PHY_GPIO_HIGH);
> -
> - } else if (oct->chip_id == OCTEON_CN68XX) {
> - return -EINVAL;
> - } else {
> + else
> return -EINVAL;
> - }
> +
> break;
>
> case ETHTOOL_ID_OFF:
> if (oct->chip_id == OCTEON_CN66XX)
> octnet_gpio_access(netdev, VITESSE_PHY_GPIO_CFG,
> VITESSE_PHY_GPIO_LOW);
> - else if (oct->chip_id == OCTEON_CN68XX)
> - return -EINVAL;
> else
> return -EINVAL;
>
> --
> 2.5.0
>
Acked-by: Felix Manlunas <felix.manlunas@cavium.com>
next prev parent reply other threads:[~2017-08-14 7:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-13 1:38 Gustavo A. R. Silva
2017-08-14 7:14 ` Felix Manlunas [this message]
2017-08-14 17:58 ` 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=20170814071434.GA1046@felix-thinkpad.cavium.com \
--to=felix.manlunas@cavium.com \
--cc=derek.chickles@caviumnetworks.com \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=raghu.vatsavayi@caviumnetworks.com \
--cc=satananda.burla@caviumnetworks.com \
/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
all inboxes | Powered by JetHome®