2020-09-29 06:24:42

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH v2 2/2] spmi: fix some coding style issues at the spmi core

While preparing to port the HiSilicon 6421v600 SPMI driver,
I noticed some coding style issues at the SPMI core.

Address them.

Reviewed-by: Stephen Boyd <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/spmi/spmi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
index fd3ff6079b15..253340e10dab 100644
--- a/drivers/spmi/spmi.c
+++ b/drivers/spmi/spmi.c
@@ -23,6 +23,7 @@ static DEFINE_IDA(ctrl_ida);
static void spmi_dev_release(struct device *dev)
{
struct spmi_device *sdev = to_spmi_device(dev);
+
kfree(sdev);
}

@@ -33,6 +34,7 @@ static const struct device_type spmi_dev_type = {
static void spmi_ctrl_release(struct device *dev)
{
struct spmi_controller *ctrl = to_spmi_controller(dev);
+
ida_simple_remove(&ctrl_ida, ctrl->nr);
kfree(ctrl);
}
@@ -487,7 +489,7 @@ static void of_spmi_register_devices(struct spmi_controller *ctrl)
continue;

sdev->dev.of_node = node;
- sdev->usid = (u8) reg[0];
+ sdev->usid = (u8)reg[0];

err = spmi_device_add(sdev);
if (err) {
@@ -531,6 +533,7 @@ EXPORT_SYMBOL_GPL(spmi_controller_add);
static int spmi_ctrl_remove_device(struct device *dev, void *data)
{
struct spmi_device *spmidev = to_spmi_device(dev);
+
if (dev->type == &spmi_dev_type)
spmi_device_remove(spmidev);
return 0;
--
2.26.2


2020-09-29 09:26:05

by Marc Gonzalez

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] spmi: fix some coding style issues at the spmi core

On 29/09/2020 08:22, Mauro Carvalho Chehab wrote:

> @@ -487,7 +489,7 @@ static void of_spmi_register_devices(struct spmi_controller *ctrl)
> continue;
>
> sdev->dev.of_node = node;
> - sdev->usid = (u8) reg[0];
> + sdev->usid = (u8)reg[0];

typeof(sdev->usid) is u8.

What is the point of this cast?

Does GCC warn that u32 is being truncated to u8?

Regards.

2020-11-13 20:50:02

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] spmi: fix some coding style issues at the spmi core

Quoting Mauro Carvalho Chehab (2020-09-28 23:22:13)
> While preparing to port the HiSilicon 6421v600 SPMI driver,
> I noticed some coding style issues at the SPMI core.
>
> Address them.
>
> Reviewed-by: Stephen Boyd <[email protected]>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
> ---

Applied. Thanks!