From: "Freddy" <freddy@asix.com.tw>
To: "'Christian Riesch'" <christian.riesch@omicron.at>
Cc: "'Ming Lei'" <ming.lei@canonical.com>, <davem@davemloft.net>,
<linux-kernel@vger.kernel.org>, <louis@asix.com.tw>,
<netdev@vger.kernel.org>, <linux-usb@vger.kernel.org>
Subject: RE: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver
Date: Fri, 11 Jan 2013 17:30:19 +0800 [thread overview]
Message-ID: <00af01cdefde$46ecbab0$d4c63010$@asix.com.tw> (raw)
In-Reply-To: <50EFCAE6.9070306@omicron.at>
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;
>> +}
>> +
prev parent reply other threads:[~2013-01-11 9:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 1:17 [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver freddy
2013-01-11 2:45 ` Ming Lei
2013-01-11 5:14 ` David Miller
2013-01-11 8:18 ` Christian Riesch
2013-01-11 9:30 ` Freddy [this message]
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='00af01cdefde$46ecbab0$d4c63010$@asix.com.tw' \
--to=freddy@asix.com.tw \
--cc=christian.riesch@omicron.at \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=louis@asix.com.tw \
--cc=ming.lei@canonical.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.