Re: [PATCH v3] drivers/hwmon NTC Thermistor Initial Support v3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sender : Guenter Roeck<guenter.roeck@xxxxxxxxxxxx>
> On Thu, Dec 23, 2010 at 08:36:04PM -0500, MyungJoo Ham wrote:
> [ ... ]
> > >> +int ntc_thermistor_read(struct device *dev)
> > >> +{
> > >> + ? ? ? return _ntc_thermistor_read(dev_get_drvdata(dev));
> > >> +}
> > >
> > > Function should be removed since it is no longer exported.
> > >
> > 
> > I have been considering to use this function at the board file in the
> > kernel space.
> 
> That means you would have to export the function, and we are back to square one,
> ie you really use a hwmon driver to provide functions to a non-hwmon driver.
> 

Yes, this hwmon driver is used by another (board file) when CONFIG_HWMON and
CONFIG_NTC_.... is "y". Otherwise, the code that requires hwmon driver is not
compiled and a dummy is used instead. Thus, we don't need EXPORT anyway.

> > However, if it is removed, the driver may have a weird callback (a) or
> > the board file
> > may need to access sysfs filesystem and depends on sysfs (b).
> > 
> > (a): add "int (*read_thermistor)(struct platform_device *pdev)" at
> > struct ntc_thermistor_platform_data (in include/linux/ntc.h) and let
> > ntc_thermistor_probe provide callback thru pdata back to the caller of
> > platform_device_register().
> > 
> > (b): read "/sysfs/devices/platform/blahblah/temp1_input"
> > and keep /sysfs mounted always.
> > 
> > Are these approaches fine?
> > 
> Again, problem is that in order to have this functionality, you force 
> hwmon to be active for the board you are talking about. This is,
> no matter how you do it, not the correct approach. Maybe someone wants to
> build a kernel with no hwmon support. Then what ? This won't work.
> 
> If the adc values need to be used by non-hwmon driver(s), there should be 
> an independent driver providing adc values, a hwmon driver to convert the 
> adc values as appropriate via the hwmon sysfs ABI, and other drivers as needed,
> such as your board driver, doing whatever they want to do with the adc values.

If hwmon and ntc is not active (not y), it won't simply use it. The user will lose
related features, but will be able to run the kernel anyway.

For example, in case (a), we may either skip (by using some #if) registering or
handle error from platform_driver_register properly; just don't start the service/function
that requires ntc. In case (b), it would be almost same with the latter method of case (a).
 
> 
> Thanks,
> Guenter
> 


Cheers!
MyungJoo

 MyungJoo Ham (함명주)
Mobile Software Platform Lab,
Digital Media and Communications (DMC) Business
Samsung Electronics
cell: +82-10-6714-2858 / office: +82-31-279-8033
_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux