linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <petkovbb@googlemail.com>
To: bzolnier@gmail.com
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 08/14] ide-floppy/ide_floppy_format_unit: use local buffer
Date: Sat,  9 May 2009 09:45:28 +0200	[thread overview]
Message-ID: <1241855134-4984-9-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1241855134-4984-1-git-send-email-petkovbb@gmail.com>

Pass the buffer into ide_floppy_create_format_unit_cmd instead of using
pc->buf.

There should be no functional change resulting from this patch.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
 drivers/ide/ide-floppy_ioctl.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
index 0d2c9f0..7a03d34 100644
--- a/drivers/ide/ide-floppy_ioctl.c
+++ b/drivers/ide/ide-floppy_ioctl.c
@@ -93,24 +93,25 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive,
 	return 0;
 }
 
-static void ide_floppy_create_format_unit_cmd(struct ide_atapi_pc *pc, int b,
-		int l, int flags)
+static void ide_floppy_create_format_unit_cmd(struct ide_atapi_pc *pc,
+					      u8 *buf, int b, int l,
+					      int flags)
 {
 	ide_init_pc(pc);
 	pc->c[0] = GPCMD_FORMAT_UNIT;
 	pc->c[1] = 0x17;
 
-	memset(pc->buf, 0, 12);
-	pc->buf[1] = 0xA2;
+	memset(buf, 0, 12);
+	buf[1] = 0xA2;
 	/* Default format list header, u8 1: FOV/DCRT/IMM bits set */
 
 	if (flags & 1)				/* Verify bit on... */
-		pc->buf[1] ^= 0x20;		/* ... turn off DCRT bit */
-	pc->buf[3] = 8;
+		buf[1] ^= 0x20;			/* ... turn off DCRT bit */
+	buf[3] = 8;
 
-	put_unaligned(cpu_to_be32(b), (unsigned int *)(&pc->buf[4]));
-	put_unaligned(cpu_to_be32(l), (unsigned int *)(&pc->buf[8]));
-	pc->buf_size = 12;
+	put_unaligned(cpu_to_be32(b), (unsigned int *)(&buf[4]));
+	put_unaligned(cpu_to_be32(l), (unsigned int *)(&buf[8]));
+	pc->req_xfer = 12;
 	pc->flags |= PC_FLAG_WRITING;
 }
 
@@ -137,6 +138,7 @@ static int ide_floppy_format_unit(ide_drive_t *drive, struct ide_atapi_pc *pc,
 				  int __user *arg)
 {
 	struct ide_disk_obj *floppy = drive->driver_data;
+	u8 buf[12];
 	int blocks, length, flags, err = 0;
 
 	if (floppy->openers > 1) {
@@ -170,9 +172,9 @@ static int ide_floppy_format_unit(ide_drive_t *drive, struct ide_atapi_pc *pc,
 	}
 
 	ide_floppy_get_sfrp_bit(drive, pc);
-	ide_floppy_create_format_unit_cmd(pc, blocks, length, flags);
+	ide_floppy_create_format_unit_cmd(pc, buf, blocks, length, flags);
 
-	if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf, pc->req_xfer))
+	if (ide_queue_pc_tail(drive, floppy->disk, pc, buf, pc->req_xfer))
 		err = -EIO;
 
 out:
-- 
1.6.2.4


  parent reply	other threads:[~2009-05-09  7:45 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-09  7:45 [RFC PATCH 0/12] ide-atapi remove pc->buf Borislav Petkov
2009-05-09  7:45 ` [PATCH 01/14] ide-tape: fix potential fs requests bug Borislav Petkov
2009-05-09  8:02   ` Sam Ravnborg
2009-05-09  8:50     ` Borislav Petkov
2009-05-09 10:25       ` Sam Ravnborg
2009-05-09 12:09         ` Borislav Petkov
2009-05-09  7:45 ` [PATCH 02/14] ide-atapi: switch to blk_rq_bytes() on do_request() path Borislav Petkov
2009-05-10 21:32   ` Bartlomiej Zolnierkiewicz
2009-05-09  7:45 ` [PATCH 03/14] ide-atapi: switch to rq->resid_len Borislav Petkov
2009-05-10 21:32   ` Bartlomiej Zolnierkiewicz
2009-05-11  7:23     ` Borislav Petkov
2009-05-11 11:22       ` Bartlomiej Zolnierkiewicz
2009-05-12 14:38   ` Sergei Shtylyov
2009-05-09  7:45 ` [PATCH 04/14] ide-atapi: add a len-parameter to ide_queue_pc_tail Borislav Petkov
2009-05-09  7:45 ` [PATCH 05/14] ide-atapi: add a buffer-arg " Borislav Petkov
2009-05-10 21:32   ` Bartlomiej Zolnierkiewicz
2009-05-09  7:45 ` [PATCH 06/14] ide-floppy/ide_floppy_get_flexible_disk_page: use local buffer Borislav Petkov
2009-05-09  7:45 ` [PATCH 07/14] ide-floppy/ide_floppy_get_sfrp_bit: " Borislav Petkov
2009-05-09  7:45 ` Borislav Petkov [this message]
2009-05-09  7:45 ` [PATCH 09/14] ide-atapi: use local sense buffer Borislav Petkov
2009-05-10 21:32   ` Bartlomiej Zolnierkiewicz
2009-05-12  7:17     ` Borislav Petkov
2009-05-09  7:45 ` [PATCH 10/14] ide-tape: fix READ POSITION cmd handling Borislav Petkov
2009-05-09  7:45 ` [PATCH 11/14] ide-tape/ide_tape_get_bsize_from_bdesc: use local buffer Borislav Petkov
2009-05-09  7:45 ` [PATCH 12/14] ide-atapi: remove pc->buf Borislav Petkov
2009-05-09  7:45 ` [PATCH 13/14] ide-cd: use whole request_sense buffer in EH Borislav Petkov
2009-05-09  7:45 ` [PATCH 14/14] ide: unify interrupt reason checking Borislav Petkov
2009-05-10 21:39   ` Bartlomiej Zolnierkiewicz
2009-05-10 21:32 ` [RFC PATCH 0/12] ide-atapi remove pc->buf Bartlomiej Zolnierkiewicz
2009-05-10 23:30   ` Tejun Heo

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=1241855134-4984-9-git-send-email-petkovbb@gmail.com \
    --to=petkovbb@googlemail.com \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).