Re: [lm-sensors] [PATCH] hwmon: Add driver for intel PCI thermal subsystem

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jean Delvare
Date: Sunday, April 11, 2010 - 4:24 am

Hi Matthew,

On Fri, 11 Dec 2009 10:52:30 -0500, Matthew Garrett wrote:

Review:


Any progress on this?


This is a rather generic driver name, for a device-specific driver.


This is a simple device driver. Having "subsystem" in the name is very
confusing.


Way too generic option name. We support other Intel sensors already,
which are not supported by this driver. See the coretemp and i5k_amb
drivers for example.


Bad indentation. And again a very generic option label...


... for what seems to be a highly specific device driver. If this
driver only works on Intel PM55-based boards, the driver name should
reflect this. Even if it works on all PM55 and later chips, having pm55
in the driver name is recommended.


This is harsh. Where's the driver description, author name, copyright
year, GPL boilerplate, as every other driver in the kernel tree has?


You don't need this one for a PCI driver.


Global variables? You must be kidding. Please move these to a
per-device structure, which you will pass to functions which need it.


I think these can be marked const these days.


This doesn't properly handle errors. Some read_sensor() functions
return -1 on error, so you have to handle that. If you don't, you will
return a temperature of -0.001 degrees C, which user-space has no
reason to handle as an error.Depending on the nature of the error, you
want to return -EAGAIN or -ENXIO here.


This is a fairly complex way to write:
	temp = value * 1000 / 64;
Isn't it?


This is pretty inefficient. Please add a parameter to struct
intel_thermal_sensor and have that parameter passed to read_sensor().
That way you can share the same function amongst different sensors,
without intermediate functions hard-coding a parameter.


What about:
	int temp = (value >> shift) & 0xff;
This is easier to read IMHO.


This illustrates my previous point even better...


Comma not needed after a list terminator (you're never going to add
something after it, by definition.)


Should be const, and same for all other groups.


Alignment.


Should be NULL, not 0. (And you could easily live without that
terminator, BTW.)


What an horribly vague identifier :(


Or the region might be already in use? You'd rather return "ret" than
hard-code an arbitrary error code.


Once again, you'd rather pass down the error code you received.


No blank line between function call and error test.


Wrong label... you want to jump to "groups" not "device".


This is the wrong test. hwmon_device_register() returns pointer-encoded
error values, so you need IS_ERR() and PTR_ERR().


But here you want to jump to "device" and not "groups".


A blank line here wouldn't hurt.


You don't want to call this here, as you'll jump here only if
hwmon_device_register() failed, so you don't have to undo it.


As intel_thermal_pci_remove is marked __devexit, you should use
__devexit_p().


Update wanted, if you want this upstream, obviously...

-- 
Jean Delvare
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] hwmon: Add driver for intel PCI thermal subsystem, Matthew Garrett, (Fri Dec 11, 8:52 am)
Re: [lm-sensors] [PATCH] hwmon: Add driver for intel PCI t ..., Jean Delvare, (Sun Apr 11, 4:24 am)