Re: [PATCH net-next v5 04/13] ax88179_178a: Add HW support for AX179A-based chips

Andrew Lunn <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kernel,org.kernel.vger.linux-usb
Message-ID <[email protected]>
This is more of a nitpick, given how much work you have already done
on this driver. I think designated initializer syntax could make this
more readable:

num ax_bulk_in_speeds {
	BULK_IN_SPEED_1G_SS = 0,
	BULK_IN_SPEED_1G_HS   = 1,
	BULK_IN_SPEED_100_FULL_SS = 2,
	BULK_IN_SPEED_100_HALF_SS = 3,
 ...
};


> +static const struct ax_bulkin_settings AX88179A_BULKIN_SIZE[] = {
 [BULK_IN_SPEED_1G_SS] = {5, 0x7B, 0x00, 0x17, 0x0F},
 [BULK_IN_SPEED_1G_HS] = {5, 0xC0, 0x02, 0x06, 0x0F},

> +static void ax88179a_bulkin_config(struct usbnet *dev, u8 link_sts)
> +{
> +	struct ax88179_data *ax179_data = dev->driver_priv;
> +	const struct ax_bulkin_settings *bulkin_data;
> +	int index = 0;
> +
> +	switch (ax179_data->speed) {
> +	case ETHER_LINK_2500:	/* AX88279 only */
> +		index = BULK_IN_SPEED_2500;
> +		break;
> +
> +	case ETHER_LINK_1000:	/* AX88279 & AX88178A */
> +		if (ax179_data->chip_version == AX_VERSION_AX88279) {
> +			if (link_sts & AX_USB_SS)
> +				index = BULK_IN_SPEED_1G_SS;
> +			else if (link_sts & AX_USB_HS)
> +				index = BULK_IN_SPEED_HS;

This removes the 1, 2, 3, etc making the relationship more obvious.

     Andrew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.