[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250829033141.1707-1-gongfan1@huawei.com>
Date: Fri, 29 Aug 2025 11:31:41 +0800
From: Fan Gong <gongfan1@...wei.com>
To: <vadim.fedorenko@...ux.dev>
CC: <andrew+netdev@...n.ch>, <christophe.jaillet@...adoo.fr>,
<corbet@....net>, <davem@...emloft.net>, <edumazet@...gle.com>,
<gongfan1@...wei.com>, <guoxin09@...wei.com>, <gur.stavi@...wei.com>,
<helgaas@...nel.org>, <horms@...nel.org>, <jdamato@...tly.com>,
<kuba@...nel.org>, <lee@...ger.us>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <luosifu@...wei.com>,
<meny.yossefi@...wei.com>, <mpe@...erman.id.au>, <netdev@...r.kernel.org>,
<pabeni@...hat.com>, <przemyslaw.kitszel@...el.com>,
<shenchenyang1@...ilicon.com>, <shijing34@...wei.com>, <sumang@...vell.com>,
<wulike1@...wei.com>, <zhoushuai28@...wei.com>, <zhuyikai1@...artners.com>
Subject: Re: [PATCH net-next v02 01/14] hinic3: HW initialization
> > +/* Get device attributes from HW. */
> > +static int get_hwif_attr(struct hinic3_hwdev *hwdev)
> > +{
> > + u32 attr0, attr1, attr2, attr3, attr6;
> > + struct hinic3_hwif *hwif;
> > +
> > + hwif = hwdev->hwif;
> > + attr0 = hinic3_hwif_read_reg(hwif, HINIC3_CSR_FUNC_ATTR0_ADDR);
> > + attr1 = hinic3_hwif_read_reg(hwif, HINIC3_CSR_FUNC_ATTR1_ADDR);
> > + attr2 = hinic3_hwif_read_reg(hwif, HINIC3_CSR_FUNC_ATTR2_ADDR);
> > + attr3 = hinic3_hwif_read_reg(hwif, HINIC3_CSR_FUNC_ATTR3_ADDR);
> > + attr6 = hinic3_hwif_read_reg(hwif, HINIC3_CSR_FUNC_ATTR6_ADDR);
> > + init_hwif_attr(&hwif->attr, attr0, attr1, attr2, attr3, attr6);
>
> well, get_hwif_attr() name is misleading here, as the function doesn't
> only read values, it also sets some of them. if there is no other users
> of init function, it might be better to merge them.
Thanks for your comments.
"get_hwif_attr" is actually misleading. In next version We consider
changing this to "init_hwif_attr" and the old "init_hwif_attr" will
be replaced with "set_hwif_attr" for better readability.
> > +
> > + return 0;
>
> there is no way the function can return error - what's the reason to
> have return value?
This is our oversight on error handling and patch splitting. We missed
the error case for "hinic3_hwif_read_reg" that returns errors when
PCIE_LINK_DOWN.
Powered by blists - more mailing lists