Skip to content

Commit feac6a0

Browse files
Martin Petermannjejb
authored andcommitted
[SCSI] zfcp: Move status accessors from zfcp to SCSI include file.
Move the accessor functions for the scsi_cmnd status from zfcp to the SCSI include file. Change the interface to the functions to pass the scsi_cmnd pointer instead of the status pointer. Signed-off-by: Martin Petermann <martin@linux.vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
1 parent 5d4e226 commit feac6a0

4 files changed

Lines changed: 28 additions & 35 deletions

File tree

‎drivers/s390/scsi/zfcp_ext.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ extern int zfcp_adapter_scsi_register(struct zfcp_adapter *);
103103
extern void zfcp_adapter_scsi_unregister(struct zfcp_adapter *);
104104
extern void zfcp_set_fcp_dl(struct fcp_cmnd_iu *, fcp_dl_t);
105105
extern char *zfcp_get_fcp_rsp_info_ptr(struct fcp_rsp_iu *);
106-
extern void set_host_byte(int *, char);
107-
extern void set_driver_byte(int *, char);
108106
extern char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *);
109107
extern fcp_dl_t zfcp_get_fcp_dl(struct fcp_cmnd_iu *);
110108

‎drivers/s390/scsi/zfcp_fsf.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,18 +3040,18 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
30403040
* DID_SOFT_ERROR by retrying the request for devices
30413041
* that allow retries.
30423042
*/
3043-
set_host_byte(&scpnt->result, DID_SOFT_ERROR);
3044-
set_driver_byte(&scpnt->result, SUGGEST_RETRY);
3043+
set_host_byte(scpnt, DID_SOFT_ERROR);
3044+
set_driver_byte(scpnt, SUGGEST_RETRY);
30453045
goto skip_fsfstatus;
30463046
}
30473047

30483048
if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
3049-
set_host_byte(&scpnt->result, DID_ERROR);
3049+
set_host_byte(scpnt, DID_ERROR);
30503050
goto skip_fsfstatus;
30513051
}
30523052

30533053
/* set message byte of result in SCSI command */
3054-
scpnt->result |= COMMAND_COMPLETE << 8;
3054+
set_msg_byte(scpnt, COMMAND_COMPLETE);
30553055

30563056
/*
30573057
* copy SCSI status code of FCP_STATUS of FCP_RSP IU to status byte
@@ -3067,23 +3067,23 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
30673067
switch (fcp_rsp_info[3]) {
30683068
case RSP_CODE_GOOD:
30693069
/* ok, continue */
3070-
set_host_byte(&scpnt->result, DID_OK);
3070+
set_host_byte(scpnt, DID_OK);
30713071
break;
30723072
case RSP_CODE_LENGTH_MISMATCH:
30733073
/* hardware bug */
3074-
set_host_byte(&scpnt->result, DID_ERROR);
3074+
set_host_byte(scpnt, DID_ERROR);
30753075
goto skip_fsfstatus;
30763076
case RSP_CODE_FIELD_INVALID:
30773077
/* driver or hardware bug */
3078-
set_host_byte(&scpnt->result, DID_ERROR);
3078+
set_host_byte(scpnt, DID_ERROR);
30793079
goto skip_fsfstatus;
30803080
case RSP_CODE_RO_MISMATCH:
30813081
/* hardware bug */
3082-
set_host_byte(&scpnt->result, DID_ERROR);
3082+
set_host_byte(scpnt, DID_ERROR);
30833083
goto skip_fsfstatus;
30843084
default:
30853085
/* invalid FCP response code */
3086-
set_host_byte(&scpnt->result, DID_ERROR);
3086+
set_host_byte(scpnt, DID_ERROR);
30873087
goto skip_fsfstatus;
30883088
}
30893089
}
@@ -3104,7 +3104,7 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
31043104
scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid);
31053105
if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) <
31063106
scpnt->underflow)
3107-
set_host_byte(&scpnt->result, DID_ERROR);
3107+
set_host_byte(scpnt, DID_ERROR);
31083108
}
31093109

31103110
skip_fsfstatus:

‎drivers/s390/scsi/zfcp_scsi.c‎

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -107,28 +107,6 @@ zfcp_set_fcp_dl(struct fcp_cmnd_iu *fcp_cmd, fcp_dl_t fcp_dl)
107107
*zfcp_get_fcp_dl_ptr(fcp_cmd) = fcp_dl;
108108
}
109109

110-
/*
111-
* note: it's a bit-or operation not an assignment
112-
* regarding the specified byte
113-
*/
114-
static inline void
115-
set_byte(int *result, char status, char pos)
116-
{
117-
*result |= status << (pos * 8);
118-
}
119-
120-
void
121-
set_host_byte(int *result, char status)
122-
{
123-
set_byte(result, status, 2);
124-
}
125-
126-
void
127-
set_driver_byte(int *result, char status)
128-
{
129-
set_byte(result, status, 3);
130-
}
131-
132110
static int
133111
zfcp_scsi_slave_alloc(struct scsi_device *sdp)
134112
{
@@ -196,7 +174,7 @@ zfcp_scsi_slave_configure(struct scsi_device *sdp)
196174
static void
197175
zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
198176
{
199-
set_host_byte(&scpnt->result, result);
177+
set_host_byte(scpnt, result);
200178
if ((scpnt->device != NULL) && (scpnt->device->host != NULL))
201179
zfcp_scsi_dbf_event_result("fail", 4,
202180
(struct zfcp_adapter*) scpnt->device->host->hostdata[0],

‎include/scsi/scsi.h‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define _SCSI_SCSI_H
1010

1111
#include <linux/types.h>
12+
#include <scsi/scsi_cmnd.h>
1213

1314
/*
1415
* The maximum number of SG segments that we will put inside a
@@ -425,6 +426,22 @@ struct scsi_lun {
425426
#define driver_byte(result) (((result) >> 24) & 0xff)
426427
#define suggestion(result) (driver_byte(result) & SUGGEST_MASK)
427428

429+
static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
430+
{
431+
cmd->result |= status << 8;
432+
}
433+
434+
static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
435+
{
436+
cmd->result |= status << 16;
437+
}
438+
439+
static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
440+
{
441+
cmd->result |= status << 24;
442+
}
443+
444+
428445
#define sense_class(sense) (((sense) >> 4) & 0x7)
429446
#define sense_error(sense) ((sense) & 0xf)
430447
#define sense_valid(sense) ((sense) & 0x80);

0 commit comments

Comments
 (0)