Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1741793
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net-next RFC 5/9] net: dsa: forward hardware timestamping ioctls to switch driver |
| Date | 2017-09-28 21:40 +0200 |
| Message-ID | <uuMP8-4CX-21@gated-at.bofh.it> (permalink) |
| References | <uuIVb-2ep-3@gated-at.bofh.it> <uuJ4S-2hz-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Brandon,
Brandon Streiff <brandon.streiff@ni.com> writes:
> static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
> {
> + struct dsa_slave_priv *p = netdev_priv(dev);
> + struct dsa_switch *ds = p->dp->ds;
> + int port = p->dp->index;
> +
> if (!dev->phydev)
> return -ENODEV;
Move this check below:
>
> - return phy_mii_ioctl(dev->phydev, ifr, cmd);
> + switch (cmd) {
> + case SIOCGMIIPHY:
> + case SIOCGMIIREG:
> + case SIOCSMIIREG:
> + if (dev->phydev)
> + return phy_mii_ioctl(dev->phydev, ifr, cmd);
> + else
> + return -EOPNOTSUPP;
if (!dev->phydev)
return -ENODEV;
return phy_mii_ioctl(dev->phydev, ifr, cmd);
> + case SIOCGHWTSTAMP:
> + if (ds->ops->port_hwtstamp_get)
> + return ds->ops->port_hwtstamp_get(ds, port, ifr);
> + else
> + return -EOPNOTSUPP;
Here you can replace the else statement with break;
> + case SIOCSHWTSTAMP:
> + if (ds->ops->port_hwtstamp_set)
> + return ds->ops->port_hwtstamp_set(ds, port, ifr);
> + else
> + return -EOPNOTSUPP;
Same here;
> + default:
> + return -EOPNOTSUPP;
> + }
Then drop the default case and return -EOPNOTSUPP after the switch.
> }
Thanks,
Vivien
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH net-next RFC 5/9] net: dsa: forward hardware timestamping ioctls to switch driver Brandon Streiff <brandon.streiff@ni.com> - 2017-09-28 17:40 +0200 Re: [PATCH net-next RFC 5/9] net: dsa: forward hardware timestamping ioctls to switch driver Florian Fainelli <f.fainelli@gmail.com> - 2017-09-28 19:30 +0200 Re: [PATCH net-next RFC 5/9] net: dsa: forward hardware timestamping ioctls to switch driver Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-28 21:40 +0200
csiph-web