Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1427248

[PATCH net-next 15/19] net: hns: bug fix about led control logic when link down

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Yisen Zhuang <Yisen.Zhuang@huawei.com>
Newsgroups linux.kernel
Subject [PATCH net-next 15/19] net: hns: bug fix about led control logic when link down
Date Tue, 21 Jun 2016 05:50:02 +0200
Message-ID <rMkRk-qs-29@gated-at.bofh.it> (permalink)
References <rMkHD-l2-5@gated-at.bofh.it>
X-Original-To <davem@davemloft.net>, <yisen.zhuang@huawei.com>, <salil.mehta@huawei.com>, <yankejian@huawei.com>
X-Mailer git-send-email 1.9.1
MIME-Version 1.0
Content-Type text/plain
X-Originating-IP [10.67.212.75]
X-Cfilter-Loop Reflected
X-Mirapoint-Virus-Rapid-Raw score=unknown(0), refid=str=0001.0A090203.5768B6A9.0061,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32
X-Mirapoint-Loop-ID cb4de71205d5f0631e42c243ee870a73
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 54
Organization linux.* mail to news gateway
X-Original-Cc <liguozhu@huawei.com>, <huangdaode@hisilicon.com>, <arnd@arndb.de>, <andriy.shevchenko@linux.intel.com>, <andrew@lunn.ch>, <geliangtang@163.com>, <ivecera@redhat.com>, <fengguang.wu@intel.com>, <charles.chenxin@huawei.com>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linuxarm@huawei.com>
X-Original-Date Tue, 21 Jun 2016 11:56:35 +0800
X-Original-Message-ID <1466481399-70080-16-git-send-email-Yisen.Zhuang@huawei.com>
X-Original-References <1466481399-70080-1-git-send-email-Yisen.Zhuang@huawei.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1427248

Show key headers only | View raw


From: Daode Huang <huangdaode@hisilicon.com>

The default driver sets anchor led bit to 0 when link down,
actually, the anchor bit should be set to 1, so fixes it when
link status is down.
Secondly, change the return value of cpld_set_led_id to 0, which
means leave the cpld to control led blink frequece other than the
driver itself.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index aff9d77..8473287 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -86,9 +86,10 @@ static void hns_cpld_set_led(struct hns_mac_cb *mac_cb, int link_status,
 			mac_cb->cpld_led_value = value;
 		}
 	} else {
-		dsaf_write_syscon(mac_cb->cpld_ctrl, mac_cb->cpld_ctrl_reg,
-				  CPLD_LED_DEFAULT_VALUE);
-		mac_cb->cpld_led_value = CPLD_LED_DEFAULT_VALUE;
+		value = (mac_cb->cpld_led_value) & (0x1 << DSAF_LED_ANCHOR_B);
+		dsaf_write_syscon(mac_cb->cpld_ctrl,
+				  mac_cb->cpld_ctrl_reg, value);
+		mac_cb->cpld_led_value = value;
 	}
 }
 
@@ -114,7 +115,7 @@ static int cpld_set_led_id(struct hns_mac_cb *mac_cb,
 			     CPLD_LED_ON_VALUE);
 		dsaf_write_syscon(mac_cb->cpld_ctrl, mac_cb->cpld_ctrl_reg,
 				  mac_cb->cpld_led_value);
-		return 2;
+		break;
 	case HNAE_LED_INACTIVE:
 		dsaf_set_bit(mac_cb->cpld_led_value, DSAF_LED_ANCHOR_B,
 			     CPLD_LED_DEFAULT_VALUE);
@@ -122,7 +123,8 @@ static int cpld_set_led_id(struct hns_mac_cb *mac_cb,
 				  mac_cb->cpld_led_value);
 		break;
 	default:
-		break;
+		dev_err(mac_cb->dev, "invalid led state: %d!", status);
+		return -EINVAL;
 	}
 
 	return 0;
-- 
1.9.1

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 00/19] net: hns: fix some bugs in hns driver Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 08/19] net: hns: fix ethtool loopback fail bug Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 16/19] net: hns: fix bug that alloc skb fail lead to port unavailable Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
    Re: [PATCH net-next 16/19] net: hns: fix bug that alloc skb fail lead  to port unavailable Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-06-21 15:30 +0200
      Re: [PATCH net-next 16/19] net: hns: fix bug that alloc skb fail lead  to port unavailable Yisen Zhuang <Yisen.zhuang@huawei.com> - 2016-06-22 03:50 +0200
  [PATCH net-next 05/19] net: hns: Remove unnecessary device resource free Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 10/19] net: hns: bugfix about pfc pause frame statistics Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
    Re: [PATCH net-next 10/19] net: hns: bugfix about pfc pause frame  statistics Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-21 12:50 +0200
      Re: [PATCH net-next 10/19] net: hns: bugfix about pfc pause frame  statistics Yisen Zhuang <Yisen.zhuang@huawei.com> - 2016-06-22 03:50 +0200
        Re: [PATCH net-next 10/19] net: hns: bugfix about pfc pause frame  statistics Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-22 11:50 +0200
          Re: [PATCH net-next 10/19] net: hns: bugfix about pfc pause frame  statistics Yisen Zhuang <Yisen.zhuang@huawei.com> - 2016-06-23 07:50 +0200
  [PATCH net-next 18/19] net: hns: change the default coalesce usecs Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 04/19] net: hns: typo fix of annotation info for hns_nic_reset_subtask() Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 12/19] net: hns: fix bug of getting the wrong tcam data Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 15/19] net: hns: bug fix about led control logic when link down Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 03/19] net: hns: add skb_reset_mac_header() after skb being alloc Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 17/19] net: hns: fix sbm default parameters config error Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 02/19] net: hns: fix hns dsaf v1 dont support tx_pause close Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  [PATCH net-next 14/19] net: hns: delete redundancy ring enable operations Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-21 05:50 +0200
  Re: [PATCH net-next 00/19] net: hns: fix some bugs in hns driver David Miller <davem@davemloft.net> - 2016-06-21 11:00 +0200

csiph-web