From: "Rafał Miłecki" <zajec5@gmail.com>
To: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Cc: "Hauke Mehrtens" <hauke@hauke-m.de>, "Rafał Miłecki" <zajec5@gmail.com>
Subject: [PATCH 2/2] bgmac: use phy_mii_ioctl in ioctl handler
Date: Tue, 10 Dec 2013 10:49:26 +0100 [thread overview]
Message-ID: <1386668966-24562-2-git-send-email-zajec5@gmail.com> (raw)
In-Reply-To: <1386668966-24562-1-git-send-email-zajec5@gmail.com>
From: Hauke Mehrtens <hauke@hauke-m.de>
This works pretty much the same way, so avoid duplicating the code.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/net/ethernet/broadcom/bgmac.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index ad4b2f1..db71d75 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1187,27 +1187,11 @@ static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
{
struct bgmac *bgmac = netdev_priv(net_dev);
- struct mii_ioctl_data *data = if_mii(ifr);
-
- switch (cmd) {
- case SIOCGMIIPHY:
- data->phy_id = bgmac->phyaddr;
- /* fallthru */
- case SIOCGMIIREG:
- if (!netif_running(net_dev))
- return -EAGAIN;
- data->val_out = bgmac_phy_read(bgmac, data->phy_id,
- data->reg_num & 0x1f);
- return 0;
- case SIOCSMIIREG:
- if (!netif_running(net_dev))
- return -EAGAIN;
- bgmac_phy_write(bgmac, data->phy_id, data->reg_num & 0x1f,
- data->val_in);
- return 0;
- default:
- return -EOPNOTSUPP;
- }
+
+ if (!netif_running(net_dev))
+ return -EINVAL;
+
+ return phy_mii_ioctl(bgmac->phy_dev, ifr, cmd);
}
static const struct net_device_ops bgmac_netdev_ops = {
--
1.7.10.4
next prev parent reply other threads:[~2013-12-10 9:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 9:49 [PATCH 1/2] bgmac: drop duplicated PHY defines Rafał Miłecki
2013-12-10 9:49 ` Rafał Miłecki [this message]
2013-12-10 9:51 ` [PATCH 2/2] bgmac: use phy_mii_ioctl in ioctl handler Rafał Miłecki
2013-12-10 17:11 ` Florian Fainelli
2013-12-20 14:34 ` [RESEND][PATCH next " Rafał Miłecki
2013-12-27 18:28 ` David Miller
2013-12-10 17:10 ` [PATCH 1/2] bgmac: drop duplicated PHY defines Florian Fainelli
2013-12-10 17:36 ` Rafał Miłecki
2013-12-10 17:53 ` Florian Fainelli
2013-12-11 6:10 ` Rafał Miłecki
2013-12-20 14:33 ` [RESEND][PATCH next " Rafał Miłecki
2013-12-27 18:28 ` 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=1386668966-24562-2-git-send-email-zajec5@gmail.com \
--to=zajec5@gmail.com \
--cc=davem@davemloft.net \
--cc=hauke@hauke-m.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).