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
f1469785
Commit
f1469785
authored
Jul 02, 2004
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[libata] add ata_queued_cmd completion hook
parent
14d46339
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
14 deletions
+30
-14
drivers/scsi/libata-core.c
drivers/scsi/libata-core.c
+8
-12
drivers/scsi/libata-scsi.c
drivers/scsi/libata-scsi.c
+20
-0
include/linux/libata.h
include/linux/libata.h
+2
-2
No files found.
drivers/scsi/libata-core.c
View file @
f1469785
...
...
@@ -2293,8 +2293,8 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
void
ata_qc_complete
(
struct
ata_queued_cmd
*
qc
,
u8
drv_stat
)
{
struct
ata_port
*
ap
=
qc
->
ap
;
struct
scsi_cmnd
*
cmd
=
qc
->
scsicmd
;
unsigned
int
tag
,
do_clear
=
0
;
int
rc
;
assert
(
qc
!=
NULL
);
/* ata_qc_from_tag _might_ return NULL */
assert
(
qc
->
flags
&
ATA_QCFLAG_ACTIVE
);
...
...
@@ -2302,18 +2302,14 @@ void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
if
(
likely
(
qc
->
flags
&
ATA_QCFLAG_SG
))
ata_sg_clean
(
qc
);
if
(
cmd
)
{
if
(
unlikely
(
drv_stat
&
(
ATA_ERR
|
ATA_BUSY
|
ATA_DRQ
)))
{
if
(
is_atapi_taskfile
(
&
qc
->
tf
))
cmd
->
result
=
SAM_STAT_CHECK_CONDITION
;
else
ata_to_sense_error
(
qc
);
}
else
{
cmd
->
result
=
SAM_STAT_GOOD
;
}
/* call completion callback */
rc
=
qc
->
complete_fn
(
qc
,
drv_stat
);
qc
->
scsidone
(
cmd
);
}
/* if callback indicates not to complete command (non-zero),
* return immediately
*/
if
(
rc
!=
0
)
return
;
qc
->
flags
=
0
;
tag
=
qc
->
tag
;
...
...
drivers/scsi/libata-scsi.c
View file @
f1469785
...
...
@@ -335,6 +335,24 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
return
1
;
}
static
int
ata_scsi_qc_complete
(
struct
ata_queued_cmd
*
qc
,
u8
drv_stat
)
{
struct
scsi_cmnd
*
cmd
=
qc
->
scsicmd
;
if
(
unlikely
(
drv_stat
&
(
ATA_ERR
|
ATA_BUSY
|
ATA_DRQ
)))
{
if
(
is_atapi_taskfile
(
&
qc
->
tf
))
cmd
->
result
=
SAM_STAT_CHECK_CONDITION
;
else
ata_to_sense_error
(
qc
);
}
else
{
cmd
->
result
=
SAM_STAT_GOOD
;
}
qc
->
scsidone
(
cmd
);
return
0
;
}
/**
* ata_scsi_translate - Translate then issue SCSI command to ATA device
* @ap: ATA port to which the command is addressed
...
...
@@ -379,6 +397,8 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev,
qc
->
flags
|=
ATA_QCFLAG_SG
;
/* data is present; dma-map it */
}
qc
->
complete_fn
=
ata_scsi_qc_complete
;
if
(
xlat_func
(
qc
,
scsicmd
))
goto
err_out
;
...
...
include/linux/libata.h
View file @
f1469785
...
...
@@ -158,7 +158,7 @@ struct ata_port;
struct
ata_queued_cmd
;
/* typedefs */
typedef
void
(
*
ata_qc_cb_t
)
(
struct
ata_queued_cmd
*
qc
,
unsigned
int
flags
);
typedef
int
(
*
ata_qc_cb_t
)
(
struct
ata_queued_cmd
*
qc
,
u8
drv_stat
);
struct
ata_ioports
{
unsigned
long
cmd_addr
;
...
...
@@ -224,7 +224,7 @@ struct ata_queued_cmd {
struct
scatterlist
*
sg
;
ata_qc_cb_t
c
allback
;
ata_qc_cb_t
c
omplete_fn
;
struct
completion
*
waiting
;
...
...
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