From: Christoph Hellwig <hch@lst.de>
To: Kai.Makisara@kolumbus.fi, jejb@steeleye.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] st: cleanup new_tape_buffer
Date: Mon, 30 Jan 2006 19:19:41 +0100 [thread overview]
Message-ID: <20060130181941.GA6185@lst.de> (raw)
- remove superflous forward prototype
- remove whitespace before function name
- update header comment
- remove from_initialization parametes. It was always 1, but should
always be 0 because all callers can sleep
- use kzalloc
- remove variable 'got', it was always 0
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: scsi-misc-2.6/drivers/scsi/st.c
===================================================================
--- scsi-misc-2.6.orig/drivers/scsi/st.c 2006-01-30 19:14:29.000000000 +0100
+++ scsi-misc-2.6/drivers/scsi/st.c 2006-01-30 19:15:13.000000000 +0100
@@ -180,7 +180,6 @@
static int modes_defined;
-static struct st_buffer *new_tape_buffer(int, int, int);
static int enlarge_buffer(struct st_buffer *, int, int);
static void normalize_buffer(struct st_buffer *);
static int append_to_buffer(const char __user *, struct st_buffer *, int);
@@ -3574,35 +3573,27 @@
\f
-/* Try to allocate a new tape buffer. Calling function must not hold
- dev_arr_lock. */
+/* Allocate a new tape buffer. */
static struct st_buffer *
- new_tape_buffer(int from_initialization, int need_dma, int max_sg)
+new_tape_buffer(int need_dma, int max_sg)
{
- int i, got = 0;
- gfp_t priority;
+ int i;
struct st_buffer *tb;
- if (from_initialization)
- priority = GFP_ATOMIC;
- else
- priority = GFP_KERNEL;
-
i = sizeof(struct st_buffer) + (max_sg - 1) * sizeof(struct scatterlist) +
max_sg * sizeof(struct st_buf_fragment);
- tb = kmalloc(i, priority);
+ tb = kzalloc(i, GFP_KERNEL);
if (!tb) {
printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
return NULL;
}
- memset(tb, 0, i);
tb->frp_segs = tb->orig_frp_segs = 0;
tb->use_sg = max_sg;
tb->frp = (struct st_buf_fragment *)(&(tb->sg[0]) + max_sg);
tb->in_use = 1;
tb->dma = need_dma;
- tb->buffer_size = got;
+ tb->buffer_size = 0;
return tb;
}
@@ -3896,7 +3887,7 @@
SDp->request_queue->max_phys_segments);
if (st_max_sg_segs < i)
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) {
printk(KERN_ERR
"st: Can't allocate new tape buffer. Device not attached.\n");
next reply other threads:[~2006-01-30 18:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-30 18:19 Christoph Hellwig [this message]
2006-01-30 19:14 ` [PATCH] st: cleanup new_tape_buffer Kai Makisara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060130181941.GA6185@lst.de \
--to=hch@lst.de \
--cc=Kai.Makisara@kolumbus.fi \
--cc=jejb@steeleye.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox