From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 53/63] ide-cd: factor out transfer size checking from cdrom_read_intr()
Date: Thu, 20 Dec 2007 02:32:37 +0100 [thread overview]
Message-ID: <200712200232.38064.bzolnier@gmail.com> (raw)
This is a preparation for cdrom_read_intr() and cdrom_write_intr() merge.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
+26 bytes
drivers/ide/ide-cd.c | 38 ++++++++++++++++++++++++++------------
1 file changed, 26 insertions(+), 12 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -714,6 +714,31 @@ int cdrom_read_check_ireason (ide_drive_
}
/*
+ * Assume that the drive will always provide data in multiples of at least
+ * SECTOR_SIZE, as it gets hairy to keep track of the transfers otherwise.
+ */
+static int ide_cd_check_transfer_size(ide_drive_t *drive, int len)
+{
+ struct cdrom_info *cd = drive->driver_data;
+
+ if ((len % SECTOR_SIZE) == 0)
+ return 0;
+
+ printk(KERN_ERR "%s: %s: Bad transfer size %d\n",
+ drive->name, __FUNCTION__, len);
+
+ if (cd->cd_flags & IDE_CD_FLAG_LIMIT_NFRAMES)
+ printk(KERN_ERR " This drive is not supported by "
+ "this version of the driver\n");
+ else {
+ printk(KERN_ERR " Trying to limit transfer sizes\n");
+ cd->cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES;
+ }
+
+ return 1;
+}
+
+/*
* Interrupt routine. Called when a read request has completed.
*/
static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
@@ -774,18 +799,7 @@ static ide_startstop_t cdrom_read_intr (
if (cdrom_read_check_ireason (drive, len, ireason))
return ide_stopped;
- /* Assume that the drive will always provide data in multiples
- of at least SECTOR_SIZE, as it gets hairy to keep track
- of the transfers otherwise. */
- if ((len % SECTOR_SIZE) != 0) {
- printk (KERN_ERR "%s: cdrom_read_intr: Bad transfer size %d\n",
- drive->name, len);
- if (info->cd_flags & IDE_CD_FLAG_LIMIT_NFRAMES)
- printk (KERN_ERR " This drive is not supported by this version of the driver\n");
- else {
- printk (KERN_ERR " Trying to limit transfer sizes\n");
- info->cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES;
- }
+ if (ide_cd_check_transfer_size(drive, len)) {
cdrom_end_request(drive, 0);
return ide_stopped;
}
reply other threads:[~2007-12-20 1:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200712200232.38064.bzolnier@gmail.com \
--to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.