aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/st.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index f934016f640c..22ddca891e17 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -182,7 +182,6 @@ static struct scsi_tape **scsi_tapes = NULL;
182 182
183static int modes_defined; 183static int modes_defined;
184 184
185static struct st_buffer *new_tape_buffer(int, int, int);
186static int enlarge_buffer(struct st_buffer *, int, int); 185static int enlarge_buffer(struct st_buffer *, int, int);
187static void clear_buffer(struct st_buffer *); 186static void clear_buffer(struct st_buffer *);
188static void normalize_buffer(struct st_buffer *); 187static void normalize_buffer(struct st_buffer *);
@@ -3741,30 +3740,22 @@ static long st_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
3741 3740
3742/* Try to allocate a new tape buffer. Calling function must not hold 3741/* Try to allocate a new tape buffer. Calling function must not hold
3743 dev_arr_lock. */ 3742 dev_arr_lock. */
3744static struct st_buffer * 3743static struct st_buffer *new_tape_buffer(int need_dma, int max_sg)
3745 new_tape_buffer(int from_initialization, int need_dma, int max_sg)
3746{ 3744{
3747 int got = 0;
3748 gfp_t priority;
3749 struct st_buffer *tb; 3745 struct st_buffer *tb;
3750 3746
3751 if (from_initialization) 3747 tb = kzalloc(sizeof(struct st_buffer), GFP_ATOMIC);
3752 priority = GFP_ATOMIC;
3753 else
3754 priority = GFP_KERNEL;
3755
3756 tb = kzalloc(sizeof(struct st_buffer), priority);
3757 if (!tb) { 3748 if (!tb) {
3758 printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n"); 3749 printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
3759 return NULL; 3750 return NULL;
3760 } 3751 }
3761 tb->frp_segs = tb->orig_frp_segs = 0; 3752 tb->frp_segs = tb->orig_frp_segs = 0;
3762 tb->use_sg = max_sg; 3753 tb->use_sg = max_sg;
3763
3764 tb->dma = need_dma; 3754 tb->dma = need_dma;
3765 tb->buffer_size = got; 3755 tb->buffer_size = 0;
3766 3756
3767 tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *), priority); 3757 tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *),
3758 GFP_ATOMIC);
3768 if (!tb->reserved_pages) { 3759 if (!tb->reserved_pages) {
3769 kfree(tb); 3760 kfree(tb);
3770 return NULL; 3761 return NULL;
@@ -4059,7 +4050,7 @@ static int st_probe(struct device *dev)
4059 SDp->request_queue->max_phys_segments); 4050 SDp->request_queue->max_phys_segments);
4060 if (st_max_sg_segs < i) 4051 if (st_max_sg_segs < i)
4061 i = st_max_sg_segs; 4052 i = st_max_sg_segs;
4062 buffer = new_tape_buffer(1, (SDp->host)->unchecked_isa_dma, i); 4053 buffer = new_tape_buffer((SDp->host)->unchecked_isa_dma, i);
4063 if (buffer == NULL) { 4054 if (buffer == NULL) {
4064 printk(KERN_ERR 4055 printk(KERN_ERR
4065 "st: Can't allocate new tape buffer. Device not attached.\n"); 4056 "st: Can't allocate new tape buffer. Device not attached.\n");