/* Module registration */
static int __init phonet_init(void)
{
    int err;

    err = phonet_device_init();
    if (err)
        return err;

    err = sock_register(&phonet_proto_family);
    if (err) {
        printk(KERN_ALERT
               "phonet protocol family initialization failed\n");
        goto err_sock;
    }

    dev_add_pack(&phonet_packet_type);
    phonet_sysctl_init();

    err = isi_register();
    if (err)
        goto err;
    return 0;

err:
    phonet_sysctl_exit();
    sock_unregister(PF_PHONET);
    dev_remove_pack(&phonet_packet_type);
err_sock:
    phonet_device_exit();
    return err;
}
/* Module registration */
static int __init phonet_init(void)
{
	int err;

#ifdef ACTIVATE_PHONET_DEBUG
	err = sysfs_create_file(kernel_kobj, &phonet_attr.attr);
	if (err)
		printk(KERN_DEBUG "phonet sysfs_create_file failed: %d\n", err);
#endif

	err = phonet_device_init();
	if (err)
		return err;

	pn_sock_init();
	err = sock_register(&phonet_proto_family);
	if (err) {
		printk(KERN_ALERT
			"phonet protocol family initialization failed\n");
		goto err_sock;
	}

	dev_add_pack(&phonet_packet_type);
	phonet_sysctl_init();

	err = isi_register();
	if (err)
		goto err;
	return 0;

err:
	phonet_sysctl_exit();
	sock_unregister(PF_PHONET);
	dev_remove_pack(&phonet_packet_type);
err_sock:
	phonet_device_exit();
	return err;
}