From: Hao Chen Date: Fri, 3 Dec 2021 09:20:56 +0000 (+0800) Subject: net: hns3: add comments for hclge_dbg_fill_content() X-Git-Tag: v6.6.17~8491^2~265^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e599dddeea443fc27716a794c2684b2980735c8;p=platform%2Fkernel%2Flinux-rpi.git net: hns3: add comments for hclge_dbg_fill_content() When we use hclge_dbg_fill_content() to fill contents with specific format according to struct hclge_dbg_item *items, it may cause content cover due to unreasonable items. So add comments to explain how to avoid it. Signed-off-by: Hao Chen Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c index 1579ca3..2557e81 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -77,6 +77,10 @@ static const struct hclge_dbg_reg_type_info hclge_dbg_reg_info[] = { .cmd = HCLGE_OPC_DFX_TQP_REG } }, }; +/* make sure: len(name) + interval >= maxlen(item data) + 2, + * for example, name = "pkt_num"(len: 7), the prototype of item data is u32, + * and print as "%u"(maxlen: 10), so the interval should be at least 5. + */ static void hclge_dbg_fill_content(char *content, u16 len, const struct hclge_dbg_item *items, const char **result, u16 size)