[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080714164831.GT19302@solarflare.com>
Date: Mon, 14 Jul 2008 17:48:32 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Yevgeny Petrilin <yevgenyp@...lanox.co.il>
Cc: jeff@...zik.org, netdev@...r.kernel.org,
Liran Liss <liranl@...lanox.co.il>, tziporet@...lanox.co.il,
Roland Dreier <rdreier@...co.com>
Subject: Re: [PATCH RFC 02/10] mlx4_en: Device initialization
Yevgeny Petrilin wrote:
[...]
> +static void mlx4_en_remove(struct mlx4_dev *dev, void *endev_ptr)
> +{
> + struct mlx4_en_dev *mdev = endev_ptr;
> + int p;
> +
> + down(&mdev->state_sem);
> + mdev->state = DEVICE_DOWN;
> + up(&mdev->state_sem);
> +
> + for (p = 1; p <= MLX4_MAX_PORTS; ++p)
> + if (mdev->pndev[p])
> + mlx4_en_destroy_netdev(mdev->pndev[p]);
[...]
> +static void *mlx4_en_add(struct mlx4_dev *dev)
> +{
[...]
> + /* Create a netdev for each port */
> + mlx4_foreach_port(i, mdev->ports_map) {
> + mlx4_info(mdev, "Activating port:%d\n", i);
> + if (mlx4_en_init_netdev(mdev, i, &mdev->profile.prof[i])) {
> + mdev->pndev[i] = NULL;
> + goto err_free_netdev;
> + }
> + }
> + return mdev;
> +
> +
> +err_free_netdev:
> + for (i = 0; i < dev->caps.num_ports; i++) {
> + if (mdev->pndev[i])
> + mlx4_en_destroy_netdev(mdev->pndev[i]);
> + }
[...]
These three loops need to loop over the same set of devices, so why are they
written completely differently?
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists