From: Andrew Lunn <andrew@lunn.ch>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: netdev@vger.kernel.org, mengyuanlou@net-swift.com
Subject: Re: [PATCH net v2 2/5] net: ngbe: Remove structure ngbe_hw
Date: Wed, 21 Dec 2022 14:55:52 +0100 [thread overview]
Message-ID: <Y6MQaAP8OMtmRD3u@lunn.ch> (raw)
In-Reply-To: <20221214064133.2424570-3-jiawenwu@trustnetic.com>
On Wed, Dec 14, 2022 at 02:41:30PM +0800, Jiawen Wu wrote:
> Remove useless structure ngbe_hw to make the codes clear.
Thanks for splitting this up. It makes it a lot easier to review.
> -static int ngbe_reset_misc(struct ngbe_hw *hw)
> +static int ngbe_reset_misc(struct ngbe_adapter *adapter)
> {
> - struct wx_hw *wxhw = &hw->wxhw;
> + struct wx_hw *wxhw = &adapter->wxhw;
>
> wx_reset_misc(wxhw);
> - if (hw->mac_type == ngbe_mac_type_rgmii)
> + if (adapter->mac_type == ngbe_mac_type_rgmii)
> wr32(wxhw, NGBE_MDIO_CLAUSE_SELECT, 0xF);
> - if (hw->gpio_ctrl) {
> + if (adapter->gpio_ctrl) {
> /* gpio0 is used to power on/off control*/
> wr32(wxhw, NGBE_GPIO_DDR, 0x1);
> wr32(wxhw, NGBE_GPIO_DR, NGBE_GPIO_DR_0);
> -static void txgbe_reset_misc(struct txgbe_hw *hw)
> +static void txgbe_reset_misc(struct wx_hw *wxhw)
> {
> - struct wx_hw *wxhw = &hw->wxhw;
> -
> wx_reset_misc(wxhw);
> - txgbe_init_thermal_sensor_thresh(hw);
> + txgbe_init_thermal_sensor_thresh(wxhw);
> }
The names suggest these two functions do the same thing. So it would
be nice if the parameter naming and structure names where
similar. Maybe consider renaming struct wx_hw to txgbe_adaptor? And
wxhw to adaptor? Then the two drivers would look more like each
other. When they look like each other it then becomes easier to see
identical code and move it into the library.
You can do this as a follow up series. Please submit these patches
once net-dev reopens.
Andrew
next prev parent reply other threads:[~2022-12-21 13:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 6:41 [PATCH net v2 0/5] net: wangxun: Adjust code structure Jiawen Wu
2022-12-14 6:41 ` [PATCH net v2 1/5] net: txgbe: Remove structure txgbe_hw Jiawen Wu
2022-12-14 6:41 ` [PATCH net v2 2/5] net: ngbe: Remove structure ngbe_hw Jiawen Wu
2022-12-21 13:55 ` Andrew Lunn [this message]
2022-12-14 6:41 ` [PATCH net v2 3/5] net: txgbe: Move defines into unified file Jiawen Wu
2022-12-14 6:41 ` [PATCH net v2 4/5] net: ngbe: " Jiawen Wu
2022-12-14 6:41 ` [PATCH net v2 5/5] net: wangxun: Move MAC address handling to libwx Jiawen Wu
2022-12-14 7:58 ` [PATCH net v2 0/5] net: wangxun: Adjust code structure Leon Romanovsky
2022-12-14 16:44 ` Alexander H Duyck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y6MQaAP8OMtmRD3u@lunn.ch \
--to=andrew@lunn.ch \
--cc=jiawenwu@trustnetic.com \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).