2021-01-26 20:00:20

by Lubomir Rintel

[permalink] [raw]
Subject: [PATCH 0/3] Platform: OLPC: A couple of fixes

Hi,

chained to this message is a couple of fixes related to OLPC EC platform
code. Please take a look and consider applying to platform-drivers-x86.

Thank you
Lubo



2021-01-26 20:00:23

by Lubomir Rintel

[permalink] [raw]
Subject: [PATCH 1/3] Platform: OLPC: Fix probe error handling

Reset ec_priv if probe ends unsuccessfully.

Signed-off-by: Lubomir Rintel <[email protected]>
---
drivers/platform/olpc/olpc-ec.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c
index f64b82824db28..2db7113383fdc 100644
--- a/drivers/platform/olpc/olpc-ec.c
+++ b/drivers/platform/olpc/olpc-ec.c
@@ -426,11 +426,8 @@ static int olpc_ec_probe(struct platform_device *pdev)

/* get the EC revision */
err = olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, &ec->version, 1);
- if (err) {
- ec_priv = NULL;
- kfree(ec);
- return err;
- }
+ if (err)
+ goto error;

config.dev = pdev->dev.parent;
config.driver_data = ec;
@@ -440,12 +437,16 @@ static int olpc_ec_probe(struct platform_device *pdev)
if (IS_ERR(ec->dcon_rdev)) {
dev_err(&pdev->dev, "failed to register DCON regulator\n");
err = PTR_ERR(ec->dcon_rdev);
- kfree(ec);
- return err;
+ goto error;
}

ec->dbgfs_dir = olpc_ec_setup_debugfs();

+ return 0;
+
+error:
+ ec_priv = NULL;
+ kfree(ec);
return err;
}

--
2.29.2

2021-01-26 20:00:23

by Lubomir Rintel

[permalink] [raw]
Subject: [PATCH 2/3] Platform: OLPC: Remove dcon_rdev from olpc_ec_priv

It is not needed. Use a local variable instead.

Signed-off-by: Lubomir Rintel <[email protected]>
---
drivers/platform/olpc/olpc-ec.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c
index 2db7113383fdc..3c852d573e9b4 100644
--- a/drivers/platform/olpc/olpc-ec.c
+++ b/drivers/platform/olpc/olpc-ec.c
@@ -37,7 +37,6 @@ struct olpc_ec_priv {
struct mutex cmd_lock;

/* DCON regulator */
- struct regulator_dev *dcon_rdev;
bool dcon_enabled;

/* Pending EC commands */
@@ -405,6 +404,7 @@ static int olpc_ec_probe(struct platform_device *pdev)
{
struct olpc_ec_priv *ec;
struct regulator_config config = { };
+ struct regulator_dev *regulator;
int err;

if (!ec_driver)
@@ -432,11 +432,10 @@ static int olpc_ec_probe(struct platform_device *pdev)
config.dev = pdev->dev.parent;
config.driver_data = ec;
ec->dcon_enabled = true;
- ec->dcon_rdev = devm_regulator_register(&pdev->dev, &dcon_desc,
- &config);
- if (IS_ERR(ec->dcon_rdev)) {
+ regulator = devm_regulator_register(&pdev->dev, &dcon_desc, &config);
+ if (IS_ERR(regulator)) {
dev_err(&pdev->dev, "failed to register DCON regulator\n");
- err = PTR_ERR(ec->dcon_rdev);
+ err = PTR_ERR(regulator);
goto error;
}

--
2.29.2

2021-01-27 05:58:46

by Lubomir Rintel

[permalink] [raw]
Subject: [PATCH 3/3] Platform: OLPC: Specify the enable time

Determined empirically.

Signed-off-by: Lubomir Rintel <[email protected]>
---
drivers/platform/olpc/olpc-ec.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c
index 3c852d573e9b4..72dbbea0005c5 100644
--- a/drivers/platform/olpc/olpc-ec.c
+++ b/drivers/platform/olpc/olpc-ec.c
@@ -393,11 +393,12 @@ static struct regulator_ops dcon_regulator_ops = {
};

static const struct regulator_desc dcon_desc = {
- .name = "dcon",
- .id = 0,
- .ops = &dcon_regulator_ops,
- .type = REGULATOR_VOLTAGE,
- .owner = THIS_MODULE,
+ .name = "dcon",
+ .id = 0,
+ .ops = &dcon_regulator_ops,
+ .type = REGULATOR_VOLTAGE,
+ .owner = THIS_MODULE,
+ .enable_time = 25000,
};

static int olpc_ec_probe(struct platform_device *pdev)
--
2.29.2

2021-02-03 00:48:36

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH 0/3] Platform: OLPC: A couple of fixes

hi,

On 1/26/21 8:37 AM, Lubomir Rintel wrote:
> Hi,
>
> chained to this message is a couple of fixes related to OLPC EC platform
> code. Please take a look and consider applying to platform-drivers-x86.

Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans