Hi Guenter, On Fri, 22 Nov 2013 22:07:57 -0800, Guenter Roeck wrote: > Use new hwmon API to simplify code, provide missing mandatory 'name' > sysfs attribute, and attach hwmon attributes to hwmon device instead > of pci device. > > Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx> > --- > drivers/net/ethernet/broadcom/tg3.c | 25 ++++++------------------- > 1 file changed, 6 insertions(+), 19 deletions(-) > > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c > index a9e0684..369b736 100644 > --- a/drivers/net/ethernet/broadcom/tg3.c > +++ b/drivers/net/ethernet/broadcom/tg3.c > @@ -10629,10 +10629,8 @@ static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir) > static ssize_t tg3_show_temp(struct device *dev, > struct device_attribute *devattr, char *buf) > { > - struct pci_dev *pdev = to_pci_dev(dev); > - struct net_device *netdev = pci_get_drvdata(pdev); > - struct tg3 *tp = netdev_priv(netdev); > struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); > + struct tg3 *tp = dev_get_drvdata(dev); > u32 temperature; > > spin_lock_bh(&tp->lock); > @@ -10650,29 +10648,25 @@ static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, tg3_show_temp, NULL, > static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, tg3_show_temp, NULL, > TG3_TEMP_MAX_OFFSET); > > -static struct attribute *tg3_attributes[] = { > +static struct attribute *tg3_attrs[] = { > &sensor_dev_attr_temp1_input.dev_attr.attr, > &sensor_dev_attr_temp1_crit.dev_attr.attr, > &sensor_dev_attr_temp1_max.dev_attr.attr, > NULL > }; > - > -static const struct attribute_group tg3_group = { > - .attrs = tg3_attributes, > -}; > +ATTRIBUTE_GROUPS(tg3); > > static void tg3_hwmon_close(struct tg3 *tp) > { > if (tp->hwmon_dev) { > hwmon_device_unregister(tp->hwmon_dev); > tp->hwmon_dev = NULL; > - sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group); > } > } > > static void tg3_hwmon_open(struct tg3 *tp) > { > - int i, err; > + int i; > u32 size = 0; > struct pci_dev *pdev = tp->pdev; > struct tg3_ocir ocirs[TG3_SD_NUM_RECS]; > @@ -10690,18 +10684,11 @@ static void tg3_hwmon_open(struct tg3 *tp) > if (!size) > return; > > - /* Register hwmon sysfs hooks */ > - err = sysfs_create_group(&pdev->dev.kobj, &tg3_group); > - if (err) { > - dev_err(&pdev->dev, "Cannot create sysfs group, aborting\n"); > - return; > - } > - > - tp->hwmon_dev = hwmon_device_register(&pdev->dev); > + tp->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, "tg3", > + tp, tg3_groups); > if (IS_ERR(tp->hwmon_dev)) { > tp->hwmon_dev = NULL; > dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n"); > - sysfs_remove_group(&pdev->dev.kobj, &tg3_group); > } > } > I can't test this, but the changes look good to me. Reviewed-by: Jean Delvare <khali@xxxxxxxxxxxx> -- Jean Delvare _______________________________________________ lm-sensors mailing list lm-sensors@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors