Just curious, is this needed purely for reference counting, or mainly to
hook into sysfs? If the former, net devices already have reference
counting, so I want to make sure kobjects do not run afoul of that.
> +static struct subsystem net_subsys;
> +
>
> /*******************************************************************************
>
> @@ -2545,7 +2547,10 @@
> notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
>
> net_run_sbin_hotplug(dev, "register");
> - ret = 0;
> +
> + snprintf(dev->kobj.name,KOBJ_NAME_LEN,dev->name);
> + kobj_set_kset_s(dev,net_subsys);
> + ret = kobject_register(&dev->kobj);
If the return code matters, shouldn't you be checking for its success?
> @@ -2671,6 +2676,8 @@
> goto out;
> }
>
> + kobject_unregister(&dev->kobj);
> +
...especially if kobject_register failed above
Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/