Re: [PATCH] Gigabit Ethernet driver of Topcliff PCH

Stephen Hemminger
2010-08-26T15:41:34Z

On Thu, 26 Aug 2010 18:56:55 +0900
Masayuki Ohtake <masa-korg@dsn.okisemi.com> 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.

--