Thread (1 message) 1 message, 1 author, 2011-12-19

Re: [PATCH 13/14] drivers/ieee802154: IEEE 802.15.4 loopback driver

From: David Miller <hidden>
Date: 2011-12-19 19:49:57

From: Alexander Smirnov <redacted>
Date: Mon, 19 Dec 2011 19:33:53 +0300
+	unsigned int working:1;
Integer bit fields are troublesome, use a set of flags here, or if this
is likely to be the only set of state use a "bool" type.
+		list_for_each_entry(dp, &priv->fake->list, list)
+			if (dp != priv &&
+			    dp->dev->phy->current_channel ==
+					priv->dev->phy->current_channel)
+				fakelb_hw_deliver(dp, skb);
Format the if() statement properly:

			if (dp != priv &&
			    (dp->dev->phy->current_channel ==
			     priv->dev->phy->current_channel))

And use braces around the top-level list traversal since the basic block is
taking up multiple lines.
+static int
+fakelb_hw_start(struct ieee802154_dev *dev) {
+	struct fakelb_dev_priv *priv = dev->priv;
+
+	if (priv->working)
+		return -EBUSY;
+
+	priv->working = 1;
+
+	return 0;
+}
What prevents this "test and set" sequence from running in parallel with whatever
clears the ->working value and thus we end up losing the event?
+	ieee->phy->channels_supported[6] |= 0x3ffc00;
+
+
+	INIT_LIST_HEAD(&priv->list);
Excess empty line, there is no need for two of them, get rid of the
extra one.

------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help