-static ssize_t show_dormant(struct class_device *dev, char *buf)
-{
- struct net_device *netdev = to_net_dev(dev);
-
- if (netif_running(netdev))
- return sprintf(buf, fmt_dec, !!netif_dormant(netdev));
-
- return -EINVAL;
-}
-
-static const char *operstates[] = {
- "unknown",
- "notpresent", /* currently unused */
- "down",
- "lowerlayerdown",
- "testing", /* currently unused */
- "dormant",
- "up"
-};
-
-static ssize_t show_operstate(struct class_device *dev, char *buf)
-{
- const struct net_device *netdev = to_net_dev(dev);
- unsigned char operstate;
-
- read_lock(&dev_base_lock);
- operstate = netdev->operstate;
- if (!netif_running(netdev))
- operstate = IF_OPER_DOWN;
- read_unlock(&dev_base_lock);
-
- if (operstate >= ARRAY_SIZE(operstates))
- return -EINVAL; /* should not happen */
-
- return sprintf(buf, "%s\n", operstates[operstate]);
-}
-