All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexis Bruemmer <alexisb@us.ibm.com>
To: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits
Date: Tue, 09 May 2006 14:42:43 -0700	[thread overview]
Message-ID: <1147210963.11847.69.camel@localhost.localdomain> (raw)
In-Reply-To: <1147209211.11847.33.camel@localhost.localdomain>

Use bitops for testing, setting and clearing bits

Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>

---
 drivers/scsi/sas/sas_internal.h |   16 +++++++++-------
 include/scsi/sas/sas_class.h    |    8 ++++----
 2 files changed, 13 insertions(+), 11 deletions(-)

Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_internal.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_internal.h
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_internal.h
@@ -27,6 +27,7 @@
 #define _SAS_INTERNAL_H_
 
 #include <scsi/sas/sas_class.h>
+#include <linux/bitops.h>
 #include <scsi/scsi_host.h>
 
 #define sas_printk(fmt, ...) printk(KERN_NOTICE "sas: " fmt, ## __VA_ARGS__)
@@ -70,28 +71,29 @@ void sas_notify_lldd_dev_gone(struct dom
 
 void sas_hae_reset(void *);
 
-static inline void sas_queue_event(int event, spinlock_t *lock, u32 *pending,
-				   struct work_struct *work,
-				   struct Scsi_Host *shost)
+static inline void sas_queue_event(int event, spinlock_t *lock, unsigned
+				   long *pending, struct work_struct
+				   *work, struct Scsi_Host *shost)
 {
 	unsigned long flags;
 
 	spin_lock_irqsave(lock, flags);
-	if (*pending & (1 << event)) {
+	if (test_bit(event, pending)) {
 		spin_unlock_irqrestore(lock, flags);
 		return;
 	}
-	*pending |= (1 << event);
+	__set_bit(event, pending);
 	spin_unlock_irqrestore(lock, flags);
 	scsi_queue_work(shost, work);
 }
 
-static inline void sas_begin_event(int event, spinlock_t *lock, u32 *pending)
+static inline void sas_begin_event(int event, spinlock_t *lock, unsigned
+				   long *pending)
 {
 	unsigned long flags;
 
 	spin_lock_irqsave(lock, flags);
-	*pending &= ~(1 << event);
+	__clear_bit(event, pending);
 	spin_unlock_irqrestore(lock, flags);
 }
 
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_class.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_class.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_class.h
@@ -94,8 +94,8 @@ struct asd_sas_phy {
 	struct work_struct   port_events[PORT_NUM_EVENTS];
 	struct work_struct   phy_events[PHY_NUM_EVENTS];
 
-	u32 port_events_pending;
-	u32 phy_events_pending;
+	unsigned long port_events_pending;
+	unsigned long phy_events_pending;
 
 	int error;
 
@@ -138,7 +138,7 @@ struct sas_port;
 struct sas_discovery {
 	spinlock_t disc_event_lock;
 	struct work_struct disc_work[DISC_NUM_EVENTS];
-	u32    pending;
+	unsigned long    pending;
 	u8     fanout_sas_addr[8];
 	u8     eeds_a[8];
 	u8     eeds_b[8];
@@ -199,7 +199,7 @@ struct sas_ha_struct {
 /* private: */
 	spinlock_t       event_lock;
 	struct work_struct ha_events[HA_NUM_EVENTS];
-	u32		 pending;
+	unsigned long	 pending;
 
 	struct scsi_core core;
 



  parent reply	other threads:[~2006-05-09 21:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
2006-05-09 21:20 ` [PATCH 1/8] aic94xx: move sas README Alexis Bruemmer
2006-05-09 21:25 ` [PATCH 2/8] aic94xx: remove the sas_common.c file Alexis Bruemmer
2006-05-09 21:27 ` [PATCH 3/8] aic94xx: remove the //depot SCM comments Alexis Bruemmer
2006-05-09 21:31 ` [PATCH 4/8] aic94xx: remove expander_conf.c Alexis Bruemmer
2006-05-10  6:56   ` Luben Tuikov
2006-05-09 21:33 ` [PATCH 5/8] aic94xx: remove inline functions Alexis Bruemmer
2006-05-09 21:37 ` [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h Alexis Bruemmer
2006-05-10  7:01   ` Luben Tuikov
2006-05-10  7:07   ` Luben Tuikov
2006-05-09 21:39 ` [PATCH 7/8] aic94xx: remove queue implementation comment Alexis Bruemmer
2006-05-10  7:09   ` Luben Tuikov
2006-05-09 21:42 ` Alexis Bruemmer [this message]
2006-05-09 21:53   ` [PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits Rolf Eike Beer
2006-05-10  6:53 ` [PATCH 0/8] aic94xx: sas code clean-up Luben Tuikov
2006-05-10  7:21   ` Christoph Hellwig

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=1147210963.11847.69.camel@localhost.localdomain \
    --to=alexisb@us.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.