Re: [RFC] [PATCH V2 1/2] input: CMA3000 Accelerometer driver

From: Dmitry Torokhov
Date: Sun Aug 29 2010 - 14:24:52 EST


On Fri, Aug 13, 2010 at 08:34:07AM -0500, Murphy, Dan wrote:
> Hemanth
> I have a few comments on this patch.
>
> +static ssize_t cma3000_store_attr_mdfftmr(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct cma3000_accl_data *data = platform_get_drvdata(pdev);
> + unsigned long val;
> + int error;
> +
> + error = strict_strtoul(buf, 0, &val);
> + if (error)
> + return error;
> +
> + mutex_lock(&data->mutex);
> + data->pdata.mdfftmr = val;
> +
> + disable_irq(data->client->irq);
> You should use disable_irq_nosync here. This may not work properly on SMP.

This is an incorrect statement. disable_irq() is not safe to use on SMP when
caller may not sleep (since it will wait for the running handler to
complete), but in this context it is perfectly safe,

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/