* [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups
@ 2014-07-09 1:25 Axel Lin
2014-07-31 2:05 ` [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou Axel Lin
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Axel Lin @ 2014-07-09 1:25 UTC (permalink / raw)
To: lm-sensors
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/hwmon/da9055-hwmon.c | 52 ++++++++------------------------------------
1 file changed, 9 insertions(+), 43 deletions(-)
diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
index 35eb773..9916a3f 100644
--- a/drivers/hwmon/da9055-hwmon.c
+++ b/drivers/hwmon/da9055-hwmon.c
@@ -36,7 +36,6 @@
struct da9055_hwmon {
struct da9055 *da9055;
- struct device *class_device;
struct mutex hwmon_lock;
struct mutex irq_lock;
struct completion done;
@@ -200,13 +199,6 @@ static ssize_t da9055_read_tjunc(struct device *dev,
+ 3076332, 10000));
}
-static ssize_t da9055_hwmon_show_name(struct device *dev,
- struct device_attribute *devattr,
- char *buf)
-{
- return sprintf(buf, "da9055\n");
-}
-
static ssize_t show_label(struct device *dev,
struct device_attribute *devattr, char *buf)
{
@@ -236,10 +228,7 @@ static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, da9055_read_tjunc, NULL,
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL,
DA9055_ADC_TJUNC);
-static DEVICE_ATTR(name, S_IRUGO, da9055_hwmon_show_name, NULL);
-
-static struct attribute *da9055_attr[] = {
- &dev_attr_name.attr,
+static struct attribute *da9055_attrs[] = {
&sensor_dev_attr_in0_input.dev_attr.attr,
&sensor_dev_attr_in0_label.dev_attr.attr,
&sensor_dev_attr_in1_input.dev_attr.attr,
@@ -254,15 +243,16 @@ static struct attribute *da9055_attr[] = {
NULL
};
-static const struct attribute_group da9055_attr_group = {.attrs = da9055_attr};
+ATTRIBUTE_GROUPS(da9055);
static int da9055_hwmon_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct da9055_hwmon *hwmon;
+ struct device *hwmon_dev;
int hwmon_irq, ret;
- hwmon = devm_kzalloc(&pdev->dev, sizeof(struct da9055_hwmon),
- GFP_KERNEL);
+ hwmon = devm_kzalloc(dev, sizeof(struct da9055_hwmon), GFP_KERNEL);
if (!hwmon)
return -ENOMEM;
@@ -272,8 +262,6 @@ static int da9055_hwmon_probe(struct platform_device *pdev)
init_completion(&hwmon->done);
hwmon->da9055 = dev_get_drvdata(pdev->dev.parent);
- platform_set_drvdata(pdev, hwmon);
-
hwmon_irq = platform_get_irq_byname(pdev, "HWMON");
if (hwmon_irq < 0)
return hwmon_irq;
@@ -288,36 +276,14 @@ static int da9055_hwmon_probe(struct platform_device *pdev)
return ret;
}
- ret = sysfs_create_group(&pdev->dev.kobj, &da9055_attr_group);
- if (ret)
- return ret;
-
- hwmon->class_device = hwmon_device_register(&pdev->dev);
- if (IS_ERR(hwmon->class_device)) {
- ret = PTR_ERR(hwmon->class_device);
- goto err;
- }
-
- return 0;
-
-err:
- sysfs_remove_group(&pdev->dev.kobj, &da9055_attr_group);
- return ret;
-}
-
-static int da9055_hwmon_remove(struct platform_device *pdev)
-{
- struct da9055_hwmon *hwmon = platform_get_drvdata(pdev);
-
- sysfs_remove_group(&pdev->dev.kobj, &da9055_attr_group);
- hwmon_device_unregister(hwmon->class_device);
-
- return 0;
+ hwmon_dev = devm_hwmon_device_register_with_groups(dev, "da9055",
+ hwmon,
+ da9055_groups);
+ return PTR_ERR_OR_ZERO(hwmon_dev);
}
static struct platform_driver da9055_hwmon_driver = {
.probe = da9055_hwmon_probe,
- .remove = da9055_hwmon_remove,
.driver = {
.name = "da9055-hwmon",
.owner = THIS_MODULE,
--
1.9.1
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou
2014-07-09 1:25 [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups Axel Lin
@ 2014-07-31 2:05 ` Axel Lin
2014-07-31 5:49 ` Guenter Roeck
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2014-07-31 2:05 UTC (permalink / raw)
To: lm-sensors
2014-07-09 9:25 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
> Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
> simplify the code a bit.
Hi Guenter:
I resent the patches (for da9052 and da9055) to Support.Opensource@diasemi.com>.
And I got reply from Adam as below:
Hi Axel,
Apologies for the late response to this. Realistically I don't think we're going
to be able to test this within the next couple of weeks, but we will try and
find some time as soon as we can to verify your changes.
From looking at the patches initially though, I don't see anything obvious that
should cause a problem.
Thanks
So I'm wondering if it's ok to apply the patches if having Adam's Acked or
Reviewed-by.
Adam,
May I have your Acked-by or Reviewed-by tag for both da9052 and da9055 patches?
Thanks,
Axel
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou
2014-07-09 1:25 [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups Axel Lin
2014-07-31 2:05 ` [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou Axel Lin
@ 2014-07-31 5:49 ` Guenter Roeck
2014-07-31 9:00 ` Opensource [Adam Thomson]
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-07-31 5:49 UTC (permalink / raw)
To: lm-sensors
On 07/30/2014 07:05 PM, Axel Lin wrote:
> 2014-07-09 9:25 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
>> Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
>> simplify the code a bit.
>
> Hi Guenter:
>
> I resent the patches (for da9052 and da9055) to Support.Opensource@diasemi.com>.
> And I got reply from Adam as below:
>
> Hi Axel,
>
> Apologies for the late response to this. Realistically I don't think we're going
> to be able to test this within the next couple of weeks, but we will try and
> find some time as soon as we can to verify your changes.
>
>>From looking at the patches initially though, I don't see anything obvious that
> should cause a problem.
>
> Thanks
>
>
> So I'm wondering if it's ok to apply the patches if having Adam's Acked or
> Reviewed-by.
>
If Adam would be willing to do that, I would accept it.
Guenter
> Adam,
> May I have your Acked-by or Reviewed-by tag for both da9052 and da9055 patches?
>
> Thanks,
> Axel
>
>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou
2014-07-09 1:25 [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups Axel Lin
2014-07-31 2:05 ` [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou Axel Lin
2014-07-31 5:49 ` Guenter Roeck
@ 2014-07-31 9:00 ` Opensource [Adam Thomson]
2014-08-06 5:50 ` Guenter Roeck
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Opensource [Adam Thomson] @ 2014-07-31 9:00 UTC (permalink / raw)
To: lm-sensors
On 31 July 2014 06:50, Guenter Roeck wrote:
> > So I'm wondering if it's ok to apply the patches if having Adam's Acked or
> > Reviewed-by.
> >
> If Adam would be willing to do that, I would accept it.
>
> Guenter
Yes I can do this. Do you need the Acks against the original patch e-mail threads?
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou
2014-07-09 1:25 [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups Axel Lin
` (2 preceding siblings ...)
2014-07-31 9:00 ` Opensource [Adam Thomson]
@ 2014-08-06 5:50 ` Guenter Roeck
2014-08-12 15:14 ` Opensource [Adam Thomson]
2014-08-12 15:38 ` Guenter Roeck
5 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-08-06 5:50 UTC (permalink / raw)
To: lm-sensors
On 07/31/2014 02:00 AM, Opensource [Adam Thomson] wrote:
> On 31 July 2014 06:50, Guenter Roeck wrote:
>
>>> So I'm wondering if it's ok to apply the patches if having Adam's Acked or
>>> Reviewed-by.
>>>
>> If Adam would be willing to do that, I would accept it.
>>
>> Guenter
>
> Yes I can do this. Do you need the Acks against the original patch e-mail threads?
>
Since we missed the commit window anyway, let's just wait for test feedback.
An Acked-by: doesn't hurt, though - feel free to send it as response to the
original patch or as response to this e-mail, whatever you prefer.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou
2014-07-09 1:25 [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups Axel Lin
` (3 preceding siblings ...)
2014-08-06 5:50 ` Guenter Roeck
@ 2014-08-12 15:14 ` Opensource [Adam Thomson]
2014-08-12 15:38 ` Guenter Roeck
5 siblings, 0 replies; 7+ messages in thread
From: Opensource [Adam Thomson] @ 2014-08-12 15:14 UTC (permalink / raw)
To: lm-sensors
On July 9, 2014 02:25, Axel Lin wrote:
> Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups()
> to
> simplify the code a bit.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/hwmon/da9055-hwmon.c | 52 ++++++++------------------------------------
> 1 file changed, 9 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
> index 35eb773..9916a3f 100644
> --- a/drivers/hwmon/da9055-hwmon.c
> +++ b/drivers/hwmon/da9055-hwmon.c
> @@ -36,7 +36,6 @@
>
> struct da9055_hwmon {
> struct da9055 *da9055;
> - struct device *class_device;
> struct mutex hwmon_lock;
> struct mutex irq_lock;
> struct completion done;
> @@ -200,13 +199,6 @@ static ssize_t da9055_read_tjunc(struct device *dev,
> + 3076332, 10000));
> }
>
> -static ssize_t da9055_hwmon_show_name(struct device *dev,
> - struct device_attribute *devattr,
> - char *buf)
> -{
> - return sprintf(buf, "da9055\n");
> -}
> -
> static ssize_t show_label(struct device *dev,
> struct device_attribute *devattr, char *buf)
> {
> @@ -236,10 +228,7 @@ static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
> da9055_read_tjunc, NULL,
> static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL,
> DA9055_ADC_TJUNC);
>
> -static DEVICE_ATTR(name, S_IRUGO, da9055_hwmon_show_name, NULL);
> -
> -static struct attribute *da9055_attr[] = {
> - &dev_attr_name.attr,
> +static struct attribute *da9055_attrs[] = {
> &sensor_dev_attr_in0_input.dev_attr.attr,
> &sensor_dev_attr_in0_label.dev_attr.attr,
> &sensor_dev_attr_in1_input.dev_attr.attr,
> @@ -254,15 +243,16 @@ static struct attribute *da9055_attr[] = {
> NULL
> };
>
> -static const struct attribute_group da9055_attr_group = {.attrs = da9055_attr};
> +ATTRIBUTE_GROUPS(da9055);
>
> static int da9055_hwmon_probe(struct platform_device *pdev)
> {
> + struct device *dev = &pdev->dev;
> struct da9055_hwmon *hwmon;
> + struct device *hwmon_dev;
> int hwmon_irq, ret;
>
> - hwmon = devm_kzalloc(&pdev->dev, sizeof(struct da9055_hwmon),
> - GFP_KERNEL);
> + hwmon = devm_kzalloc(dev, sizeof(struct da9055_hwmon), GFP_KERNEL);
> if (!hwmon)
> return -ENOMEM;
>
> @@ -272,8 +262,6 @@ static int da9055_hwmon_probe(struct platform_device
> *pdev)
> init_completion(&hwmon->done);
> hwmon->da9055 = dev_get_drvdata(pdev->dev.parent);
>
> - platform_set_drvdata(pdev, hwmon);
> -
> hwmon_irq = platform_get_irq_byname(pdev, "HWMON");
> if (hwmon_irq < 0)
> return hwmon_irq;
> @@ -288,36 +276,14 @@ static int da9055_hwmon_probe(struct platform_device
> *pdev)
> return ret;
> }
>
> - ret = sysfs_create_group(&pdev->dev.kobj, &da9055_attr_group);
> - if (ret)
> - return ret;
> -
> - hwmon->class_device = hwmon_device_register(&pdev->dev);
> - if (IS_ERR(hwmon->class_device)) {
> - ret = PTR_ERR(hwmon->class_device);
> - goto err;
> - }
> -
> - return 0;
> -
> -err:
> - sysfs_remove_group(&pdev->dev.kobj, &da9055_attr_group);
> - return ret;
> -}
> -
> -static int da9055_hwmon_remove(struct platform_device *pdev)
> -{
> - struct da9055_hwmon *hwmon = platform_get_drvdata(pdev);
> -
> - sysfs_remove_group(&pdev->dev.kobj, &da9055_attr_group);
> - hwmon_device_unregister(hwmon->class_device);
> -
> - return 0;
> + hwmon_dev = devm_hwmon_device_register_with_groups(dev, "da9055",
> + hwmon,
> + da9055_groups);
> + return PTR_ERR_OR_ZERO(hwmon_dev);
> }
>
> static struct platform_driver da9055_hwmon_driver = {
> .probe = da9055_hwmon_probe,
> - .remove = da9055_hwmon_remove,
> .driver = {
> .name = "da9055-hwmon",
> .owner = THIS_MODULE,
> --
> 1.9.1
>
>
Change seems fine from my bring-up test.
Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou
2014-07-09 1:25 [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups Axel Lin
` (4 preceding siblings ...)
2014-08-12 15:14 ` Opensource [Adam Thomson]
@ 2014-08-12 15:38 ` Guenter Roeck
5 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-08-12 15:38 UTC (permalink / raw)
To: lm-sensors
On 08/12/2014 08:14 AM, Opensource [Adam Thomson] wrote:
> On July 9, 2014 02:25, Axel Lin wrote:
>
>> Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups()
>> to
>> simplify the code a bit.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
[ ... ]
>
> Change seems fine from my bring-up test.
>
> Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
>
Thanks a lot for testing. Applied to -next.
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-08-12 15:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-09 1:25 [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups Axel Lin
2014-07-31 2:05 ` [lm-sensors] [RFT][PATCH v2 2/2] hwmon: (da9055) Convert to devm_hwmon_device_register_with_grou Axel Lin
2014-07-31 5:49 ` Guenter Roeck
2014-07-31 9:00 ` Opensource [Adam Thomson]
2014-08-06 5:50 ` Guenter Roeck
2014-08-12 15:14 ` Opensource [Adam Thomson]
2014-08-12 15:38 ` 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.