Re: [PATCH] HAPTIC: add HAPTIC class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kyungmin Park,

> +
> +static ssize_t haptic_value_store(struct device *dev,
> +               struct device_attribute *attr, const char *buf, size_t size)
> +{
> +       struct haptic_classdev *haptic_cdev = dev_get_drvdata(dev);
> +       ssize_t ret = -EINVAL;
> +       char *after;
> +       unsigned long state = simple_strtoul(buf, &after, 10);

s/simple_strtoul/strict_strtoul. code looks clean, but let's scan it
through scripts/checkpatch.pl.

> diff --git a/drivers/haptic/haptic.h b/drivers/haptic/haptic.h
> new file mode 100644
> index 0000000..888aaa3
> --- /dev/null
> +++ b/drivers/haptic/haptic.h
> @@ -0,0 +1,35 @@
> +/*
> + *  Haptic Core
> + *
> + *  Copyright (C) 2008 Samsung Electronics
> + *  Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
> +
> +#ifndef __HAPTIC_H_INCLUDED
> +#define __HAPTIC_H_INCLUDED
> +
> +#include <linux/device.h>
> +#include <linux/rwsem.h>
> +#include <linux/haptic.h>
> +
> +static inline void haptic_set_value(struct haptic_classdev *haptic_cdev,
> +                                       enum haptic_value value)
> +{
> +       if (value > HAPTIC_FULL)
> +               value = HAPTIC_FULL;
> +       haptic_cdev->value = value;
> +       if (!(haptic_cdev->flags & HAPTIC_SUSPENDED))
> +               haptic_cdev->set(haptic_cdev, value);
> +}
> +
> +static inline int haptic_get_value(struct haptic_classdev *haptic_cdev)
> +{
> +       return haptic_cdev->value;
> +}

You had mentioned in Kconfig help text that haptics set/get APIs can
be accessed from kernel drivers too, I am not able to understand that
from this code.


-- 
---Trilok Soni
http://triloksoni.wordpress.com
http://www.linkedin.com/in/triloksoni
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux