RE: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

>> +static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16
index,
>> +                           u16 size, void *data) {
>> +       int ret;
>> +       ret = usbnet_read_cmd(dev, cmd,
>> +                              USB_DIR_IN | USB_TYPE_VENDOR |
USB_RECIP_DEVICE,
>> +                              value, index, data, size);
>> +
>> +       if (ret != size && ret >= 0)
>> +               return -EINVAL;
>> +       return ret;
>> +}
>> +
>> +static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16
index,
>> +                            u16 size, void *data) {
>> +       return usbnet_write_cmd(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR
>> +                               | USB_RECIP_DEVICE, value, index, 
>> +data, size); }
>> +
>> +static void
>> +ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16
index,
>> +                                   u16 size, void *data) {
>> +       usbnet_write_cmd_async(dev, cmd,
>> +                              USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_DEVICE,
>> +                              value, index, data, size); }
>> +

ax88179_read_cmd, ax88179_write_cmd, and ax88179_write_cmd_async duplicate
code from asix_common.c.

Do you mean that I should merge this driver into asix_common and
asix_devices, or just reuse the functions that had been implemented?

[...]

>> +static int ax88179_get_eeprom(struct net_device *net,
>> +                             struct ethtool_eeprom *eeprom, u8 
>> +*data) {
>> +       struct usbnet *dev = netdev_priv(net);
>> +       u16 *ebuf = (u16 *)data;
>> +       int i;
>> +
>> +       /* Crude hack to ensure that we don't overwrite memory
>> +        * if an odd length is supplied

Have a look at asix_get_eeprom() in asix_common.c for a better
implementation. There is also code for programming the eeprom
(asix_set_eeprom in asix_common.c), can this be used for the AX88179/178A as
well?

Thanks, I will check whether the eeprom access functions in asix_common.c
can be used in the driver or not.

Regards, Freddy

>> +        */
>> +       if (eeprom->len % 2)
>> +               return -EINVAL;
>> +
>> +       /* ax8817x returns 2 bytes from eeprom on read */
>> +       for (i = 0; i < eeprom->len / 2; i++) {
>> +               if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM,
>> +                       eeprom->offset + i, 1, 2, &ebuf[i]) < 0)
>> +                       return -EINVAL;
>> +       }
>> +       return 0;
>> +}
>> +

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux