Re: [PATCH, v3] hwmon: coretemp: use list instead of fixed sizearray for temp data

From: Kirill A. Shutemov
Date: Mon May 07 2012 - 07:09:05 EST


On Mon, May 07, 2012 at 10:59:48AM +0000, R, Durgadoss wrote:
> Hi,
>
>
> > -----Original Message-----
> > From: Kirill A. Shutemov [mailto:kirill.shutemov@xxxxxxxxxxxxxxx]
> > Sent: Monday, May 07, 2012 4:04 PM
> > To: Yu, Fenghua; Guenter Roeck; R, Durgadoss
> > Cc: Andi Kleen; Jean Delvare; lm-sensors@xxxxxxxxxxxxxx; linux-
> > kernel@xxxxxxxxxxxxxxx; Kirill A. Shutemov
> > Subject: [PATCH, v3] hwmon: coretemp: use list instead of fixed size array for
> > temp data
> >
> > From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
> >
> > Let's rework code to allow arbitrary number of cores on a CPU, not
> > limited by hardcoded array size.
> >
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> > ---
> > v3:
> > - drop redundant refcounting and checks;
> > v2:
> > - fix NULL pointer dereference. Thanks to R, Durgadoss;
> > - use mutex instead of spinlock for list locking.
> > ---
> > drivers/hwmon/coretemp.c | 120 ++++++++++++++++++++++++++++-----------
> > ------
> > 1 files changed, 75 insertions(+), 45 deletions(-)
> >
> > diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> > index b9d5123..fa082d5 100644
> > --- a/drivers/hwmon/coretemp.c
> > +++ b/drivers/hwmon/coretemp.c
> > @@ -36,6 +36,8 @@
> > #include <linux/cpu.h>
> > #include <linux/pci.h>
> > #include <linux/smp.h>
> > +#include <linux/list.h>
> > +#include <linux/kref.h>
>
> I think we don't need to include kref.h now :-)

Right. :(
Guenter, should I resend the patch or you can fix this on apply?

>
> BTW, at some places, looks like we are using 'tdata' obtained from get_temp_data,
> without checking for NULL values. Other than that, looks Ok for me.

Do you mean sysfs show methods? It should never be NULL there. If it's
NULL, we have bug (race?) somewhere.

> Acked-by: Durgadoss R <durgadoss.r@xxxxxxxxx>

Thanks.

--
Kirill A. Shutemov

Attachment: signature.asc
Description: Digital signature