From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] Gigabit Ethernet driver of Topcliff PCH Date: Thu, 26 Aug 2010 08:40:22 -0700 Message-ID: <20100826084022.457ac967@nehalam> References: <4C763A67.5040107@dsn.okisemi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: LKML , ML netdev , Greg Rose , Maxime Bizon , Kristoffer Glembo , Ralf Baechle , John Linn , Randy Dunlap , "David S. Miller" , MeeGo , "Wang, Qi" , "Wang, Yong Y" , Andrew , Intel OTC , "Foster, Margie" , Toshiharu Okada , Tomoya Morinaga , Takahiro Shimizu To: Masayuki Ohtake Return-path: In-Reply-To: <4C763A67.5040107@dsn.okisemi.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Thu, 26 Aug 2010 18:56:55 +0900 Masayuki Ohtake wrote: > +static int pch_gbe_get_settings(struct net_device *netdev, > + struct ethtool_cmd *ecmd) > +{ > + struct pch_gbe_adapter *adapter = netdev_priv(netdev); > + int ret; > + > + PCH_GBE_DEBUG("ethtool: %s\n", __func__); > + > + ret = mii_ethtool_gset(&adapter->mii, ecmd); > + ecmd->supported &= (u32) (~SUPPORTED_TP); > + ecmd->supported &= (u32) (~SUPPORTED_1000baseT_Half); > + ecmd->advertising &= (u32) (~ADVERTISED_TP); > + ecmd->advertising &= (u32) (~ADVERTISED_1000baseT_Half); > + > + if (netif_carrier_ok(adapter->netdev)) { > + ; > + } else { > + ecmd->speed = 0xFFFF; > + ecmd->duplex = 0xFF; > + } > + return ret; > +} No need for cast to u32 on the masking: ecmd->supported &= ~(SUPPORTED_TP | SUPPORTED_1000baseT_Half); ecmd->advertising &= ~(ADVERTISED_TP | ADVERTISED_1000baseT_Half); Awkward use of if, and don't set other bits in duplex if (!netif_carrier_ok(adapter->netdev)) ecmd->speed = -1; --