|
@@ -556,15 +556,6 @@ failed:
|
|
/*
|
|
/*
|
|
* netdev sysfs
|
|
* netdev sysfs
|
|
*/
|
|
*/
|
|
-static ssize_t show_channel(struct device *dev, struct device_attribute *attr,
|
|
|
|
- char *buf)
|
|
|
|
-{
|
|
|
|
- struct net_device *ndev = to_net_dev(dev);
|
|
|
|
- struct softing_priv *priv = netdev2softing(ndev);
|
|
|
|
-
|
|
|
|
- return sprintf(buf, "%i\n", priv->index);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static ssize_t show_chip(struct device *dev, struct device_attribute *attr,
|
|
static ssize_t show_chip(struct device *dev, struct device_attribute *attr,
|
|
char *buf)
|
|
char *buf)
|
|
{
|
|
{
|
|
@@ -609,12 +600,10 @@ static ssize_t store_output(struct device *dev, struct device_attribute *attr,
|
|
return count;
|
|
return count;
|
|
}
|
|
}
|
|
|
|
|
|
-static const DEVICE_ATTR(channel, S_IRUGO, show_channel, NULL);
|
|
|
|
static const DEVICE_ATTR(chip, S_IRUGO, show_chip, NULL);
|
|
static const DEVICE_ATTR(chip, S_IRUGO, show_chip, NULL);
|
|
static const DEVICE_ATTR(output, S_IRUGO | S_IWUSR, show_output, store_output);
|
|
static const DEVICE_ATTR(output, S_IRUGO | S_IWUSR, show_output, store_output);
|
|
|
|
|
|
static const struct attribute *const netdev_sysfs_attrs[] = {
|
|
static const struct attribute *const netdev_sysfs_attrs[] = {
|
|
- &dev_attr_channel.attr,
|
|
|
|
&dev_attr_chip.attr,
|
|
&dev_attr_chip.attr,
|
|
&dev_attr_output.attr,
|
|
&dev_attr_output.attr,
|
|
NULL,
|
|
NULL,
|
|
@@ -679,17 +668,20 @@ static int softing_netdev_register(struct net_device *netdev)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- netdev->sysfs_groups[0] = &netdev_sysfs_group;
|
|
|
|
ret = register_candev(netdev);
|
|
ret = register_candev(netdev);
|
|
if (ret) {
|
|
if (ret) {
|
|
dev_alert(&netdev->dev, "register failed\n");
|
|
dev_alert(&netdev->dev, "register failed\n");
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
+ if (sysfs_create_group(&netdev->dev.kobj, &netdev_sysfs_group) < 0)
|
|
|
|
+ netdev_alert(netdev, "sysfs group failed\n");
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static void softing_netdev_cleanup(struct net_device *netdev)
|
|
static void softing_netdev_cleanup(struct net_device *netdev)
|
|
{
|
|
{
|
|
|
|
+ sysfs_remove_group(&netdev->dev.kobj, &netdev_sysfs_group);
|
|
unregister_candev(netdev);
|
|
unregister_candev(netdev);
|
|
free_candev(netdev);
|
|
free_candev(netdev);
|
|
}
|
|
}
|