Re: [PATCH net-next 2/3] r8152: modify rtl_ops_init

From: Grant Grundler
Date: Wed Jun 01 2016 - 21:50:21 EST


Hayes Wang <hayeswang <at> realtek.com> writes:
> Replace using VID/PID with using tp->version to initialize the ops.

Hayes,
This patch breaks new HW with existing drivers. more below.

>
> Signed-off-by: Hayes Wang <hayeswang <at> realtek.com>
> ---
> drivers/net/usb/r8152.c | 79 ++++++++++++++++++--------------------------
-----
> 1 file changed, 28 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 4b6db8a..cf1b8a7 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> <at> <at> -3742,66 +3742,43 <at> <at> static void
rtl8153_unload(struct r8152 *tp)
> r8153_power_cut_en(tp, false);
> }
>
> -static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
> +static int rtl_ops_init(struct r8152 *tp)
> {
> struct rtl_ops *ops = &tp->rtl_ops;
> - int ret = -ENODEV;
> -
> - switch (id->idVendor) {
> - case VENDOR_ID_REALTEK:
> - switch (id->idProduct) {
...
> default:
> + ret = -ENODEV;
> + netif_err(tp, probe, tp->netdev, "Unknown Device\n");

This hunk causes r8152 driver to refuse to bind to a device that was working
(AFAICT) before this change. This means every new version of the HW
requires a driver update for every kernel in every distribution that
incorporates this patch.

I've tried to "align" chromeos-3.18 branch with kernel.org r8152 driver:

I'm getting this output in dmesg:
r8152 2-1:1.0 (unnamed net_device) (uninitialized): Unknown version 0x6010
r8152 2-1:1.0 (unnamed net_device) (uninitialized): Unknown Device

Could you take a look at the hack I've uploaded for chromeos-3.18 kernel:
https://chromium-review.googlesource.com/348951

cheers,
grant