Re: [PATCH] Gigabit Ethernet driver of Topcliff PCH

From: Stephen Hemminger
Date: Thu Aug 26 2010 - 11:41:37 EST


On Thu, 26 Aug 2010 18:56:55 +0900
Masayuki Ohtake <masa-korg@xxxxxxxxxxxxxxx> wrote:

> +
> +/**
> + * pch_gbe_set_settings - Set device-specific settings
> + * @netdev: Network interface device structure
> + * @ecmd: Ethtool command
> + * Returns
> + * 0: Successful.
> + * Negative value: Failed.
> + */
> +static int pch_gbe_set_settings(struct net_device *netdev,
> + struct ethtool_cmd *ecmd)
> +{
> + struct pch_gbe_adapter *adapter = netdev_priv(netdev);
> + struct pch_gbe_hw *hw = &adapter->hw;
> + int ret;
> +
> + PCH_GBE_DEBUG("ethtool: %s\n", __func__);
> +
> + while (test_and_set_bit(__PCH_GBE_RESETTING, &adapter->flags))
> + msleep(1);

Don't invent your own mutex mechanism. Either use spin lock
or mutex.

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/