On Fri, May 07, 2021 at 09:16:20PM +0900, Benjamin Poirier wrote:
On 2021-05-07 09:32 +0800, Coiby Xu wrote:
[...]
> > > * fix weird line wrapping (all over, ex. the ql_set_routing_reg() calls in
> > > qlge_set_multicast_list()).
> >
> > This issue of weird line wrapping is supposed to be all over. But I can
> > only find the ql_set_routing_reg() calls in qlge_set_multicast_list have
> > this problem,
> >
> > if (qlge_set_routing_reg
> > (qdev, RT_IDX_PROMISCUOUS_SLOT, RT_IDX_VALID, 1)) {
> >
> > I can't find other places where functions calls put square and arguments
> > in the new line. Could you give more hints?
>
> Here are other examples of what I would call weird line wrapping:
>
> status = qlge_validate_flash(qdev,
> sizeof(struct flash_params_8000) /
> sizeof(u16),
> "8000");
Oh, I also found this one but I think it more fits another TODO item,
i.e., "* fix weird indentation (all over, ex. the for loops in
qlge_get_stats())".
>
> status = qlge_wait_reg_rdy(qdev,
> XGMAC_ADDR, XGMAC_ADDR_RDY, XGMAC_ADDR_XME);
>
> [...]
Do you mean we should change it as follows,
status = qlge_wait_reg_rdy(qdev, XGMAC_ADDR, XGMAC_ADDR_RDY,
XGMAC_ADDR_XME);
status = qlge_wait_reg_rdy(qdev, XGMAC_ADDR, XGMAC_ADDR_RDY,
XGMAC_ADDR_XME);
Thanks! This is what I meant, i.e. qdev is aligned with XGMAC_ADDR_XME.
Somehow when replying in the editor, the format is different from view
mode. So I made a mistake by manually adding spaces to XGMAC_ADDR_XME
to make it appear aligned with qdev in the editor.
"V=" in vim could detect some indentation problems but not the line
wrapping issue. So I just scanned the code manually to find this issue. Do
you know there is a tool that could check if the code fits the kernel
coding style?
See Documentation/process/coding-style.rst section 9.
Great. clang-format is exactly what I need. It could detect the above
qlge_wait_reg_rdy issue and even automatically fix the issue. I will run
clang-format after finishing other TODO items.
You can search online for info about how to configure vim for the kernel
coding style, ex:
https://stackoverflow.com/questions/33676829/vim-configuration-for-linux-kernel-development
Thanks. I'll use https://github.com/vivien/vim-linux-coding-style:)
--
Best regards,
Coiby