netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Cc: jeff@garzik.org, netdev@vger.kernel.org,
	Liran Liss <liranl@mellanox.co.il>,
	tziporet@mellanox.co.il, Roland Dreier <rdreier@cisco.com>
Subject: Re: [PATCH RFC 02/10] mlx4_en: Device initialization
Date: Mon, 14 Jul 2008 17:48:32 +0100	[thread overview]
Message-ID: <20080714164831.GT19302@solarflare.com> (raw)
In-Reply-To: <487B6571.8000602@mellanox.co.il>

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.

  reply	other threads:[~2008-07-14 16:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 14:40 [PATCH RFC 02/10] mlx4_en: Device initialization Yevgeny Petrilin
2008-07-14 16:48 ` Ben Hutchings [this message]
2008-07-15 19:21 ` Roland Dreier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080714164831.GT19302@solarflare.com \
    --to=bhutchings@solarflare.com \
    --cc=jeff@garzik.org \
    --cc=liranl@mellanox.co.il \
    --cc=netdev@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=tziporet@mellanox.co.il \
    --cc=yevgenyp@mellanox.co.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).