linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Borislav Petkov <petkovbb@googlemail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/14] ide-atapi: use local sense buffer
Date: Sun, 10 May 2009 23:32:38 +0200	[thread overview]
Message-ID: <200905102332.39043.bzolnier@gmail.com> (raw)
In-Reply-To: <1241855134-4984-10-git-send-email-petkovbb@gmail.com>

On Saturday 09 May 2009 09:45:29 Borislav Petkov wrote:
> Save a pointer to the sense buffer in rq->sense in order to access it
> later in the ->pc_callback method. Also, remove remaining references to
> pc->buf in ide-floppy code.
> 
> There should be no functional change resulting from this patch.
> 
> Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
> ---
>  drivers/ide/ide-atapi.c        |   10 ++++++++--
>  drivers/ide/ide-floppy.c       |   12 ++++++------
>  drivers/ide/ide-floppy_ioctl.c |    4 ++--
>  drivers/ide/ide-tape.c         |    5 +++--
>  4 files changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
> index bd59fea..df3e3bb 100644
> --- a/drivers/ide/ide-atapi.c
> +++ b/drivers/ide/ide-atapi.c
> @@ -93,6 +93,13 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
>  	rq->cmd_type = REQ_TYPE_SPECIAL;
>  	rq->special = (char *)pc;
>  
> +	/*
> +	 * FIXME: temporarily save a ptr to the sense buffer in rq->sense for
> +	 * the ->do_callback sense massaging. Will remove later.
> +	 */
> +	if (pc->c[0] == REQUEST_SENSE)
> +		rq->sense = buf;
> +
>  	if (buf && bufflen) {
>  		error = blk_rq_map_kern(drive->queue, rq, buf, bufflen,
>  					GFP_NOIO);
> @@ -252,8 +259,7 @@ void ide_retry_pc(ide_drive_t *drive)
>  	/* init pc from sense_rq */
>  	ide_init_pc(pc);
>  	memcpy(pc->c, sense_rq->cmd, 12);
> -	pc->buf = bio_data(sense_rq->bio);	/* pointer to mapped address */

Shouldn't this belong to patch #12?

> -	pc->req_xfer = blk_rq_bytes(sense_rq);

I think that we can remove ->req_xfer now completely, patch #13.5? :)

> +	sense_rq->sense = bio_data(sense_rq->bio);	/* pointer to mapped address */

Can't we just use bio_data(rq->bio) in ->pc_callback?

also:

WARNING: line over 80 characters
#42: FILE: drivers/ide/ide-atapi.c:262:
+       sense_rq->sense = bio_data(sense_rq->bio);      /* pointer to mapped address */

>  	if (drive->media == ide_tape)
>  		set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
> diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
> index 060c893..cb6c6f8 100644
> --- a/drivers/ide/ide-floppy.c
> +++ b/drivers/ide/ide-floppy.c
> @@ -77,7 +77,12 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc)
>  	    (rq && blk_pc_request(rq)))
>  		uptodate = 1; /* FIXME */
>  	else if (pc->c[0] == GPCMD_REQUEST_SENSE) {
> -		u8 *buf = pc->buf;
> +
> +		u8 *buf;
> +
> +		BUG_ON(!rq->sense);
> +
> +		buf = rq->sense;

BUG_ON shouldn't be needed after testing this

>  		if (!pc->error) {
>  			floppy->sense_key = buf[2] & 0x0F;
> @@ -209,8 +214,6 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive,
>  	pc->rq = rq;
>  	if (rq->cmd_flags & REQ_RW)
>  		pc->flags |= PC_FLAG_WRITING;
> -	pc->buf = NULL;
> -	pc->buf_size = blk_rq_bytes(rq);

patch #12

>  	pc->flags |= PC_FLAG_DMA_OK;
>  }
>  
> @@ -225,9 +228,6 @@ static void idefloppy_blockpc_cmd(struct ide_disk_obj *floppy,
>  		if (rq_data_dir(rq) == WRITE)
>  			pc->flags |= PC_FLAG_WRITING;
>  	}
> -	/* pio will be performed by ide_pio_bytes() which handles sg fine */
> -	pc->buf = NULL;
> -	pc->buf_size = blk_rq_bytes(rq);

ditto

>  }
>  
>  static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
> diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
> index 7a03d34..9c22882 100644
> --- a/drivers/ide/ide-floppy_ioctl.c
> +++ b/drivers/ide/ide-floppy_ioctl.c
> @@ -47,7 +47,6 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive,
>  		return -EINVAL;
>  
>  	ide_floppy_create_read_capacity_cmd(pc);
> -	pc->buf_size = sizeof(pc_buf);

ditto
 
>  	if (ide_queue_pc_tail(drive, floppy->disk, pc, pc_buf, pc->req_xfer)) {
>  		printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n");
> @@ -198,11 +197,12 @@ static int ide_floppy_get_format_progress(ide_drive_t *drive,
>  					  int __user *arg)
>  {
>  	struct ide_disk_obj *floppy = drive->driver_data;
> +	u8 sense_buf[18];
>  	int progress_indication = 0x10000;
>  
>  	if (drive->atapi_flags & IDE_AFLAG_SRFP) {
>  		ide_create_request_sense_cmd(drive, pc);
> -		if (ide_queue_pc_tail(drive, floppy->disk, pc, pc->buf,
> +		if (ide_queue_pc_tail(drive, floppy->disk, pc, sense_buf,
>  				      pc->req_xfer))
>  			return -EIO;

Separate patch?

Please be consistent here and either do such changes in separate patches
or integrate them all into patch #5.5.

  reply	other threads:[~2009-05-10 21:36 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 ` [PATCH 08/14] ide-floppy/ide_floppy_format_unit: " Borislav Petkov
2009-05-09  7:45 ` [PATCH 09/14] ide-atapi: use local sense buffer Borislav Petkov
2009-05-10 21:32   ` Bartlomiej Zolnierkiewicz [this message]
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=200905102332.39043.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@googlemail.com \
    /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).