Lines Matching refs:ctx
38 struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ);
40 mutex_lock(&ctx->sbe_error_lock);
41 if (ctx->sbe_error) {
42 rc = memory_read_from_buffer(buf, count, &pos, ctx->ffdc,
43 ctx->ffdc_len);
44 if (pos >= ctx->ffdc_len)
45 ctx->sbe_error = false;
47 mutex_unlock(&ctx->sbe_error_lock);
53 static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp,
58 mutex_lock(&ctx->sbe_error_lock);
59 if (!ctx->sbe_error) {
60 if (resp_len > ctx->ffdc_size) {
61 kvfree(ctx->ffdc);
62 ctx->ffdc = kvmalloc(resp_len, GFP_KERNEL);
63 if (!ctx->ffdc) {
64 ctx->ffdc_len = 0;
65 ctx->ffdc_size = 0;
69 ctx->ffdc_size = resp_len;
73 ctx->sbe_error = true;
74 ctx->ffdc_len = resp_len;
75 memcpy(ctx->ffdc, resp, resp_len);
79 mutex_unlock(&ctx->sbe_error_lock);
87 struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ);
91 rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len);
95 if (p9_sbe_occ_save_ffdc(ctx, resp, resp_len))
138 struct p9_sbe_occ *ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx),
140 if (!ctx)
143 mutex_init(&ctx->sbe_error_lock);
145 ctx->sbe = pdev->dev.parent;
146 occ = &ctx->occ;
173 struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ);
177 ctx->sbe = NULL;
180 kvfree(ctx->ffdc);