From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754780Ab3AKJoO (ORCPT ); Fri, 11 Jan 2013 04:44:14 -0500 Received: from asix.com.tw ([210.243.224.51]:60474 "EHLO asix.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753456Ab3AKJoM (ORCPT ); Fri, 11 Jan 2013 04:44:12 -0500 X-Greylist: delayed 730 seconds by postgrey-1.27 at vger.kernel.org; Fri, 11 Jan 2013 04:44:10 EST From: "Freddy" To: "'Christian Riesch'" Cc: "'Ming Lei'" , , , , , References: <1357867046-22918-1-git-send-email-freddy@asix.com.tw> <50EFCAE6.9070306@omicron.at> In-Reply-To: <50EFCAE6.9070306@omicron.at> 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 Message-ID: <00af01cdefde$46ecbab0$d4c63010$@asix.com.tw> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHoIm6QFKOHMZDeXM4LzefVdonIoAGaLxvNAnE6xhuX7xViEA== Content-Language: zh-tw Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; >> +} >> +