Message ID | 1370338722-3646-1-git-send-email-holler@ahsoftware.de |
---|---|
State | Rejected |
Headers | show |
Hello, sorry to bother again. I've now had the time to play with the new hctosys I proposed patches for and rtc-hid-sensor-time. If the new hctosys mechanism will end up in the kernel, the following patches I've recently send and which already got merged to -mm won't work anymore and should disappear: [PATCH 3/4] rtc: rtc-hid-sensor-time: add option hctosys to set time at boot [PATCH 4/4] rtc: rtc-hid-sensor-time: add support for milliseconds [PATCH] rtc: rtc-hid-sensor-time: fix possible bug on driver_remove The other two patches [PATCH 1/4] rtc: rtc-hid-sensor-time: allow full years (16bit) in HID reports [PATCH 2/4] rtc: rtc-hid-sensor-time: allow 16 and 32 bit values for all attributes. which got merged too are still fine. I don't know if I should send reverts for those 3 patches, or ... I've already have a patch which would be needed if the new hctosys would be used, but I will delay sending them until we figured out if and how that new hctosys will become real. But you might already revert or delete the above 3 patches in your tree. That silly looking driver rtc-hid-sensor-time is really an endless story. :/ Besides writing the driver and an example firmware implementation I had to make patches for iio, hid-sensor-hub and hid, and now for timekeeping and rtc. All for nothing but the fun having to convince maintainers of all sorts and bothering them. ;) And the todo-list still contains some stuff: - rtc-hid-sensor-time still does not get loaded automatically if a matching hid-sensor-hub appears to the system. That needs changes to hid and/or hid-sensor-hub. Problem is that I don't have a real hid sensor hub and I don't know why the people which do produce such products and have written hid-sensor-hub didn't have implemented a way to do such. Or I've just missed something. - Have to redo millisecond support. - ntp functionality (e.g. module parameter adjtime) to make it possible to use a hardware clock with support for milliseconds to turn the system clock to a stratum 1 clock. - and last but not least I hope the standard for those HID sensors will become a standardized way to set the time. I still wouldn't like it if I had to "invent" something myself (easy, but it would be linux-specific and "invented" by some fool like me who just wrote it's own firmware without having any knowledge about some real hid-sensor products ;) ), but ... Regards, Alexander Holler
diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c index 4aca12d..acb2bc2 100644 --- a/drivers/rtc/rtc-hid-sensor-time.c +++ b/drivers/rtc/rtc-hid-sensor-time.c @@ -414,9 +414,8 @@ static int hid_time_remove(struct platform_device *pdev) struct hid_time_state *time_state = platform_get_drvdata(pdev); if (time_state->workts) { - cancel_work_sync(&time_state->workts->work); - kfree(time_state->workts); - time_state->workts = NULL; + flush_work(&time_state->workts->work); + BUG_ON(time_state->workts != NULL); } sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME);
The work we schedule on register deletes himself. Therefor we cannot use cancel_work_sync() because that calls flush_work() but still uses the pointer to the (now deleted) work afterwards (for clear_work_data) which ends up in a bug. Replacing cancel_work_sync() with flush_work() fixes that. Signed-off-by: Alexander Holler <holler@ahsoftware.de> --- This patch applies on top of PATCH 3/4 or 4/4 of the small series of 4 patches for rtc-hid-sensor-time, which was already merged into the -mm tree. drivers/rtc/rtc-hid-sensor-time.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)