[PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use bitops for testing, setting and clearing bits

Signed-off-by: Alexis Bruemmer <alexisb@xxxxxxxxxx>
Signed-off-by: Mike Anderson <andmike@xxxxxxxxxx>

---
 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;
 


-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux