From: Francois Romieu <romieu@fr.zoreil.com>
To: liujunliang_ljl@163.com
Cc: davem@davemloft.net, horms@verge.net.au, joe@perches.com,
gregkh@linuxfoundation.org, netdev@vger.kernel.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
sunhecheng@vip.126.com
Subject: Re: [PATCH] USB2NET : SR9700 : One Chip USB 1.1 USB2NET SR9700 Device Driver Support
Date: Fri, 30 Aug 2013 01:06:53 +0200 [thread overview]
Message-ID: <20130829230653.GB12124@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <1377746832-6201-1-git-send-email-liujunliang_ljl@163.com>
Keep it small though literate.
---
drivers/net/usb/sr9700.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
index f7f46e6..3f05b35 100644
--- a/drivers/net/usb/sr9700.c
+++ b/drivers/net/usb/sr9700.c
@@ -71,31 +71,25 @@ static void sr_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
static int wait_phy_eeprom_ready(struct usbnet *dev, int phy)
{
- int i, ret;
+ int i;
- ret = 0;
for (i = 0; i < SR_SHARE_TIMEOUT; i++) {
u8 tmp = 0;
+ int ret;
udelay(1);
ret = sr_read_reg(dev, EPCR, &tmp);
if (ret < 0)
- goto out;
+ return ret;
/* ready */
- if ((tmp & EPCR_ERRE) == 0)
- break;
+ if (!(tmp & EPCR_ERRE))
+ return 0;
}
- if (i >= SR_SHARE_TIMEOUT) {
- netdev_err(dev->net, "%s write timed out!\n",
- phy ? "phy" : "eeprom");
- ret = -EIO;
- goto out;
- }
+ netdev_err(dev->net, "%s write timed out!\n", phy ? "phy" : "eeprom");
-out:
- return ret;
+ return -EIO;
}
static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg,
@@ -110,7 +104,7 @@ static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg,
ret = wait_phy_eeprom_ready(dev, phy);
if (ret < 0)
- goto out;
+ goto out_unlock;
sr_write_reg(dev, EPCR, 0x0);
ret = sr_read(dev, EPDR, 2, value);
@@ -118,7 +112,7 @@ static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg,
netdev_dbg(dev->net, "read shared %d 0x%02x returned 0x%04x, %d\n",
phy, reg, *value, ret);
-out:
+out_unlock:
mutex_unlock(&dev->phy_mutex);
return ret;
}
@@ -132,18 +126,18 @@ static int sr_share_write_word(struct usbnet *dev, int phy, u8 reg,
ret = sr_write(dev, EPDR, 2, &value);
if (ret < 0)
- goto out;
+ goto out_unlock;
sr_write_reg(dev, EPAR, phy ? (reg | 0x40) : reg);
sr_write_reg(dev, EPCR, phy ? 0x1a : 0x12);
ret = wait_phy_eeprom_ready(dev, phy);
if (ret < 0)
- goto out;
+ goto out_unlock;
sr_write_reg(dev, EPCR, 0x0);
-out:
+out_unlock:
mutex_unlock(&dev->phy_mutex);
return ret;
}
--
1.8.3.1
next prev parent reply other threads:[~2013-08-29 23:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-29 3:27 liujunliang_ljl
2013-08-29 23:06 ` Francois Romieu
2013-08-30 4:42 ` Joe Perches
2013-08-29 23:06 ` Francois Romieu [this message]
2013-08-29 23:06 ` Francois Romieu
2013-08-30 21:30 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2013-08-24 11:26 [PATCH] USB2NET : SR9700 : One chip " liujunliang_ljl
2013-08-24 18:15 ` Joe Perches
2013-08-28 21:43 ` David Miller
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=20130829230653.GB12124@electric-eye.fr.zoreil.com \
--to=romieu@fr.zoreil.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=horms@verge.net.au \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=liujunliang_ljl@163.com \
--cc=netdev@vger.kernel.org \
--cc=sunhecheng@vip.126.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®