Skip to content

Commit 9c7d1ee

Browse files
Matthew R. Ochsmartinkpetersen
authored andcommitted
scsi: cxlflash: Refactor context reset to share reset logic
As staging for supporting hardware with different context reset registers but a similar reset procedure, refactor the existing context reset routine to move the reset logic to a common routine. This will allow hardware with a different reset register to leverage existing code. Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 73eba2b commit 9c7d1ee

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎drivers/scsi/cxlflash/main.c‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ static void cmd_complete(struct afu_cmd *cmd)
188188
}
189189

190190
/**
191-
* context_reset_ioarrin() - reset command owner context via IOARRIN register
191+
* context_reset() - reset command owner context via specified register
192192
* @cmd: AFU command that timed out.
193+
* @reset_reg: MMIO register to perform reset.
193194
*/
194-
static void context_reset_ioarrin(struct afu_cmd *cmd)
195+
static void context_reset(struct afu_cmd *cmd, __be64 __iomem *reset_reg)
195196
{
196197
int nretry = 0;
197198
u64 rrin = 0x1;
@@ -201,9 +202,9 @@ static void context_reset_ioarrin(struct afu_cmd *cmd)
201202

202203
pr_debug("%s: cmd=%p\n", __func__, cmd);
203204

204-
writeq_be(rrin, &afu->host_map->ioarrin);
205+
writeq_be(rrin, reset_reg);
205206
do {
206-
rrin = readq_be(&afu->host_map->ioarrin);
207+
rrin = readq_be(reset_reg);
207208
if (rrin != 0x1)
208209
break;
209210
/* Double delay each time */
@@ -214,6 +215,17 @@ static void context_reset_ioarrin(struct afu_cmd *cmd)
214215
__func__, rrin, nretry);
215216
}
216217

218+
/**
219+
* context_reset_ioarrin() - reset command owner context via IOARRIN register
220+
* @cmd: AFU command that timed out.
221+
*/
222+
static void context_reset_ioarrin(struct afu_cmd *cmd)
223+
{
224+
struct afu *afu = cmd->parent;
225+
226+
context_reset(cmd, &afu->host_map->ioarrin);
227+
}
228+
217229
/**
218230
* send_cmd_ioarrin() - sends an AFU command via IOARRIN register
219231
* @afu: AFU associated with the host.

0 commit comments

Comments
 (0)