Exemplo n.º 1
0
int ag71xx_debugfs_init(struct ag71xx *ag)
{
	ag->debug.debugfs_dir = debugfs_create_dir(ag->dev->name,
						   ag71xx_debugfs_root);
	if (!ag->debug.debugfs_dir)
		goto err;

	ag->debug.debugfs_int_stats =
			debugfs_create_file("int_stats",
					    S_IRUGO,
					    ag->debug.debugfs_dir,
					    ag,
					    &ag71xx_fops_int_stats);
	if (!ag->debug.debugfs_int_stats)
		goto err;

	ag->debug.debugfs_napi_stats =
			debugfs_create_file("napi_stats",
					    S_IRUGO,
					    ag->debug.debugfs_dir,
					    ag,
					    &ag71xx_fops_napi_stats);
	if (!ag->debug.debugfs_napi_stats)
		goto err;

	return 0;

err:
	ag71xx_debugfs_exit(ag);
	return -ENOMEM;
}
Exemplo n.º 2
0
static int __exit ag71xx_remove(struct platform_device *pdev)
{
	struct net_device *dev = platform_get_drvdata(pdev);

	if (dev) {
		struct ag71xx *ag = netdev_priv(dev);

		ag71xx_debugfs_exit(ag);
		ag71xx_phy_disconnect(ag);
		unregister_netdev(dev);
		free_irq(dev->irq, dev);
		iounmap(ag->mii_ctrl);
		iounmap(ag->mac_base);
		kfree(dev);
		platform_set_drvdata(pdev, NULL);
	}

	return 0;
}