From dd48f05330b11da1b504d6cf7887815608187511 Mon Sep 17 00:00:00 2001 From: Yunsheng Lin Date: Tue, 23 Apr 2019 18:36:03 +0800 Subject: [PATCH] net: hns3: fix kernel-module hns compile error for 5.1 driver inclusion category: bugfix bugzilla: NA CVE: NA fix compile error because of below error: commit 750afb08ca71 ("cross-tree: phase out dma_zalloc_coherent()") Author: Luis Chamberlain Date: Fri Jan 4 09:23:09 2019 +0100 cross-tree: phase out dma_zalloc_coherent() We already need to zero out memory for dma_alloc_coherent(), as such using dma_zalloc_coherent() is superfluous. Phase it out. This change was generated with the following Coccinelle SmPL patch: @ replace_dma_zalloc_coherent @ expression dev, size, data, handle, flags; @@ -dma_zalloc_coherent(dev, size, handle, flags) +dma_alloc_coherent(dev, size, handle, flags) Suggested-by: Christoph Hellwig Signed-off-by: Luis Chamberlain [hch: re-ran the script on the latest tree] Signed-off-by: Christoph Hellwig Signed-off-by: Yunsheng Lin Reviewed-by: lipeng Reviewed-by: Hanjun Guo Signed-off-by: Yang Yingliang --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 1 + drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c | 1 + drivers/net/ethernet/hisilicon/hns3/kcompat.h | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c index eaea8783aa3b..7c26d2c18790 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c @@ -7,6 +7,7 @@ #include #include #include +#include "kcompat.h" #include "hclge_cmd.h" #include "hnae3.h" #include "hclge_main.h" diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c index ca97218ddbd8..d8922e9c960f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c @@ -7,6 +7,7 @@ #include #include #include +#include "kcompat.h" #include "hclgevf_cmd.h" #include "hclgevf_main.h" #include "hnae3.h" diff --git a/drivers/net/ethernet/hisilicon/hns3/kcompat.h b/drivers/net/ethernet/hisilicon/hns3/kcompat.h index 732fa14141ac..472c1e99e628 100644 --- a/drivers/net/ethernet/hisilicon/hns3/kcompat.h +++ b/drivers/net/ethernet/hisilicon/hns3/kcompat.h @@ -403,4 +403,10 @@ static inline void linkmode_clear_bit(int nr, volatile unsigned long *addr) #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) +#ifndef dma_zalloc_coherent +#define dma_zalloc_coherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) +#endif +#endif + #endif -- GitLab