On

+static ssize_t show_power_state(struct device *dev,
>
> + struct device_attribute *attr, char *buf)
>
> +{
>
> + struct spi_device *spi = to_spi_device(dev);
>
> + struct elan_data *ed = spi_get_drvdata(spi);
>
> + return sprintf(buf, "%d\n", ed->power_state);
>
> +}
>
> +
>
> +static ssize_t store_power_state(struct device *dev,
>
> + struct device_attribute *attr,
>
> + const char *buf, size_t count)
>
> +{
>
> + struct spi_device *spi = to_spi_device(dev);
>
> + struct elan_data *ed = spi_get_drvdata(spi);
>
> + unsigned long status = 0;
>
> + int ret;
>
> +
>
> + mutex_lock(&ed->sysfs_mutex);
>
> +
>
> + ret = strict_strtol(buf, 0, &status);
>
> +
>
> + if (ret < 0)
>
> + return -EINVAL;
>
> +
>
> + /* Force as 0 or 1 */
>
> + if (status)
>
> + status = 1;
>
> +
>
> + if (status != ed->user_power) {
>
> + if (status)
>
> + pm_runtime_get_sync(dev);
>
> + else
>
> + pm_runtime_put(dev);
>
> + ed->user_power = status;
>
> + }
>
> +
>
> + mutex_unlock(&ed->sysfs_mutex);
>
> +
>
> + return count;
>
> +}
>
>


these two should really not exist, and I really don't want to merge the
patch with these two in. Sorry.

Normal runtime PM (with device open/close taking care of the refcount)
should be sufficient.

_______________________________________________
MeeGo-kernel mailing list
MeeGo-kernel@lists.meego.com
http://lists.meego.com/listinfo/meego-kernel

Reply via email to