Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1531565
| From | John Muir <john@jmuir.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. |
| Date | 2016-11-28 20:50 +0100 |
| Message-ID | <sIA66-6pe-27@gated-at.bofh.it> (permalink) |
| References | <sI02C-8kq-3@gated-at.bofh.it> <sI6KJ-4eR-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> On Nov 27, 2016, at 4:19 AM, Guenter Roeck <linux@roeck-us.net> wrote:
>
> On 11/26/2016 09:15 PM, John Muir wrote:
>> Add support for the TI TMP108 temperature sensor with some device
>> configuration parameters.
>> +- ti,alert-active-high : (boolean) make the alert pin active-high instead of
>> + the default active-low.
>
> The driver doesn't support interrupts/alerts. Do those properties really add value ?
Getting ahead of myself. I will create a patch for this in the future.
>> +static void tmp108_update_ready_time(struct tmp108 *tmp108)
>> +{
>> + tmp108->ready_time = jiffies;
>> + if ((tmp108->config & TMP108_CONF_MODE_MASK)
>> + == TMP108_MODE_CONTINUOUS) {
>
> Don't you want a "!" here ? Presumably the delay is only needed
> if the original configuration was not for continuous mode.
>
>> + tmp108->ready_time +=
>> + msecs_to_jiffies(TMP108_CONVERSION_TIME_MS);
>> + }
>> +}
The delay is required for both really. When the device is set into continuous mode it starts converting and the first temperature is ready (just under) 30ms later.
For the (unsupported at this time) one-shot mode, there would likewise be a delay, but I was envisioning having the requesting task sleep while waiting for the data to be ready, rather than get an -EAGAIN until the data is ready.
>> + hwmon_dev = hwmon_device_register_with_groups(dev, client->name,
>> + tmp108, tmp108_groups);
>
> Please consider using the devm_ function here.
>
>> + if (IS_ERR(hwmon_dev)) {
>> + dev_dbg(dev, "unable to register hwmon device\n");
>> + return PTR_ERR(hwmon_dev);
>> + }
>> +
>> + tmp108->hwmon_dev = hwmon_dev;
>> + tmp108->tz = thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
>> + &tmp108_of_thermal_ops);
>> + if (IS_ERR(tmp108->tz))
>> + return PTR_ERR(tmp108->tz);
>
> hwmon device not unregistered here. That would be fixed by using the devm
> function above.
>
For the above two registrations and .remove function, I was worried that there would be an order problem between the i2c->remove and the device-managed cleanup. I’ll get deeper into that code to determine if that is a problem.
For your other comments, I will make the necessary changes.
Thanks!
John.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. John Muir <john@jmuir.com> - 2016-11-27 06:20 +0100
[PATCH 2/3] hwmon: tmp108: Use devm variants of registration interfaces. John Muir <john@jmuir.com> - 2016-11-27 06:20 +0100
Re: [PATCH 2/3] hwmon: tmp108: Use devm variants of registration interfaces. Guenter Roeck <linux@roeck-us.net> - 2016-11-27 13:30 +0100
Re: [PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. Guenter Roeck <linux@roeck-us.net> - 2016-11-27 13:30 +0100
Re: [PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. John Muir <john@jmuir.com> - 2016-11-28 20:50 +0100
Re: [PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. Guenter Roeck <linux@roeck-us.net> - 2016-11-28 21:10 +0100
Re: [PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. John Muir <john@jmuir.com> - 2016-11-28 22:30 +0100
Re: [PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. Guenter Roeck <linux@roeck-us.net> - 2016-11-28 23:20 +0100
Re: [PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. John Muir <john@jmuir.com> - 2016-11-29 00:20 +0100
Re: [PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver. Guenter Roeck <linux@roeck-us.net> - 2016-11-29 00:40 +0100
csiph-web