Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
06869782
Commit
06869782
authored
Oct 17, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Oct 17, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] gscd.c
* switched to private queue * set ->queue * switched to new methods
parent
4ecbc558
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
63 deletions
+43
-63
drivers/cdrom/gscd.c
drivers/cdrom/gscd.c
+43
-63
No files found.
drivers/cdrom/gscd.c
View file @
06869782
...
@@ -70,7 +70,6 @@
...
@@ -70,7 +70,6 @@
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#define MAJOR_NR GOLDSTAR_CDROM_MAJOR
#define MAJOR_NR GOLDSTAR_CDROM_MAJOR
#define DEVICE_NR(device) (minor(device))
#include <linux/blk.h>
#include <linux/blk.h>
#define gscd_port gscd
/* for compatible parameter passing with "insmod" */
#define gscd_port gscd
/* for compatible parameter passing with "insmod" */
#include "gscd.h"
#include "gscd.h"
...
@@ -86,7 +85,7 @@ MODULE_PARM(gscd, "h");
...
@@ -86,7 +85,7 @@ MODULE_PARM(gscd, "h");
* static DECLARE_WAIT_QUEUE_HEAD(gscd_waitq);
* static DECLARE_WAIT_QUEUE_HEAD(gscd_waitq);
*/
*/
static
void
gscd_read_cmd
(
void
);
static
void
gscd_read_cmd
(
struct
request
*
req
);
static
void
gscd_hsg2msf
(
long
hsg
,
struct
msf
*
msf
);
static
void
gscd_hsg2msf
(
long
hsg
,
struct
msf
*
msf
);
static
void
gscd_bin2bcd
(
unsigned
char
*
p
);
static
void
gscd_bin2bcd
(
unsigned
char
*
p
);
...
@@ -97,7 +96,7 @@ static int gscd_ioctl(struct inode *, struct file *, unsigned int,
...
@@ -97,7 +96,7 @@ static int gscd_ioctl(struct inode *, struct file *, unsigned int,
unsigned
long
);
unsigned
long
);
static
int
gscd_open
(
struct
inode
*
,
struct
file
*
);
static
int
gscd_open
(
struct
inode
*
,
struct
file
*
);
static
int
gscd_release
(
struct
inode
*
,
struct
file
*
);
static
int
gscd_release
(
struct
inode
*
,
struct
file
*
);
static
int
check_gscd_med_chg
(
kdev_t
);
static
int
check_gscd_med_chg
(
struct
gendisk
*
disk
);
/* GoldStar Funktionen */
/* GoldStar Funktionen */
...
@@ -151,35 +150,25 @@ static int AudioEnd_f;
...
@@ -151,35 +150,25 @@ static int AudioEnd_f;
static
struct
timer_list
gscd_timer
;
static
struct
timer_list
gscd_timer
;
static
spinlock_t
gscd_lock
=
SPIN_LOCK_UNLOCKED
;
static
spinlock_t
gscd_lock
=
SPIN_LOCK_UNLOCKED
;
struct
request_queue
gscd_queue
;
static
struct
block_device_operations
gscd_fops
=
{
static
struct
block_device_operations
gscd_fops
=
{
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
open
=
gscd_open
,
.
open
=
gscd_open
,
.
release
=
gscd_release
,
.
release
=
gscd_release
,
.
ioctl
=
gscd_ioctl
,
.
ioctl
=
gscd_ioctl
,
.
check_media_change
=
check_gscd_med_chg
,
.
media_changed
=
check_gscd_med_chg
,
};
};
/*
/*
* Checking if the media has been changed
* Checking if the media has been changed
* (not yet implemented)
* (not yet implemented)
*/
*/
static
int
check_gscd_med_chg
(
kdev_t
full_dev
)
static
int
check_gscd_med_chg
(
struct
gendisk
*
disk
)
{
{
int
target
;
target
=
minor
(
full_dev
);
if
(
target
>
0
)
{
printk
(
"GSCD: GoldStar CD-ROM request error: invalid device.
\n
"
);
return
0
;
}
#ifdef GSCD_DEBUG
#ifdef GSCD_DEBUG
printk
(
"gscd: check_med_change
\n
"
);
printk
(
"gscd: check_med_change
\n
"
);
#endif
#endif
return
0
;
return
0
;
}
}
...
@@ -240,16 +229,14 @@ static int gscd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
...
@@ -240,16 +229,14 @@ static int gscd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
* When Linux gets variable block sizes this will probably go away.
* When Linux gets variable block sizes this will probably go away.
*/
*/
static
void
gscd_transfer
(
void
)
static
void
gscd_transfer
(
struct
request
*
req
)
{
{
long
offs
;
while
(
req
->
nr_sectors
>
0
&&
gscd_bn
==
req
->
sector
/
4
)
{
long
offs
=
(
req
->
sector
&
3
)
*
512
;
while
(
CURRENT
->
nr_sectors
>
0
&&
gscd_bn
==
CURRENT
->
sector
/
4
)
{
memcpy
(
req
->
buffer
,
gscd_buf
+
offs
,
512
);
offs
=
(
CURRENT
->
sector
&
3
)
*
512
;
req
->
nr_sectors
--
;
memcpy
(
CURRENT
->
buffer
,
gscd_buf
+
offs
,
512
);
req
->
sector
++
;
CURRENT
->
nr_sectors
--
;
req
->
buffer
+=
512
;
CURRENT
->
sector
++
;
CURRENT
->
buffer
+=
512
;
}
}
}
}
...
@@ -265,46 +252,40 @@ static void do_gscd_request(request_queue_t * q)
...
@@ -265,46 +252,40 @@ static void do_gscd_request(request_queue_t * q)
static
void
__do_gscd_request
(
unsigned
long
dummy
)
static
void
__do_gscd_request
(
unsigned
long
dummy
)
{
{
unsigned
int
block
,
dev
;
struct
request
*
req
;
unsigned
int
block
;
unsigned
int
nsect
;
unsigned
int
nsect
;
repeat:
repeat:
if
(
blk_queue_empty
(
QUEUE
))
if
(
blk_queue_empty
(
&
gscd_queue
))
return
;
return
;
dev
=
minor
(
CURRENT
->
rq_dev
);
req
=
elv_next_request
(
&
gscd_queue
);
block
=
CURRENT
->
sector
;
block
=
req
->
sector
;
nsect
=
CURRENT
->
nr_sectors
;
nsect
=
req
->
nr_sectors
;
if
(
CURRENT
->
sector
==
-
1
)
if
(
req
->
sector
==
-
1
)
goto
out
;
goto
out
;
if
(
CURRENT
->
cmd
!=
READ
)
{
if
(
req
->
cmd
!=
READ
)
{
printk
(
"GSCD: bad cmd %p
\n
"
,
CURRENT
->
cmd
);
printk
(
"GSCD: bad cmd %p
\n
"
,
req
->
cmd
);
end_request
(
CURRENT
,
0
);
end_request
(
req
,
0
);
goto
repeat
;
goto
repeat
;
}
}
if
(
dev
!=
0
)
{
gscd_transfer
(
req
);
printk
(
"GSCD: this version supports only one device
\n
"
);
end_request
(
CURRENT
,
0
);
goto
repeat
;
}
gscd_transfer
();
/* if we satisfied the request from the buffer, we're done. */
/* if we satisfied the request from the buffer, we're done. */
if
(
CURRENT
->
nr_sectors
==
0
)
{
if
(
req
->
nr_sectors
==
0
)
{
end_request
(
CURRENT
,
1
);
end_request
(
req
,
1
);
goto
repeat
;
goto
repeat
;
}
}
#ifdef GSCD_DEBUG
#ifdef GSCD_DEBUG
printk
(
"GSCD:
dev %d, block %d, nsect %d
\n
"
,
dev
,
block
,
nsect
);
printk
(
"GSCD:
block %d, nsect %d
\n
"
,
block
,
nsect
);
#endif
#endif
gscd_read_cmd
(
req
);
gscd_read_cmd
();
out:
out:
return
;
return
;
}
}
...
@@ -315,25 +296,23 @@ static void __do_gscd_request(unsigned long dummy)
...
@@ -315,25 +296,23 @@ static void __do_gscd_request(unsigned long dummy)
* read-data command.
* read-data command.
*/
*/
static
void
gscd_read_cmd
(
void
)
static
void
gscd_read_cmd
(
struct
request
*
req
)
{
{
long
block
;
long
block
;
struct
gscd_Play_msf
gscdcmd
;
struct
gscd_Play_msf
gscdcmd
;
char
cmd
[]
=
{
CMD_READ
,
0x80
,
0
,
0
,
0
,
0
,
1
};
/* cmd mode M-S-F secth sectl */
char
cmd
[]
=
{
CMD_READ
,
0x80
,
0
,
0
,
0
,
0
,
1
};
/* cmd mode M-S-F secth sectl */
cmd_status
();
cmd_status
();
if
(
disk_state
&
(
ST_NO_DISK
|
ST_DOOR_OPEN
))
{
if
(
disk_state
&
(
ST_NO_DISK
|
ST_DOOR_OPEN
))
{
printk
(
"GSCD: no disk or door open
\n
"
);
printk
(
"GSCD: no disk or door open
\n
"
);
end_request
(
CURRENT
,
0
);
end_request
(
req
,
0
);
}
else
{
}
else
{
if
(
disk_state
&
ST_INVALID
)
{
if
(
disk_state
&
ST_INVALID
)
{
printk
(
"GSCD: disk invalid
\n
"
);
printk
(
"GSCD: disk invalid
\n
"
);
end_request
(
CURRENT
,
0
);
end_request
(
req
,
0
);
}
else
{
}
else
{
gscd_bn
=
-
1
;
/* purge our buffer */
gscd_bn
=
-
1
;
/* purge our buffer */
block
=
CURRENT
->
sector
/
4
;
block
=
req
->
sector
/
4
;
gscd_hsg2msf
(
block
,
&
gscdcmd
.
start
);
/* cvt to msf format */
gscd_hsg2msf
(
block
,
&
gscdcmd
.
start
);
/* cvt to msf format */
cmd
[
2
]
=
gscdcmd
.
start
.
min
;
cmd
[
2
]
=
gscdcmd
.
start
.
min
;
...
@@ -347,9 +326,9 @@ static void gscd_read_cmd(void)
...
@@ -347,9 +326,9 @@ static void gscd_read_cmd(void)
cmd_out
(
TYPE_DATA
,
(
char
*
)
&
cmd
,
cmd_out
(
TYPE_DATA
,
(
char
*
)
&
cmd
,
(
char
*
)
&
gscd_buf
[
0
],
1
);
(
char
*
)
&
gscd_buf
[
0
],
1
);
gscd_bn
=
CURRENT
->
sector
/
4
;
gscd_bn
=
req
->
sector
/
4
;
gscd_transfer
();
gscd_transfer
(
req
);
end_request
(
CURRENT
,
1
);
end_request
(
req
,
1
);
}
}
}
}
SET_TIMER
(
__do_gscd_request
,
1
);
SET_TIMER
(
__do_gscd_request
,
1
);
...
@@ -911,7 +890,7 @@ static void __exit gscd_exit(void)
...
@@ -911,7 +890,7 @@ static void __exit gscd_exit(void)
printk
(
"What's that: can't unregister GoldStar-module
\n
"
);
printk
(
"What's that: can't unregister GoldStar-module
\n
"
);
return
;
return
;
}
}
blk_cleanup_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
)
);
blk_cleanup_queue
(
&
gscd_queue
);
release_region
(
gscd_port
,
GSCD_IO_EXTENT
);
release_region
(
gscd_port
,
GSCD_IO_EXTENT
);
printk
(
KERN_INFO
"GoldStar-module released.
\n
"
);
printk
(
KERN_INFO
"GoldStar-module released.
\n
"
);
}
}
...
@@ -989,11 +968,12 @@ static int __init gscd_init(void)
...
@@ -989,11 +968,12 @@ static int __init gscd_init(void)
devfs_register
(
NULL
,
"gscd"
,
DEVFS_FL_DEFAULT
,
MAJOR_NR
,
0
,
devfs_register
(
NULL
,
"gscd"
,
DEVFS_FL_DEFAULT
,
MAJOR_NR
,
0
,
S_IFBLK
|
S_IRUGO
|
S_IWUGO
,
&
gscd_fops
,
NULL
);
S_IFBLK
|
S_IRUGO
|
S_IWUGO
,
&
gscd_fops
,
NULL
);
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
)
,
do_gscd_request
,
&
gscd_lock
);
blk_init_queue
(
&
gscd_queue
,
do_gscd_request
,
&
gscd_lock
);
disk_state
=
0
;
disk_state
=
0
;
gscdPresent
=
1
;
gscdPresent
=
1
;
gscd_disk
->
queue
=
&
gscd_queue
;
add_disk
(
gscd_disk
);
add_disk
(
gscd_disk
);
printk
(
KERN_INFO
"GSCD: GoldStar CD-ROM Drive found.
\n
"
);
printk
(
KERN_INFO
"GSCD: GoldStar CD-ROM Drive found.
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment