[PATCH linux dev-4.10 06/16] hwmon (p9_sbe): Rename context variable

Andrew Jeffery andrew at aj.id.au
Thu Feb 15 23:35:56 AEDT 2018


Using 'occ' as the context variable caused naming conflicts in some instances.
Instead use 'ctx' which should make it clear it's the associated drvdata and
make way for calling other object pointers 'occ'.

Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 drivers/hwmon/occ/p9_sbe.c | 54 +++++++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c
index a583c4b3b280..52473d020b24 100644
--- a/drivers/hwmon/occ/p9_sbe.c
+++ b/drivers/hwmon/occ/p9_sbe.c
@@ -40,42 +40,42 @@ struct p9_sbe_occ {
 
 #define to_p9_sbe_occ(x)	container_of((x), struct p9_sbe_occ, occ)
 
-static void p9_sbe_occ_close_client(struct p9_sbe_occ *occ)
+static void p9_sbe_occ_close_client(struct p9_sbe_occ *ctx)
 {
 	struct occ_client *tmp_client;
 
-	spin_lock_irq(&occ->lock);
-	tmp_client = occ->client;
-	occ->client = NULL;
+	spin_lock_irq(&ctx->lock);
+	tmp_client = ctx->client;
+	ctx->client = NULL;
 	occ_drv_release(tmp_client);
-	spin_unlock_irq(&occ->lock);
+	spin_unlock_irq(&ctx->lock);
 }
 
 static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd)
 {
 	int rc, error;
 	struct occ_response *resp = &occ->resp;
-	struct p9_sbe_occ *p9_sbe_occ = to_p9_sbe_occ(occ);
+	struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ);
 
-	spin_lock_irq(&p9_sbe_occ->lock);
-	if (p9_sbe_occ->sbe)
-		p9_sbe_occ->client = occ_drv_open(p9_sbe_occ->sbe, 0);
-	spin_unlock_irq(&p9_sbe_occ->lock);
+	spin_lock_irq(&ctx->lock);
+	if (ctx->sbe)
+		ctx->client = occ_drv_open(ctx->sbe, 0);
+	spin_unlock_irq(&ctx->lock);
 
-	if (!p9_sbe_occ->client) {
+	if (!ctx->client) {
 		rc = -ENODEV;
 		goto assign;
 	}
 
-	rc = occ_drv_write(p9_sbe_occ->client, (const char *)&cmd[1], 7);
+	rc = occ_drv_write(ctx->client, (const char *)&cmd[1], 7);
 	if (rc < 0)
 		goto err;
 
-	rc = occ_drv_read(p9_sbe_occ->client, (char *)resp, sizeof(*resp));
+	rc = occ_drv_read(ctx->client, (char *)resp, sizeof(*resp));
 	if (rc < 0)
 		goto err;
 
-	p9_sbe_occ_close_client(p9_sbe_occ);
+	p9_sbe_occ_close_client(ctx);
 
 	switch (resp->return_status) {
 	case RESP_RETURN_CMD_IN_PRG:
@@ -103,7 +103,7 @@ static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd)
 	goto done;
 
 err:
-	p9_sbe_occ_close_client(p9_sbe_occ);
+	p9_sbe_occ_close_client(ctx);
 	dev_err(occ->bus_dev, "occ bus op failed rc:%d\n", rc);
 assign:
 	error = rc;
@@ -112,10 +112,10 @@ static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd)
 	return rc;
 }
 
-static int p9_sbe_occ_setup(struct p9_sbe_occ *p9_sbe_occ)
+static int p9_sbe_occ_setup(struct p9_sbe_occ *ctx)
 {
 	int rc;
-	struct occ *occ = &p9_sbe_occ->occ;
+	struct occ *occ = &ctx->occ;
 
 	/* no need to lock */
 	rc = occ_poll(occ);
@@ -154,16 +154,16 @@ static int p9_sbe_occ_probe(struct platform_device *pdev)
 {
 	int rc;
 	struct occ *occ;
-	struct p9_sbe_occ *p9_sbe_occ = devm_kzalloc(&pdev->dev,
-						     sizeof(*p9_sbe_occ),
+	struct p9_sbe_occ *ctx = devm_kzalloc(&pdev->dev,
+						     sizeof(*ctx),
 						     GFP_KERNEL);
-	if (!p9_sbe_occ)
+	if (!ctx)
 		return -ENOMEM;
 
-	p9_sbe_occ->sbe = pdev->dev.parent;
+	ctx->sbe = pdev->dev.parent;
 
-	occ = &p9_sbe_occ->occ;
-	spin_lock_init(&p9_sbe_occ->lock);
+	occ = &ctx->occ;
+	spin_lock_init(&ctx->lock);
 	occ->bus_dev = &pdev->dev;
 	occ->groups[0] = &occ->group;
 	occ->poll_cmd_data = 0x20;
@@ -172,7 +172,7 @@ static int p9_sbe_occ_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, occ);
 
-	rc = p9_sbe_occ_setup(p9_sbe_occ);
+	rc = p9_sbe_occ_setup(ctx);
 	if (rc)
 		return rc;
 
@@ -182,10 +182,10 @@ static int p9_sbe_occ_probe(struct platform_device *pdev)
 static int p9_sbe_occ_remove(struct platform_device *pdev)
 {
 	struct occ *occ = platform_get_drvdata(pdev);
-	struct p9_sbe_occ *p9_sbe_occ = to_p9_sbe_occ(occ);
+	struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ);
 
-	p9_sbe_occ->sbe = NULL;
-	p9_sbe_occ_close_client(p9_sbe_occ);
+	ctx->sbe = NULL;
+	p9_sbe_occ_close_client(ctx);
 	occ_remove_status_attrs(occ);
 
 	return 0;
-- 
2.14.1



More information about the openbmc mailing list