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
6f412f83
Commit
6f412f83
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import 2.3.19
parent
1b07d48b
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
180 additions
and
104 deletions
+180
-104
drivers/scsi/sr.c
drivers/scsi/sr.c
+27
-23
drivers/scsi/sr_ioctl.c
drivers/scsi/sr_ioctl.c
+2
-5
include/asm-i386/spinlock.h
include/asm-i386/spinlock.h
+1
-2
include/linux/cdrom.h
include/linux/cdrom.h
+150
-74
No files found.
drivers/scsi/sr.c
View file @
6f412f83
...
...
@@ -47,7 +47,9 @@
#include <scsi/scsi_ioctl.h>
/* For the door lock/unlock commands */
#include "constants.h"
#ifdef MODULE
MODULE_PARM
(
xa_test
,
"i"
);
/* see sr_ioctl.c */
#endif
#define MAX_RETRIES 3
#define SR_TIMEOUT (30 * HZ)
...
...
@@ -106,9 +108,10 @@ static struct cdrom_device_ops sr_dops =
sr_audio_ioctl
,
/* audio ioctl */
sr_dev_ioctl
,
/* device-specific ioctl */
CDC_CLOSE_TRAY
|
CDC_OPEN_TRAY
|
CDC_LOCK
|
CDC_SELECT_SPEED
|
CDC_MULTI_SESSION
|
CDC_MCN
|
CDC_MEDIA_CHANGED
|
CDC_PLAY_AUDIO
|
CDC_RESET
|
CDC_IOCTLS
|
CDC_DRIVE_STATUS
|
CDC_CD_R
|
CDC_CD_RW
|
CDC_DVD
|
CDC_DVD_R
|
CDC_DVD_RAM
|
CDC_GENERIC_PACKET
,
CDC_SELECT_DISC
|
CDC_MULTI_SESSION
|
CDC_MCN
|
CDC_MEDIA_CHANGED
|
CDC_PLAY_AUDIO
|
CDC_RESET
|
CDC_IOCTLS
|
CDC_DRIVE_STATUS
|
CDC_CD_R
|
CDC_CD_RW
|
CDC_DVD
|
CDC_DVD_R
|
CDC_DVD_RAM
|
CDC_GENERIC_PACKET
,
0
,
sr_packet
};
...
...
@@ -874,17 +877,9 @@ void get_sectorsize(int i)
memset
(
buffer
,
0
,
8
);
/* Do the command and wait.. */
{
DECLARE_MUTEX_LOCKED
(
sem
);
SCpnt
->
request
.
sem
=
&
sem
;
spin_lock_irqsave
(
&
io_request_lock
,
flags
);
scsi_do_cmd
(
SCpnt
,
(
void
*
)
cmd
,
(
void
*
)
buffer
,
512
,
sr_init_done
,
SR_TIMEOUT
,
MAX_RETRIES
);
spin_unlock_irqrestore
(
&
io_request_lock
,
flags
);
down
(
&
sem
);
}
scsi_wait_cmd
(
SCpnt
,
(
void
*
)
cmd
,
(
void
*
)
buffer
,
512
,
sr_init_done
,
SR_TIMEOUT
,
MAX_RETRIES
);
the_result
=
SCpnt
->
result
;
retries
--
;
...
...
@@ -958,7 +953,7 @@ void get_capabilities(int i)
"pop-up"
,
""
,
"changer"
,
"changer"
,
"c
artridge c
hanger"
,
""
,
""
};
...
...
@@ -1010,6 +1005,20 @@ void get_capabilities(int i)
if
((
buffer
[
n
+
3
]
&
0x1
)
==
0
)
/* can't write CD-R media */
scsi_CDs
[
i
].
cdi
.
mask
|=
CDC_CD_R
;
if
((
buffer
[
n
+
6
]
&
0x8
)
==
0
)
/* can't eject */
scsi_CDs
[
i
].
cdi
.
mask
|=
CDC_OPEN_TRAY
;
if
((
buffer
[
n
+
6
]
>>
5
)
==
mechtype_individual_changer
||
(
buffer
[
n
+
6
]
>>
5
)
==
mechtype_cartridge_changer
)
scsi_CDs
[
i
].
cdi
.
capacity
=
cdrom_number_of_slots
(
&
(
scsi_CDs
[
i
].
cdi
));
if
(
scsi_CDs
[
i
].
cdi
.
capacity
<=
1
)
/* not a changer */
scsi_CDs
[
i
].
cdi
.
mask
|=
CDC_SELECT_DISC
;
/*else I don't think it can close its tray
scsi_CDs[i].cdi.mask |= CDC_CLOSE_TRAY; */
scsi_free
(
buffer
,
512
);
}
...
...
@@ -1022,7 +1031,6 @@ static int sr_packet(struct cdrom_device_info *cdi, struct cdrom_generic_command
{
Scsi_Cmnd
*
SCpnt
;
Scsi_Device
*
device
=
scsi_CDs
[
MINOR
(
cdi
->
dev
)].
device
;
DECLARE_MUTEX_LOCKED
(
sem
);
unsigned
long
flags
;
int
stat
;
...
...
@@ -1036,15 +1044,11 @@ static int sr_packet(struct cdrom_device_info *cdi, struct cdrom_generic_command
/* do the locking and issue the command */
SCpnt
->
request
.
rq_dev
=
cdi
->
dev
;
SCpnt
->
request
.
rq_status
=
RQ_SCSI_BUSY
;
/* scsi_do_cmd sets the command length */
SCpnt
->
cmd_len
=
0
;
SCpnt
->
request
.
sem
=
&
sem
;
spin_lock_irqsave
(
&
io_request_lock
,
flags
);
scsi_do_cmd
(
SCpnt
,
(
void
*
)
cgc
->
cmd
,
(
void
*
)
cgc
->
buffer
,
cgc
->
buflen
,
sr_init_done
,
SR_TIMEOUT
,
MAX_RETRIES
);
spin_unlock_irqrestore
(
&
io_request_lock
,
flags
);
down
(
&
sem
);
scsi_wait_cmd
(
SCpnt
,
(
void
*
)
cgc
->
cmd
,
(
void
*
)
cgc
->
buffer
,
cgc
->
buflen
,
sr_init_done
,
SR_TIMEOUT
,
MAX_RETRIES
);
stat
=
SCpnt
->
result
;
...
...
drivers/scsi/sr_ioctl.c
View file @
6f412f83
...
...
@@ -293,16 +293,14 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed)
int
sr_audio_ioctl
(
struct
cdrom_device_info
*
cdi
,
unsigned
int
cmd
,
void
*
arg
)
{
u_char
sr_cmd
[
10
];
int
result
,
target
;
target
=
MINOR
(
cdi
->
dev
);
int
result
,
target
=
MINOR
(
cdi
->
dev
);
unsigned
char
buffer
[
32
];
switch
(
cmd
)
{
case
CDROMREADTOCHDR
:
{
struct
cdrom_tochdr
*
tochdr
=
(
struct
cdrom_tochdr
*
)
arg
;
char
buffer
[
32
];
sr_cmd
[
0
]
=
GPCMD_READ_TOC_PMA_ATIP
;
sr_cmd
[
1
]
=
((
scsi_CDs
[
target
].
device
->
lun
)
<<
5
);
...
...
@@ -323,7 +321,6 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void* arg)
case
CDROMREADTOCENTRY
:
{
struct
cdrom_tocentry
*
tocentry
=
(
struct
cdrom_tocentry
*
)
arg
;
unsigned
char
buffer
[
32
];
sr_cmd
[
0
]
=
GPCMD_READ_TOC_PMA_ATIP
;
sr_cmd
[
1
]
=
((
scsi_CDs
[
target
].
device
->
lun
)
<<
5
)
|
...
...
include/asm-i386/spinlock.h
View file @
6f412f83
...
...
@@ -62,10 +62,9 @@ __asm__ __volatile__( \
*/
typedef
struct
{
volatile
unsigned
int
lock
;
unsigned
long
previous
;
}
rwlock_t
;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0
, 0
}
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
/*
* On x86, we implement read-write locks as a 32-bit counter
...
...
include/linux/cdrom.h
View file @
6f412f83
This diff is collapsed.
Click to expand it.
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