From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jens Axboe <axboe@kernel.dk>, "James E.J. Bottomley" <jejb@linux.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, "Ahmed S . Darwish" <a.darwish@linutronix.de>, Thomas Gleixner <tglx@linutronix.de>, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [PATCH 1/3] cdrom: Reset sector_size back it is not 2048. Date: Fri, 4 Dec 2020 17:48:48 +0100 [thread overview] Message-ID: <20201204164850.2343359-1-bigeasy@linutronix.de> (raw) In-Reply-To: <20201204164803.ovwurzs3257em2rp@linutronix.de> In v2.4.0-test2pre2 mmc_ioctl_cdrom_read_data() was extended by issuing a MODE_SELECT opcode to change the sector size and READ_10 to perform the actual read if the READ_CD opcode is not support. The sector size is never changed back to the previous value of 2048 bytes which is however denoted by the comment for version 3.09 of the cdrom.c file. Use cdrom_switch_blocksize() to change the sector size only if the requested size deviates from 2048. Change it back to 2048 after the read operation if a change was mode. Link: https://lkml.kernel.org/r/20201204164803.ovwurzs3257em2rp@linutronix.de Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/cdrom/cdrom.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 0c271b9e3c5b7..8f0e52a714938 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -2996,13 +2996,15 @@ static noinline int mmc_ioctl_cdrom_read_data(struct cdrom_device_info *cdi, * SCSI-II devices are not required to support * READ_CD, so let's try switching block size */ - /* FIXME: switch back again... */ - ret = cdrom_switch_blocksize(cdi, blocksize); - if (ret) - goto out; + if (blocksize != CD_FRAMESIZE) { + ret = cdrom_switch_blocksize(cdi, blocksize); + if (ret) + goto out; + } cgc->sshdr = NULL; ret = cdrom_read_cd(cdi, cgc, lba, blocksize, 1); - ret |= cdrom_switch_blocksize(cdi, blocksize); + if (blocksize != CD_FRAMESIZE) + ret |= cdrom_switch_blocksize(cdi, CD_FRAMESIZE); } if (!ret && copy_to_user(arg, cgc->buffer, blocksize)) ret = -EFAULT; -- 2.29.2
next prev parent reply other threads:[~2020-12-04 16:49 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-04 16:48 [PATCH 0/3] Remove in_interrupt() usage in sr Sebastian Andrzej Siewior 2020-12-04 16:48 ` Sebastian Andrzej Siewior [this message] 2020-12-04 16:48 ` [PATCH 2/3] sr: Switch the sector size back to 2048 if sr_read_sector() changed it Sebastian Andrzej Siewior 2020-12-04 16:48 ` [PATCH 3/3] sr: Remove in_interrupt() usage in sr_init_command() Sebastian Andrzej Siewior 2020-12-11 17:09 ` Sebastian Andrzej Siewior 2020-12-12 18:12 ` [PATCH 0/3] Remove in_interrupt() usage in sr Jens Axboe
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=20201204164850.2343359-1-bigeasy@linutronix.de \ --to=bigeasy@linutronix.de \ --cc=a.darwish@linutronix.de \ --cc=axboe@kernel.dk \ --cc=jejb@linux.ibm.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=martin.petersen@oracle.com \ --cc=tglx@linutronix.de \ --subject='Re: [PATCH 1/3] cdrom: Reset sector_size back it is not 2048.' \ /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
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).