Skip to contentSkip to conversation

ips.c warnings

PATCH Jack Hammer 2 participants 2 messages Oct 20, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

This patch ( applied to 2.6.14-rc4-mm1 ) keeps all the ips code intact for both 2.4 and 2.6 kernels, and should eliminate the compiler warnings ( in 2.6 ) reported by Andrew.

I did not use kmap() because these routines can be called from the interrupt handler context and kmap() can sleep.

drivers/scsi/ips.c +5 -3
@@ -220,13 +220,15 @@
 #include <linux/blk.h>
 #include "sd.h"
 #define IPS_SG_ADDRESS(sg)       ((sg)->address)
+#define IPS_CHECK_SG_ADDRESS(sg) ((sg)->address)
 #define IPS_LOCK_SAVE(lock,flags) spin_lock_irqsave(&io_request_lock,flags)
 #define IPS_UNLOCK_RESTORE(lock,flags) spin_unlock_irqrestore(&io_request_lock,flags)
 #ifndef __devexit_p
 #define __devexit_p(x) x
 #endif
 #else
-#define IPS_SG_ADDRESS(sg)      (page_address((sg)->page) ? \
+#define IPS_SG_ADDRESS(sg)       page_address((sg)->page)+(sg)->offset
+#define IPS_CHECK_SG_ADDRESS(sg) (page_address((sg)->page) ? \
                                    page_address((sg)->page)+(sg)->offset : NULL)
 #define IPS_LOCK_SAVE(lock,flags) do{spin_lock(lock);(void)flags;}while(0)
 #define IPS_UNLOCK_RESTORE(lock,flags) do{spin_unlock(lock);(void)flags;}while(0)
@@ -3659,7 +3661,7 @@
 		struct scatterlist *sg = scmd->request_buffer;
 		for (i = 0, xfer_cnt = 0;
 		     (i < scmd->use_sg) && (xfer_cnt < count); i++) {
-			if (!IPS_SG_ADDRESS(&sg[i]))
+			if (!IPS_CHECK_SG_ADDRESS(&sg[i]))
 				return;
 			min_cnt = min(count - xfer_cnt, sg[i].length);
 			memcpy(IPS_SG_ADDRESS(&sg[i]), &cdata[xfer_cnt],
@@ -3691,7 +3693,7 @@
 		struct scatterlist *sg = scmd->request_buffer;
 		for (i = 0, xfer_cnt = 0;
 		     (i < scmd->use_sg) && (xfer_cnt < count); i++) {
-			if (!IPS_SG_ADDRESS(&sg[i]))
+			if (!IPS_CHECK_SG_ADDRESS(&sg[i]))
 				return;
 			min_cnt = min(count - xfer_cnt, sg[i].length);
 			memcpy(&cdata[xfer_cnt], IPS_SG_ADDRESS(&sg[i]),
#1 lore raw
Quoted 1 line · Jack Hammer

I did not use kmap() because these routines can be called from the interrupt handler context and kmap() can sleep.

Is there a reason you can't use kmap_atomic() then?