* Re: [patch] Disable PMBus status check for DPS400 PSU controller
2016-07-21 14:55 [patch] Disable PMBus status check for DPS400 PSU controller Vadim Pasternak
@ 2016-07-21 13:41 ` Guenter Roeck
2016-07-21 14:08 ` Vadim Pasternak
0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2016-07-21 13:41 UTC (permalink / raw)
To: Vadim Pasternak; +Cc: jdelvare, linux-hwmon, linux-kernel, jiri
Hi Vadim,
On 07/21/2016 07:55 AM, Vadim Pasternak wrote:
> pmbus/dps400: disable PMBus status check through platform data structure to
> provide support for PSU DPS-460, DPS-800 from Delta Electronics, INC and for
> SGD009 from Acbel Polytech, INC.
> These devices do not support the STATUS_CML register, and reports communication
> error in response to this command.
> For this reason for these controllers, the status register check is disabled.
>
The subject should be "hwmon: (pmbus) Add explicit support for DPS-460, DPS-800,
and SGD009", followed by something like
"Provide support for PSU DPS-460, DPS-800 from Delta Electronics, INC and for
SGD009 from Acbel Polytech, INC.
These devices do not support the STATUS_CML register and report a communication
error in response to this command. For this reason, the status register check
is disabled for these controllers."
> Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
>
Unnecessary blank line
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
> drivers/hwmon/pmbus/pmbus.c | 16 ++++++++++++++++
> drivers/hwmon/pmbus/pmbus_core.c | 3 +++
> 2 files changed, 19 insertions(+)
>
> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> index 0a74991..44c736a 100644
> --- a/drivers/hwmon/pmbus/pmbus.c
> +++ b/drivers/hwmon/pmbus/pmbus.c
> @@ -25,6 +25,7 @@
> #include <linux/slab.h>
> #include <linux/mutex.h>
> #include <linux/i2c.h>
> +#include <linux/i2c/pmbus.h>
> #include "pmbus.h"
>
> /*
> @@ -167,14 +168,26 @@ static int pmbus_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> struct pmbus_driver_info *info;
> + struct pmbus_platform_data *pdata = NULL;
> + struct device *dev = &client->dev;
>
> info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
> GFP_KERNEL);
> if (!info)
> return -ENOMEM;
> + if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps460") ||
Should the second string be dps800 ?
> + !strcmp(id->name, "sgd009")) {
> + pdata = kzalloc(sizeof(struct pmbus_platform_data), GFP_KERNEL);
Please use devm_kzalloc().
> + if (!pdata) {
> + kfree(info);
info was allocated with devm_kzalloc() and thus does not need kfree (besides,
if at all, it would have to be devm_kfree).
> + return -ENOMEM;
> + }
> + pdata->flags = PMBUS_SKIP_STATUS_CHECK;
> + }
>
> info->pages = id->driver_data;
> info->identify = pmbus_identify;
> + dev->platform_data = pdata;
>
> return pmbus_do_probe(client, id, info);
> }
> @@ -199,6 +212,9 @@ static const struct i2c_device_id pmbus_id[] = {
> {"tps544c20", 1},
> {"tps544c25", 1},
> {"udt020", 1},
> + {"dps460", 1},
> + {"dps800", 1},
> + {"sgd009", 1},
Please list in alphabetic order.
> {}
> };
>
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index ba59eae..3d98070 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -1931,8 +1931,11 @@ EXPORT_SYMBOL_GPL(pmbus_do_probe);
> int pmbus_do_remove(struct i2c_client *client)
> {
> struct pmbus_data *data = i2c_get_clientdata(client);
> + const struct pmbus_platform_data *pdata =
> + dev_get_platdata(&client->dev);
> hwmon_device_unregister(data->hwmon_dev);
> kfree(data->group.attrs);
> + kfree(pdata);
> return 0;
> }
> EXPORT_SYMBOL_GPL(pmbus_do_remove);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch] Disable PMBus status check for DPS400 PSU controller
2016-07-21 13:41 ` Guenter Roeck
@ 2016-07-21 14:08 ` Vadim Pasternak
2016-07-21 14:31 ` Guenter Roeck
0 siblings, 1 reply; 4+ messages in thread
From: Vadim Pasternak @ 2016-07-21 14:08 UTC (permalink / raw)
To: Guenter Roeck; +Cc: jdelvare, linux-hwmon, linux-kernel, jiri
> -----Original Message-----
> From: Guenter Roeck [mailto:linux@roeck-us.net]
> Sent: Thursday, July 21, 2016 4:42 PM
> To: Vadim Pasternak <vadimp@mellanox.com>
> Cc: jdelvare@suse.com; linux-hwmon@vger.kernel.org; linux-
> kernel@vger.kernel.org; jiri@resnulli.us
> Subject: Re: [patch] Disable PMBus status check for DPS400 PSU controller
>
Hi Guenter,
Thank you very much for your reply.
> Hi Vadim,
>
> On 07/21/2016 07:55 AM, Vadim Pasternak wrote:
> > pmbus/dps400: disable PMBus status check through platform data
> > structure to provide support for PSU DPS-460, DPS-800 from Delta
> > Electronics, INC and for
> > SGD009 from Acbel Polytech, INC.
> > These devices do not support the STATUS_CML register, and reports
> > communication error in response to this command.
> > For this reason for these controllers, the status register check is disabled.
> >
>
> The subject should be "hwmon: (pmbus) Add explicit support for DPS-460, DPS-
> 800, and SGD009", followed by something like
>
> "Provide support for PSU DPS-460, DPS-800 from Delta Electronics, INC and for
> SGD009 from Acbel Polytech, INC.
> These devices do not support the STATUS_CML register and report a
> communication error in response to this command. For this reason, the status
> register check is disabled for these controllers."
>
> > Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> >
> Unnecessary blank line
>
> > Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> > ---
> > drivers/hwmon/pmbus/pmbus.c | 16 ++++++++++++++++
> > drivers/hwmon/pmbus/pmbus_core.c | 3 +++
> > 2 files changed, 19 insertions(+)
> >
> > diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> > index 0a74991..44c736a 100644
> > --- a/drivers/hwmon/pmbus/pmbus.c
> > +++ b/drivers/hwmon/pmbus/pmbus.c
> > @@ -25,6 +25,7 @@
> > #include <linux/slab.h>
> > #include <linux/mutex.h>
> > #include <linux/i2c.h>
> > +#include <linux/i2c/pmbus.h>
> > #include "pmbus.h"
> >
> > /*
> > @@ -167,14 +168,26 @@ static int pmbus_probe(struct i2c_client *client,
> > const struct i2c_device_id *id)
> > {
> > struct pmbus_driver_info *info;
> > + struct pmbus_platform_data *pdata = NULL;
> > + struct device *dev = &client->dev;
> >
> > info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
> > GFP_KERNEL);
> > if (!info)
> > return -ENOMEM;
> > + if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps460") ||
>
> Should the second string be dps800 ?
>
> > + !strcmp(id->name, "sgd009")) {
> > + pdata = kzalloc(sizeof(struct pmbus_platform_data),
> GFP_KERNEL);
>
> Please use devm_kzalloc().
>
> > + if (!pdata) {
> > + kfree(info);
>
> info was allocated with devm_kzalloc() and thus does not need kfree (besides, if
> at all, it would have to be devm_kfree).
>
> > + return -ENOMEM;
> > + }
> > + pdata->flags = PMBUS_SKIP_STATUS_CHECK;
> > + }
> >
> > info->pages = id->driver_data;
> > info->identify = pmbus_identify;
> > + dev->platform_data = pdata;
> >
> > return pmbus_do_probe(client, id, info);
> > }
> > @@ -199,6 +212,9 @@ static const struct i2c_device_id pmbus_id[] = {
> > {"tps544c20", 1},
> > {"tps544c25", 1},
> > {"udt020", 1},
> > + {"dps460", 1},
> > + {"dps800", 1},
> > + {"sgd009", 1},
>
> Please list in alphabetic order.
>
> > {}
> > };
> >
> > diff --git a/drivers/hwmon/pmbus/pmbus_core.c
> > b/drivers/hwmon/pmbus/pmbus_core.c
> > index ba59eae..3d98070 100644
> > --- a/drivers/hwmon/pmbus/pmbus_core.c
> > +++ b/drivers/hwmon/pmbus/pmbus_core.c
> > @@ -1931,8 +1931,11 @@ EXPORT_SYMBOL_GPL(pmbus_do_probe);
> > int pmbus_do_remove(struct i2c_client *client)
> > {
> > struct pmbus_data *data = i2c_get_clientdata(client);
> > + const struct pmbus_platform_data *pdata =
> > + dev_get_platdata(&client->dev);
> > hwmon_device_unregister(data->hwmon_dev);
> > kfree(data->group.attrs);
> > + kfree(pdata);
So, if I use in allocation
pdata = devm_kzalloc(&client->dev,
sizeof(struct pmbus_platform_data),
GFP_KERNEL);
I also can drop the above three lines, right?
> > return 0;
> > }
> > EXPORT_SYMBOL_GPL(pmbus_do_remove);
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] Disable PMBus status check for DPS400 PSU controller
2016-07-21 14:08 ` Vadim Pasternak
@ 2016-07-21 14:31 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2016-07-21 14:31 UTC (permalink / raw)
To: Vadim Pasternak; +Cc: jdelvare, linux-hwmon, linux-kernel, jiri
On 07/21/2016 07:08 AM, Vadim Pasternak wrote:
[ ... ]
>>> };
>>>
>>> diff --git a/drivers/hwmon/pmbus/pmbus_core.c
>>> b/drivers/hwmon/pmbus/pmbus_core.c
>>> index ba59eae..3d98070 100644
>>> --- a/drivers/hwmon/pmbus/pmbus_core.c
>>> +++ b/drivers/hwmon/pmbus/pmbus_core.c
>>> @@ -1931,8 +1931,11 @@ EXPORT_SYMBOL_GPL(pmbus_do_probe);
>>> int pmbus_do_remove(struct i2c_client *client)
>>> {
>>> struct pmbus_data *data = i2c_get_clientdata(client);
>>> + const struct pmbus_platform_data *pdata =
>>> + dev_get_platdata(&client->dev);
>>> hwmon_device_unregister(data->hwmon_dev);
>>> kfree(data->group.attrs);
>>> + kfree(pdata);
>
> So, if I use in allocation
> pdata = devm_kzalloc(&client->dev,
> sizeof(struct pmbus_platform_data),
> GFP_KERNEL);
> I also can drop the above three lines, right?
>
Correct.
Guenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch] Disable PMBus status check for DPS400 PSU controller
@ 2016-07-21 14:55 Vadim Pasternak
2016-07-21 13:41 ` Guenter Roeck
0 siblings, 1 reply; 4+ messages in thread
From: Vadim Pasternak @ 2016-07-21 14:55 UTC (permalink / raw)
To: linux; +Cc: jdelvare, linux-hwmon, linux-kernel, jiri, Vadim Pasternak
pmbus/dps400: disable PMBus status check through platform data structure to
provide support for PSU DPS-460, DPS-800 from Delta Electronics, INC and for
SGD009 from Acbel Polytech, INC.
These devices do not support the STATUS_CML register, and reports communication
error in response to this command.
For this reason for these controllers, the status register check is disabled.
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/hwmon/pmbus/pmbus.c | 16 ++++++++++++++++
drivers/hwmon/pmbus/pmbus_core.c | 3 +++
2 files changed, 19 insertions(+)
diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index 0a74991..44c736a 100644
--- a/drivers/hwmon/pmbus/pmbus.c
+++ b/drivers/hwmon/pmbus/pmbus.c
@@ -25,6 +25,7 @@
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/i2c.h>
+#include <linux/i2c/pmbus.h>
#include "pmbus.h"
/*
@@ -167,14 +168,26 @@ static int pmbus_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct pmbus_driver_info *info;
+ struct pmbus_platform_data *pdata = NULL;
+ struct device *dev = &client->dev;
info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
GFP_KERNEL);
if (!info)
return -ENOMEM;
+ if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps460") ||
+ !strcmp(id->name, "sgd009")) {
+ pdata = kzalloc(sizeof(struct pmbus_platform_data), GFP_KERNEL);
+ if (!pdata) {
+ kfree(info);
+ return -ENOMEM;
+ }
+ pdata->flags = PMBUS_SKIP_STATUS_CHECK;
+ }
info->pages = id->driver_data;
info->identify = pmbus_identify;
+ dev->platform_data = pdata;
return pmbus_do_probe(client, id, info);
}
@@ -199,6 +212,9 @@ static const struct i2c_device_id pmbus_id[] = {
{"tps544c20", 1},
{"tps544c25", 1},
{"udt020", 1},
+ {"dps460", 1},
+ {"dps800", 1},
+ {"sgd009", 1},
{}
};
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index ba59eae..3d98070 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -1931,8 +1931,11 @@ EXPORT_SYMBOL_GPL(pmbus_do_probe);
int pmbus_do_remove(struct i2c_client *client)
{
struct pmbus_data *data = i2c_get_clientdata(client);
+ const struct pmbus_platform_data *pdata =
+ dev_get_platdata(&client->dev);
hwmon_device_unregister(data->hwmon_dev);
kfree(data->group.attrs);
+ kfree(pdata);
return 0;
}
EXPORT_SYMBOL_GPL(pmbus_do_remove);
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-21 14:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 14:55 [patch] Disable PMBus status check for DPS400 PSU controller Vadim Pasternak
2016-07-21 13:41 ` Guenter Roeck
2016-07-21 14:08 ` Vadim Pasternak
2016-07-21 14:31 ` Guenter Roeck
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.