lkml.org 
[lkml]   [2005]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/

\
 
 \ /
  Last update: 2005-08-27 00:47    [W:0.085 / U:7.888 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site