Messages in this thread | | | Date | Fri, 26 Aug 2005 17:44:39 -0500 | From | Dmitry Torokhov <> | Subject | Re: [patch] IBM HDAPS accelerometer driver, with probing. |
| |
On 8/26/05, Robert Love <rml@novell.com> wrote:
> +static void hdaps_calibrate(void) > +{ > + int x, y, ret; > + > + ret = accelerometer_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y); > + if (unlikely(ret)) > + return; > + > + rest_x = x; > + rest_y = y; > +}
Is this function used in a hot path to warrant using "unlikely"? There are to many "unlikely" in the code for my taste.
> + > +static ssize_t hdaps_mousedev_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + int enable; > + > + if (sscanf(buf, "%d", &enable) != 1) > + return -EINVAL; > + > + spin_lock(&hdaps_lock); > + if (enable == 1) > + hdaps_mousedev_enable(); > + else if (enable == 0) > + hdaps_mousedev_disable(); > + spin_unlock(&hdaps_lock); > + > + return count; > +}
input_[un]register_device and del_timer_sync are "long" operations. I think a semaphore would be better here.
-- Dmitry - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |