Commit f409d6cc authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] st: simplify new_tape_buffer

- remove the from_initialization argument, which is always 1. We
always need to use GFP_ATOMIC.

- 'got' valuable is initialized to zero and doesn't change. We don't
need it.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: default avatarKai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent b3d59115
...@@ -182,7 +182,6 @@ static struct scsi_tape **scsi_tapes = NULL; ...@@ -182,7 +182,6 @@ static struct scsi_tape **scsi_tapes = NULL;
static int modes_defined; static int modes_defined;
static struct st_buffer *new_tape_buffer(int, int, int);
static int enlarge_buffer(struct st_buffer *, int, int); static int enlarge_buffer(struct st_buffer *, int, int);
static void clear_buffer(struct st_buffer *); static void clear_buffer(struct st_buffer *);
static void normalize_buffer(struct st_buffer *); static 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,30 +3740,22 @@ static long st_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
/* Try to allocate a new tape buffer. Calling function must not hold /* Try to allocate a new tape buffer. Calling function must not hold
dev_arr_lock. */ dev_arr_lock. */
static struct st_buffer * static struct st_buffer *new_tape_buffer(int need_dma, int max_sg)
new_tape_buffer(int from_initialization, int need_dma, int max_sg)
{ {
int got = 0;
gfp_t priority;
struct st_buffer *tb; struct st_buffer *tb;
if (from_initialization) tb = kzalloc(sizeof(struct st_buffer), GFP_ATOMIC);
priority = GFP_ATOMIC;
else
priority = GFP_KERNEL;
tb = kzalloc(sizeof(struct st_buffer), priority);
if (!tb) { if (!tb) {
printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n"); printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
return NULL; return NULL;
} }
tb->frp_segs = tb->orig_frp_segs = 0; tb->frp_segs = tb->orig_frp_segs = 0;
tb->use_sg = max_sg; tb->use_sg = max_sg;
tb->dma = need_dma; tb->dma = need_dma;
tb->buffer_size = got; tb->buffer_size = 0;
tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *), priority); tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *),
GFP_ATOMIC);
if (!tb->reserved_pages) { if (!tb->reserved_pages) {
kfree(tb); kfree(tb);
return NULL; return NULL;
...@@ -4059,7 +4050,7 @@ static int st_probe(struct device *dev) ...@@ -4059,7 +4050,7 @@ static int st_probe(struct device *dev)
SDp->request_queue->max_phys_segments); SDp->request_queue->max_phys_segments);
if (st_max_sg_segs < i) if (st_max_sg_segs < i)
i = st_max_sg_segs; i = st_max_sg_segs;
buffer = new_tape_buffer(1, (SDp->host)->unchecked_isa_dma, i); buffer = new_tape_buffer((SDp->host)->unchecked_isa_dma, i);
if (buffer == NULL) { if (buffer == NULL) {
printk(KERN_ERR printk(KERN_ERR
"st: Can't allocate new tape buffer. Device not attached.\n"); "st: Can't allocate new tape buffer. Device not attached.\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment