All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net:cpsw: Pass unhandled ioctl's on to generic phy ioctl
@ 2014-02-13 14:26 Stefan Sørensen
  2014-02-13 20:40 ` Ben Hutchings
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Sørensen @ 2014-02-13 14:26 UTC (permalink / raw)
  To: mugunthanvnm, davem, netdev; +Cc: Stefan Sørensen

This patch allows the use of a generic timestamping phy connected
to the cpsw if CPTS support is not enabled. This also adds support
of the SIOCGMIIREG and SIOCSMIIREG, and moves handling of SIOCGMIIPHY
to the generic driver.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
---
Changes since v1:
  - Remove SIOCGMIIPHY from cpsw
  - Mention that SIOCGMIIREG and SIOCSMIIREG support is gained

 drivers/net/ethernet/ti/cpsw.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 1d860ce..6ecea1d 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1471,7 +1471,6 @@ static int cpsw_hwtstamp_get(struct net_device *dev, struct ifreq *ifr)
 static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
 {
 	struct cpsw_priv *priv = netdev_priv(dev);
-	struct mii_ioctl_data *data = if_mii(req);
 	int slave_no = cpsw_slave_index(priv);
 
 	if (!netif_running(dev))
@@ -1484,14 +1483,11 @@ static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
 	case SIOCGHWTSTAMP:
 		return cpsw_hwtstamp_get(dev, req);
 #endif
-	case SIOCGMIIPHY:
-		data->phy_id = priv->slaves[slave_no].phy->addr;
-		break;
-	default:
-		return -ENOTSUPP;
 	}
 
-	return 0;
+	if (!priv->slaves[slave_no].phy)
+		return -EINVAL;
+	return phy_mii_ioctl(priv->slaves[slave_no].phy, req, cmd);
 }
 
 static void cpsw_ndo_tx_timeout(struct net_device *ndev)
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] net:cpsw: Pass unhandled ioctl's on to generic phy ioctl
  2014-02-13 14:26 [PATCH v2] net:cpsw: Pass unhandled ioctl's on to generic phy ioctl Stefan Sørensen
@ 2014-02-13 20:40 ` Ben Hutchings
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2014-02-13 20:40 UTC (permalink / raw)
  To: Stefan Sørensen; +Cc: mugunthanvnm, davem, netdev

[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]

On Thu, 2014-02-13 at 15:26 +0100, Stefan Sørensen wrote:
> This patch allows the use of a generic timestamping phy connected
> to the cpsw if CPTS support is not enabled. This also adds support
> of the SIOCGMIIREG and SIOCSMIIREG, and moves handling of SIOCGMIIPHY
> to the generic driver.
> 
> Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
> ---
> Changes since v1:
>   - Remove SIOCGMIIPHY from cpsw
>   - Mention that SIOCGMIIREG and SIOCSMIIREG support is gained
> 
>  drivers/net/ethernet/ti/cpsw.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index 1d860ce..6ecea1d 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -1471,7 +1471,6 @@ static int cpsw_hwtstamp_get(struct net_device *dev, struct ifreq *ifr)
>  static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
>  {
>  	struct cpsw_priv *priv = netdev_priv(dev);
> -	struct mii_ioctl_data *data = if_mii(req);
>  	int slave_no = cpsw_slave_index(priv);
>  
>  	if (!netif_running(dev))
> @@ -1484,14 +1483,11 @@ static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
>  	case SIOCGHWTSTAMP:
>  		return cpsw_hwtstamp_get(dev, req);
>  #endif
> -	case SIOCGMIIPHY:
> -		data->phy_id = priv->slaves[slave_no].phy->addr;
> -		break;
> -	default:
> -		return -ENOTSUPP;
>  	}
>  
> -	return 0;
> +	if (!priv->slaves[slave_no].phy)
> +		return -EINVAL;

Sorry I didn't spot this before - the error code here should be
-EOPNOTSUPP.

(Note this is different from -ENOTSUPP as was used before.  That's an
NFS error code that shouldn't be seen by userland.)

Ben.

> +	return phy_mii_ioctl(priv->slaves[slave_no].phy, req, cmd);
>  }
>  
>  static void cpsw_ndo_tx_timeout(struct net_device *ndev)

-- 
Ben Hutchings
The world is coming to an end.	Please log off.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-13 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13 14:26 [PATCH v2] net:cpsw: Pass unhandled ioctl's on to generic phy ioctl Stefan Sørensen
2014-02-13 20:40 ` Ben Hutchings

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.