Commit d039ef68 authored by Kees Cook's avatar Kees Cook Committed by David S. Miller

net: hns: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. Switches test of .data field to
.function, since .data will be going away.

Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
Cc: Salil Mehta <salil.mehta@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: lipeng <lipeng321@huawei.com>
Cc: Lin Yun Sheng <linyunsheng@huawei.com>
Cc: Kejian Yan <yankejian@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e84a2ac9
...@@ -2159,9 +2159,9 @@ static void hns_nic_task_schedule(struct hns_nic_priv *priv) ...@@ -2159,9 +2159,9 @@ static void hns_nic_task_schedule(struct hns_nic_priv *priv)
(void)schedule_work(&priv->service_task); (void)schedule_work(&priv->service_task);
} }
static void hns_nic_service_timer(unsigned long data) static void hns_nic_service_timer(struct timer_list *t)
{ {
struct hns_nic_priv *priv = (struct hns_nic_priv *)data; struct hns_nic_priv *priv = from_timer(priv, t, service_timer);
(void)mod_timer(&priv->service_timer, jiffies + SERVICE_TIMER_HZ); (void)mod_timer(&priv->service_timer, jiffies + SERVICE_TIMER_HZ);
...@@ -2451,8 +2451,7 @@ static int hns_nic_dev_probe(struct platform_device *pdev) ...@@ -2451,8 +2451,7 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
/* carrier off reporting is important to ethtool even BEFORE open */ /* carrier off reporting is important to ethtool even BEFORE open */
netif_carrier_off(ndev); netif_carrier_off(ndev);
setup_timer(&priv->service_timer, hns_nic_service_timer, timer_setup(&priv->service_timer, hns_nic_service_timer, 0);
(unsigned long)priv);
INIT_WORK(&priv->service_task, hns_nic_service_task); INIT_WORK(&priv->service_task, hns_nic_service_task);
set_bit(NIC_STATE_SERVICE_INITED, &priv->state); set_bit(NIC_STATE_SERVICE_INITED, &priv->state);
......
...@@ -2350,11 +2350,11 @@ static int hclge_get_status(struct hnae3_handle *handle) ...@@ -2350,11 +2350,11 @@ static int hclge_get_status(struct hnae3_handle *handle)
return hdev->hw.mac.link; return hdev->hw.mac.link;
} }
static void hclge_service_timer(unsigned long data) static void hclge_service_timer(struct timer_list *t)
{ {
struct hclge_dev *hdev = (struct hclge_dev *)data; struct hclge_dev *hdev = from_timer(hdev, t, service_timer);
(void)mod_timer(&hdev->service_timer, jiffies + HZ);
mod_timer(&hdev->service_timer, jiffies + HZ);
hclge_task_schedule(hdev); hclge_task_schedule(hdev);
} }
...@@ -3204,7 +3204,7 @@ static int hclge_ae_start(struct hnae3_handle *handle) ...@@ -3204,7 +3204,7 @@ static int hclge_ae_start(struct hnae3_handle *handle)
/* mac enable */ /* mac enable */
hclge_cfg_mac_mode(hdev, true); hclge_cfg_mac_mode(hdev, true);
clear_bit(HCLGE_STATE_DOWN, &hdev->state); clear_bit(HCLGE_STATE_DOWN, &hdev->state);
(void)mod_timer(&hdev->service_timer, jiffies + HZ); mod_timer(&hdev->service_timer, jiffies + HZ);
ret = hclge_mac_start_phy(hdev); ret = hclge_mac_start_phy(hdev);
if (ret) if (ret)
...@@ -4436,8 +4436,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) ...@@ -4436,8 +4436,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
hclge_dcb_ops_set(hdev); hclge_dcb_ops_set(hdev);
setup_timer(&hdev->service_timer, hclge_service_timer, timer_setup(&hdev->service_timer, hclge_service_timer, 0);
(unsigned long)hdev);
INIT_WORK(&hdev->service_task, hclge_service_task); INIT_WORK(&hdev->service_task, hclge_service_task);
set_bit(HCLGE_STATE_SERVICE_INITED, &hdev->state); set_bit(HCLGE_STATE_SERVICE_INITED, &hdev->state);
...@@ -4464,7 +4463,7 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev) ...@@ -4464,7 +4463,7 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
if (IS_ENABLED(CONFIG_PCI_IOV)) if (IS_ENABLED(CONFIG_PCI_IOV))
hclge_disable_sriov(hdev); hclge_disable_sriov(hdev);
if (hdev->service_timer.data) if (hdev->service_timer.function)
del_timer_sync(&hdev->service_timer); del_timer_sync(&hdev->service_timer);
if (hdev->service_task.func) if (hdev->service_task.func)
cancel_work_sync(&hdev->service_task); cancel_work_sync(&hdev->service_task);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment