[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y6MQaAP8OMtmRD3u@lunn.ch>
Date: Wed, 21 Dec 2022 14:55:52 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Jiawen Wu <jiawenwu@...stnetic.com>
Cc: netdev@...r.kernel.org, mengyuanlou@...-swift.com
Subject: Re: [PATCH net v2 2/5] net: ngbe: Remove structure ngbe_hw
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
Powered by blists - more mailing lists