From: Joe Perches <joe@perches.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 04/12] cdrom: Remove prototype for open_for_data
Date: Sun, 4 May 2014 17:05:05 -0700 [thread overview]
Message-ID: <6652632559434a6ffab9836f9217a664d0bd54c4.1399247745.git.joe@perches.com> (raw)
In-Reply-To: <51EDAD79.3050707@kernel.dk>
In-Reply-To: <cover.1399247745.git.joe@perches.com>
Move static function to the appropriate place to remove
the now unnecessary prototype.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/cdrom/cdrom.c | 114 +++++++++++++++++++++++++-------------------------
1 file changed, 57 insertions(+), 57 deletions(-)
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 47dee5e..5a38b56 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -337,7 +337,6 @@ do { \
#define CDROM_DEF_TIMEOUT (7 * HZ)
/* Not-exported routines. */
-static int open_for_data(struct cdrom_device_info * cdi);
static int check_for_audio_disc(struct cdrom_device_info * cdi,
struct cdrom_device_ops * cdo);
static void sanitize_format(union cdrom_addr *addr,
@@ -957,63 +956,8 @@ static int cdrom_close_write(struct cdrom_device_info *cdi)
#endif
}
-/* We use the open-option O_NONBLOCK to indicate that the
- * purpose of opening is only for subsequent ioctl() calls; no device
- * integrity checks are performed.
- *
- * We hope that all cd-player programs will adopt this convention. It
- * is in their own interest: device control becomes a lot easier
- * this way.
- */
-int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, fmode_t mode)
-{
- int ret;
-
- cd_dbg(CD_OPEN, "entering cdrom_open\n");
-
- /* open is event synchronization point, check events first */
- check_disk_change(bdev);
-
- /* if this was a O_NONBLOCK open and we should honor the flags,
- * do a quick open without drive/disc integrity checks. */
- cdi->use_count++;
- if ((mode & FMODE_NDELAY) && (cdi->options & CDO_USE_FFLAGS)) {
- ret = cdi->ops->open(cdi, 1);
- } else {
- ret = open_for_data(cdi);
- if (ret)
- goto err;
- cdrom_mmc3_profile(cdi);
- if (mode & FMODE_WRITE) {
- ret = -EROFS;
- if (cdrom_open_write(cdi))
- goto err_release;
- if (!CDROM_CAN(CDC_RAM))
- goto err_release;
- ret = 0;
- cdi->media_written = 0;
- }
- }
-
- if (ret)
- goto err;
-
- cd_dbg(CD_OPEN, "Use count for \"/dev/%s\" now %d\n",
- cdi->name, cdi->use_count);
- return 0;
-err_release:
- if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {
- cdi->ops->lock_door(cdi, 0);
- cd_dbg(CD_OPEN, "door unlocked\n");
- }
- cdi->ops->release(cdi);
-err:
- cdi->use_count--;
- return ret;
-}
-
static
-int open_for_data(struct cdrom_device_info * cdi)
+int open_for_data(struct cdrom_device_info *cdi)
{
int ret;
struct cdrom_device_ops *cdo = cdi->ops;
@@ -1119,6 +1063,62 @@ clean_up_and_return:
return ret;
}
+/* We use the open-option O_NONBLOCK to indicate that the
+ * purpose of opening is only for subsequent ioctl() calls; no device
+ * integrity checks are performed.
+ *
+ * We hope that all cd-player programs will adopt this convention. It
+ * is in their own interest: device control becomes a lot easier
+ * this way.
+ */
+int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,
+ fmode_t mode)
+{
+ int ret;
+
+ cd_dbg(CD_OPEN, "entering cdrom_open\n");
+
+ /* open is event synchronization point, check events first */
+ check_disk_change(bdev);
+
+ /* if this was a O_NONBLOCK open and we should honor the flags,
+ * do a quick open without drive/disc integrity checks. */
+ cdi->use_count++;
+ if ((mode & FMODE_NDELAY) && (cdi->options & CDO_USE_FFLAGS)) {
+ ret = cdi->ops->open(cdi, 1);
+ } else {
+ ret = open_for_data(cdi);
+ if (ret)
+ goto err;
+ cdrom_mmc3_profile(cdi);
+ if (mode & FMODE_WRITE) {
+ ret = -EROFS;
+ if (cdrom_open_write(cdi))
+ goto err_release;
+ if (!CDROM_CAN(CDC_RAM))
+ goto err_release;
+ ret = 0;
+ cdi->media_written = 0;
+ }
+ }
+
+ if (ret)
+ goto err;
+
+ cd_dbg(CD_OPEN, "Use count for \"/dev/%s\" now %d\n",
+ cdi->name, cdi->use_count);
+ return 0;
+err_release:
+ if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {
+ cdi->ops->lock_door(cdi, 0);
+ cd_dbg(CD_OPEN, "door unlocked\n");
+ }
+ cdi->ops->release(cdi);
+err:
+ cdi->use_count--;
+ return ret;
+}
+
/* This code is similar to that in open_for_data. The routine is called
whenever an audio play operation is requested.
*/
--
1.8.1.2.459.gbcd45b4.dirty
next prev parent reply other threads:[~2014-05-05 0:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 1:11 [PATCH 00/12] cdrom: neatening Joe Perches
2013-07-01 1:11 ` [PATCH 01/12] cdrom: convert cdinfo to cd_dbg Joe Perches
2013-07-01 1:11 ` [PATCH 02/12] cdrom: Remove unused CHECKAUDIO macro Joe Perches
2013-07-01 1:11 ` [PATCH 03/12] cdrom: Remove obfuscating IOCTL_IN and IOCTL_OUT macros Joe Perches
2013-07-01 1:11 ` [PATCH 04/12] cdrom: Remove prototype for open_for_data Joe Perches
2013-07-01 1:12 ` [PATCH 05/12] cdrom: Remove unnecessary check_for_audio_disc prototype Joe Perches
2013-07-01 1:12 ` [PATCH 06/12] cdrom: Remove unnecessary sanitize_format prototype Joe Perches
2013-07-01 1:12 ` [PATCH 07/12] cdrom: Move mmc_ioctls above cdrom_ioctl to remove unnecessary prototype Joe Perches
2013-07-01 1:12 ` [PATCH 08/12] cdrom: Remove cdrom_get_last_written prototype Joe Perches
2013-07-01 1:12 ` [PATCH 09/12] cdrom: Remove cdrom_get_next_writeable prototype Joe Perches
2013-07-01 1:12 ` [PATCH 10/12] cdrom: Remove cdrom_count_tracks prototype Joe Perches
2013-07-01 1:12 ` [PATCH 11/12] cdrom: Remove unnecessary prototype for cdrom_mrw_exit Joe Perches
2013-07-01 1:12 ` [PATCH 12/12] cdrom: Remove unnecessary prototype for cdrom_get_disc_info Joe Perches
2013-07-22 22:08 ` [PATCH 00/12] cdrom: neatening Joe Perches
2013-07-22 22:08 ` Jens Axboe
2013-07-22 22:10 ` Joe Perches
2014-05-05 0:05 ` Joe Perches
2014-05-05 0:05 ` [PATCH 01/12] cdrom: convert cdinfo to cd_dbg Joe Perches
2014-05-05 0:05 ` [PATCH 02/12] cdrom: Remove unused CHECKAUDIO macro Joe Perches
2014-05-05 0:05 ` [PATCH 03/12] cdrom: Remove obfuscating IOCTL_IN and IOCTL_OUT macros Joe Perches
2014-05-05 0:05 ` Joe Perches [this message]
2014-05-05 0:05 ` [PATCH 05/12] cdrom: Remove unnecessary check_for_audio_disc prototype Joe Perches
2014-05-05 0:05 ` [PATCH 06/12] cdrom: Remove unnecessary sanitize_format prototype Joe Perches
2014-05-05 0:05 ` [PATCH 07/12] cdrom: Move mmc_ioctls above cdrom_ioctl to remove unnecessary prototype Joe Perches
2014-05-05 0:05 ` [PATCH 08/12] cdrom: Remove cdrom_get_last_written prototype Joe Perches
2014-05-05 0:05 ` [PATCH 09/12] cdrom: Remove cdrom_get_next_writeable prototype Joe Perches
2014-05-05 0:05 ` [PATCH 10/12] cdrom: Remove cdrom_count_tracks prototype Joe Perches
2014-05-05 0:05 ` [PATCH 11/12] cdrom: Remove unnecessary prototype for cdrom_mrw_exit Joe Perches
2014-05-05 0:05 ` [PATCH 12/12] cdrom: Remove unnecessary prototype for cdrom_get_disc_info Joe Perches
2014-05-05 21:02 ` [PATCH 00/12] cdrom: neatening 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=6652632559434a6ffab9836f9217a664d0bd54c4.1399247745.git.joe@perches.com \
--to=joe@perches.com \
--cc=axboe@kernel.dk \
--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).