lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGVrzcbXb7OkCWe_MiMbcX9vF+=6cWhvRRucoNe9EZKp8xbEFA@mail.gmail.com>
Date:	Tue, 10 Dec 2013 09:11:46 -0800
From:	Florian Fainelli <f.fainelli@...il.com>
To:	Rafał Miłecki <zajec5@...il.com>
Cc:	netdev <netdev@...r.kernel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Hauke Mehrtens <hauke@...ke-m.de>
Subject: Re: [PATCH 2/2] bgmac: use phy_mii_ioctl in ioctl handler

2013/12/10 Rafał Miłecki <zajec5@...il.com>:
> From: Hauke Mehrtens <hauke@...ke-m.de>
>
> This works pretty much the same way, so avoid duplicating the code.
>
> Signed-off-by: Hauke Mehrtens <hauke@...ke-m.de>
> Signed-off-by: Rafał Miłecki <zajec5@...il.com>

Acked-by: Florian Fainelli <f.fainelli@...il.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
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ