Skip to content

Commit 4111cde

Browse files
kvaneeshmpe
authored andcommitted
powerpc/nvdimm: Use HCALL error as the return value
This simplifies the error handling and also enable us to switch to H_SCM_QUERY hcall in a later patch on H_OVERLAP error. We also do some kernel print formatting fixup in this patch. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 93cad5f commit 4111cde

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

arch/powerpc/platforms/pseries/papr_scm.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,28 +66,22 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
6666
} while (rc == H_BUSY);
6767

6868
if (rc) {
69-
/* H_OVERLAP needs a separate error path */
70-
if (rc == H_OVERLAP)
71-
return -EBUSY;
72-
7369
dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
74-
return -ENXIO;
70+
return rc;
7571
}
7672

7773
p->bound_addr = saved;
78-
79-
dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res);
80-
81-
return 0;
74+
dev_dbg(&p->pdev->dev, "bound drc 0x%x to %pR\n", p->drc_index, &p->res);
75+
return rc;
8276
}
8377

84-
static int drc_pmem_unbind(struct papr_scm_priv *p)
78+
static void drc_pmem_unbind(struct papr_scm_priv *p)
8579
{
8680
unsigned long ret[PLPAR_HCALL_BUFSIZE];
8781
uint64_t token = 0;
8882
int64_t rc;
8983

90-
dev_dbg(&p->pdev->dev, "unbind drc %x\n", p->drc_index);
84+
dev_dbg(&p->pdev->dev, "unbind drc 0x%x\n", p->drc_index);
9185

9286
/* NB: unbind has the same retry requirements as drc_pmem_bind() */
9387
do {
@@ -110,10 +104,10 @@ static int drc_pmem_unbind(struct papr_scm_priv *p)
110104
if (rc)
111105
dev_err(&p->pdev->dev, "unbind error: %lld\n", rc);
112106
else
113-
dev_dbg(&p->pdev->dev, "unbind drc %x complete\n",
107+
dev_dbg(&p->pdev->dev, "unbind drc 0x%x complete\n",
114108
p->drc_index);
115109

116-
return rc == H_SUCCESS ? 0 : -ENXIO;
110+
return;
117111
}
118112

119113
static int papr_scm_meta_get(struct papr_scm_priv *p,
@@ -436,14 +430,16 @@ static int papr_scm_probe(struct platform_device *pdev)
436430
rc = drc_pmem_bind(p);
437431

438432
/* If phyp says drc memory still bound then force unbound and retry */
439-
if (rc == -EBUSY) {
433+
if (rc == H_OVERLAP) {
440434
dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
441435
drc_pmem_unbind(p);
442436
rc = drc_pmem_bind(p);
443437
}
444438

445-
if (rc)
439+
if (rc != H_SUCCESS) {
440+
rc = -ENXIO;
446441
goto err;
442+
}
447443

448444
/* setup the resource for the newly bound range */
449445
p->res.start = p->bound_addr;

0 commit comments

Comments
 (0)