netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: andrew@lunn.ch
Cc: t.remmet@phytec.de, netdev@vger.kernel.org, f.fainelli@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net: phy: smsc: Fix disabling energy detect mode
Date: Tue, 19 Jan 2016 14:31:34 -0500 (EST)	[thread overview]
Message-ID: <20160119.143134.622696308505132405.davem@davemloft.net> (raw)
In-Reply-To: <20160119152503.GK6554@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Tue, 19 Jan 2016 16:25:03 +0100

>> +struct smsc_phy_priv {
>> +	bool energy_enable:1;
>> +};
> 
> Time to show my ignorance of bitfields. Since this is a bool, does the
> :1 actually do anything?

Even if does something, saving space for a datastructure like this makes
no sense.  There are no adjacent bit fields to share the space with.

Just use plain 'bool'.

>> +static int smsc_phy_probe(struct phy_device *phydev)
>> +{
>> +	struct device *dev = &phydev->mdio.dev;
>> +	struct device_node *of_node __maybe_unused = dev->of_node;
>> +	struct smsc_phy_priv *priv;
>> +	int __maybe_unused len;
>> +
>> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>> +	if (!priv)
>> +		return -ENOMEM;
>> +
>> +	if (of_find_property(of_node, "smsc,disable-energy-detect", &len))
>> +		priv->energy_enable = false;
> 
> Here you set it to false. Where does it get set to true?
> 
> Also, of_property_read_bool() would be a better call than of_find_property.

Yeah this looks broken to me too.

      reply	other threads:[~2016-01-19 19:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19  7:56 [PATCH v2] net: phy: smsc: Fix disabling energy detect mode Teresa Remmet
2016-01-19 15:25 ` Andrew Lunn
2016-01-19 19:31   ` David Miller [this message]

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=20160119.143134.622696308505132405.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=t.remmet@phytec.de \
    /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).