LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: "Kristian Høgsberg" <krh@bitplanet.net>, "Andrew Morton" <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux1394-devel@lists.sourceforge.net
Subject: Re: In-tree version of new FireWire drivers available
Date: Sat, 27 Jan 2007 10:34:55 +0100 (CET)	[thread overview]
Message-ID: <tkrat.7c1b8fcba7cb70ac@s5r6.in-berlin.de> (raw)
In-Reply-To: <20070126233911.7ebf96ac.akpm@osdl.org>

On 26 Jan, Andrew Morton wrote:
> arm:
> 
> drivers/firewire/fw-device.c: In function `fw_device_init':
> drivers/firewire/fw-device.c:495: warning: implicit declaration of function `cmpxchg'                                                                           
> 
> We can't use cmpxchg in generic code.


From: Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: firewire: use atomic type for fw_device.state

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/fw-card.c   |    2 +-
 drivers/firewire/fw-device.c |    6 +++---
 drivers/firewire/fw-device.h |    3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

Index: linux-2.6.20-rc5/drivers/firewire/fw-device.h
===================================================================
--- linux-2.6.20-rc5.orig/drivers/firewire/fw-device.h
+++ linux-2.6.20-rc5/drivers/firewire/fw-device.h
@@ -24,6 +24,7 @@
 
 #include <linux/fs.h>
 #include <linux/cdev.h>
+#include <asm/atomic.h>
 
 enum fw_device_state {
 	FW_DEVICE_INITIALIZING,
@@ -32,7 +33,7 @@ enum fw_device_state {
 };
 
 struct fw_device {
-	int state;
+	atomic_t state;
 	struct fw_node *node;
 	int node_id;
 	int generation;
Index: linux-2.6.20-rc5/drivers/firewire/fw-device.c
===================================================================
--- linux-2.6.20-rc5.orig/drivers/firewire/fw-device.c
+++ linux-2.6.20-rc5/drivers/firewire/fw-device.c
@@ -494,7 +494,7 @@ static void fw_device_init(struct work_s
 	 * necessary.  We have to use the atomic cmpxchg here to avoid
 	 * racing with the FW_NODE_DESTROYED case in
 	 * fw_node_event(). */
-	if (cmpxchg(&device->state,
+	if (atomic_cmpxchg(&device->state,
 		    FW_DEVICE_INITIALIZING,
 		    FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN)
 		fw_device_shutdown(&device->work.work);
@@ -551,7 +551,7 @@ void fw_node_event(struct fw_card *card,
 		 * device_for_each_child() in FW_NODE_UPDATED is
 		 * doesn't freak out. */
 		device_initialize(&device->device);
-		device->state = FW_DEVICE_INITIALIZING;
+		atomic_set(&device->state, FW_DEVICE_INITIALIZING);
 		device->card = fw_card_get(card);
 		device->node = fw_node_get(node);
 		device->node_id = node->node_id;
@@ -596,7 +596,7 @@ void fw_node_event(struct fw_card *card,
 		 * the device in shutdown state to have that code fail
 		 * to create the device. */
 		device = node->data;
-		if (xchg(&device->state,
+		if (atomic_xchg(&device->state,
 			 FW_DEVICE_SHUTDOWN) == FW_DEVICE_RUNNING) {
 			INIT_DELAYED_WORK(&device->work, fw_device_shutdown);
 			schedule_delayed_work(&device->work, 0);
Index: linux-2.6.20-rc5/drivers/firewire/fw-card.c
===================================================================
--- linux-2.6.20-rc5.orig/drivers/firewire/fw-card.c
+++ linux-2.6.20-rc5/drivers/firewire/fw-card.c
@@ -302,7 +302,7 @@ fw_card_bm_work(struct work_struct *work
 		/* Either link_on is false, or we failed to read the
 		 * config rom.  In either case, pick another root. */
 		new_root_id = card->local_node->node_id;
-	} else if (root->state != FW_DEVICE_RUNNING) {
+	} else if (atomic_read(&root->state) != FW_DEVICE_RUNNING) {
 		/* If we haven't probed this device yet, bail out now
 		 * and let's try again once that's done. */
 		spin_unlock_irqrestore(&card->lock, flags);


-- 
Stefan Richter
-=====-=-=== ---= ==-==
http://arcgraph.de/sr/


      reply	other threads:[~2007-01-27  9:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-24  3:48 Kristian Høgsberg
2007-01-24 13:32 ` Pieter Palmers
     [not found]   ` <59ad55d30701241245l7671af23w3e19a83621c6fb51@mail.gmail.com>
2007-01-24 21:19     ` David Moore
     [not found]       ` <59ad55d30701241630o6995d115je8e37a1d1eb6252f@mail.gmail.com>
2007-01-25  2:17         ` David Moore
2007-01-25 10:03     ` Pieter Palmers
2007-01-26 13:07       ` Robert Crocombe
2007-01-26 14:54         ` Pieter Palmers
2007-01-24 15:13 ` Stefan Richter
2007-01-27  7:39 ` Andrew Morton
2007-01-27  9:34   ` Stefan Richter [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=tkrat.7c1b8fcba7cb70ac@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=akpm@osdl.org \
    --cc=krh@bitplanet.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --subject='Re: In-tree version of new FireWire drivers available' \
    /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

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).