Instead of specifying GFP_DMA always ask the block layer to get some dma'able memory Signed-off-by: Andi Kleen <ak@xxxxxxx> Signed-off-by: Andi Kleen <andi@xxxxxxxxxxxxxx> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx> --- drivers/scsi/ch.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) Index: linux/drivers/scsi/ch.c =================================================================== --- linux.orig/drivers/scsi/ch.c +++ linux/drivers/scsi/ch.c @@ -232,7 +232,8 @@ ch_read_element_status(scsi_changer *ch, u_char *buffer; int result; - buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); + buffer = get_pages_mask(GFP_KERNEL, 512, + blk_q_mask(ch->device->request_queue)); if(!buffer) return -ENOMEM; @@ -262,7 +263,7 @@ ch_read_element_status(scsi_changer *ch, } dprintk("READ ELEMENT STATUS for element 0x%x failed\n",elem); } - kfree(buffer); + free_pages_mask(buffer, 512); return result; } @@ -289,9 +290,11 @@ ch_readconfig(scsi_changer *ch) int result,id,lun,i; u_int elem; - buffer = kzalloc(512, GFP_KERNEL | GFP_DMA); + buffer = get_pages_mask(GFP_KERNEL, 512, + blk_q_mask(ch->device->request_queue)); if (!buffer) return -ENOMEM; + memset(buffer, 0, 512); memset(cmd,0,sizeof(cmd)); cmd[0] = MODE_SENSE; @@ -402,7 +405,7 @@ ch_readconfig(scsi_changer *ch) } } ch->voltags = 1; - kfree(buffer); + free_pages_mask(buffer, 512); return 0; } @@ -737,7 +740,8 @@ static long ch_ioctl(struct file *file, return -EINVAL; elem = ch->firsts[cge.cge_type] + cge.cge_unit; - buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); + buffer = get_pages_mask(GFP_KERNEL, 512, + blk_q_mask(ch->device->request_queue)); if (!buffer) return -ENOMEM; mutex_lock(&ch->lock); @@ -791,7 +795,7 @@ static long ch_ioctl(struct file *file, vprintk("device has no volume tag support\n"); goto voltag_retry; } - kfree(buffer); + free_pages_mask(buffer, 512); mutex_unlock(&ch->lock); if (copy_to_user(argp, &cge, sizeof (cge))) -- To unsubscribe from this list: 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