public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Einon <mark.einon@gmail.com>
To: gregkh@suse.de
Cc: greg@kroah.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, o.hartmann@telovital.com,
	Mark Einon <mark.einon@gmail.com>
Subject: [PATCH 1/3] staging: et131x: converting et131x_ioctl to use phy_mii_ioctl
Date: Tue, 30 Aug 2011 12:47:22 +0100	[thread overview]
Message-ID: <1314704844-5643-1-git-send-email-mark.einon@gmail.com> (raw)

Handing over ioctls handled by the driver to the phydev.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et131x_netdev.c |   56 ++-----------------------------
 1 files changed, 4 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index ce21433..d12e05e 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -208,47 +208,6 @@ int et131x_close(struct net_device *netdev)
 }
 
 /**
- * et131x_ioctl_mii - The function which handles MII IOCTLs
- * @netdev: device on which the query is being made
- * @reqbuf: the request-specific data buffer
- * @cmd: the command request code
- *
- * Returns 0 on success, errno on failure (as defined in errno.h)
- */
-int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
-{
-	int status = 0;
-	struct et131x_adapter *adapter = netdev_priv(netdev);
-	struct mii_ioctl_data *data = if_mii(reqbuf);
-
-	switch (cmd) {
-	case SIOCGMIIPHY:
-		data->phy_id = adapter->stats.xcvr_addr;
-		break;
-
-	case SIOCGMIIREG:
-		if (!capable(CAP_NET_ADMIN))
-			status = -EPERM;
-		else
-			status = et131x_mii_read(adapter,
-					data->reg_num, &data->val_out);
-		break;
-
-	case SIOCSMIIREG:
-		if (!capable(CAP_NET_ADMIN))
-			status = -EPERM;
-		else
-			status = et131x_mii_write(adapter, data->reg_num,
-					 data->val_in);
-		break;
-
-	default:
-		status = -EOPNOTSUPP;
-	}
-	return status;
-}
-
-/**
  * et131x_ioctl - The I/O Control handler for the driver
  * @netdev: device on which the control request is being made
  * @reqbuf: a pointer to the IOCTL request buffer
@@ -258,19 +217,12 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
  */
 int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
 {
-	int status = 0;
+	struct et131x_adapter *adapter = netdev_priv(netdev);
 
-	switch (cmd) {
-	case SIOCGMIIPHY:
-	case SIOCGMIIREG:
-	case SIOCSMIIREG:
-		status = et131x_ioctl_mii(netdev, reqbuf, cmd);
-		break;
+	if (!adapter->phydev)
+		return -EINVAL;
 
-	default:
-		status = -EOPNOTSUPP;
-	}
-	return status;
+	return phy_mii_ioctl(adapter->phydev, reqbuf, cmd);
 }
 
 /**
-- 
1.7.6


             reply	other threads:[~2011-08-30 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 11:47 Mark Einon [this message]
2011-08-30 11:47 ` [PATCH 2/3] staging: et131x: Remove xcvr_addr and et131x_xcvr_find Mark Einon
2011-08-30 11:47 ` [PATCH 3/3] staging: et131x: Remove redundant phy code Mark Einon

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=1314704844-5643-1-git-send-email-mark.einon@gmail.com \
    --to=mark.einon@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.hartmann@telovital.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