All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: openbmc@lists.ozlabs.org
Subject: [PATCH linux dev-4.13 09/10] fsi/occ: Don't set driver data late
Date: Thu, 24 May 2018 15:14:28 +1000	[thread overview]
Message-ID: <20180524051429.4638-9-benh@kernel.crashing.org> (raw)
In-Reply-To: <20180524051429.4638-1-benh@kernel.crashing.org>

Until now, the OCC driver was setting the driver data after
registering the character device and the hwmon device.

This might have been intentional, as doing so makes the initial
probe of the OCC by the hwmon device fail while the data is NULL
(provided you are lucky and the hwmon driver doesn't get bound
asynchronously). That failure used to be necessary, otherwise
the driver would try to access the SBE fifo at a time when it's
not ready, causing all sort of problems.

The new SBE fifo driver is much more robust and will return an
appropriate error code, so that (fragile) tweak is no longer
necessary.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 drivers/fsi/fsi-occ.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
index 3f96d7ddea91..15f41f45fb31 100644
--- a/drivers/fsi/fsi-occ.c
+++ b/drivers/fsi/fsi-occ.c
@@ -794,6 +794,8 @@ static int occ_probe(struct platform_device *pdev)
 		occ->idx = ida_simple_get(&occ_ida, 1, INT_MAX, GFP_KERNEL);
 	}
 
+	platform_set_drvdata(pdev, occ);
+
 	snprintf(occ->name, sizeof(occ->name), "occ%d", occ->idx);
 	occ->mdev.fops = &occ_fops;
 	occ->mdev.minor = MISC_DYNAMIC_MINOR;
@@ -812,8 +814,6 @@ static int occ_probe(struct platform_device *pdev)
 	if (!hwmon_dev)
 		dev_warn(dev, "failed to create hwmon device\n");
 
-	platform_set_drvdata(pdev, occ);
-
 	return 0;
 }
 
-- 
2.17.0

  parent reply	other threads:[~2018-05-24  5:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24  5:14 [PATCH linux dev-4.13 01/10] fsi/gpio: Include command build in locked section Benjamin Herrenschmidt
2018-05-24  5:14 ` [PATCH linux dev-4.13 02/10] fsi/gpio: Use relative-addressing commands Benjamin Herrenschmidt
2018-05-24 14:34   ` Christopher Bostic
2018-05-24  5:14 ` [PATCH linux dev-4.13 03/10] fsi/fsi-master-gpio: Implement CRC error recovery Benjamin Herrenschmidt
2018-05-24 15:05   ` Christopher Bostic
2018-05-24  5:14 ` [PATCH linux dev-4.13 04/10] fsi/fsi-master-gpio: More error handling cleanup Benjamin Herrenschmidt
2018-05-24 18:50   ` Christopher Bostic
2018-05-24  5:14 ` [PATCH linux dev-4.13 05/10] fsi/master-gpio: Replace bit_bit lock with IRQ disable/enable Benjamin Herrenschmidt
2018-05-24  5:14 ` [PATCH linux dev-4.13 06/10] fsi: Remove old sbefifo driver Benjamin Herrenschmidt
2018-05-24  5:14 ` [PATCH linux dev-4.13 07/10] fsi/sbefifo: Add driver for the SBE FIFO Benjamin Herrenschmidt
2018-05-24  5:14 ` [PATCH linux dev-4.13 08/10] fsi/fsi-occ: Simple conversion to new sbefifo driver Benjamin Herrenschmidt
2018-05-24  5:14 ` Benjamin Herrenschmidt [this message]
2018-05-24  5:14 ` [PATCH linux dev-4.13 10/10] hwmon/occ: Silence probe error message when host is shutdown Benjamin Herrenschmidt
2018-05-24 13:40 ` [PATCH linux dev-4.13 01/10] fsi/gpio: Include command build in locked section Christopher Bostic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180524051429.4638-9-benh@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.