HID: hid-sensor-custom: simplify getting .driver_data
We should get 'driver_data' from 'struct device' directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:

committed by
Jiri Kosina

parent
c6400e5cef
commit
77f9f77218
@@ -157,8 +157,7 @@ static int usage_id_cmp(const void *p1, const void *p2)
|
|||||||
static ssize_t enable_sensor_show(struct device *dev,
|
static ssize_t enable_sensor_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
|
||||||
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
|
|
||||||
|
|
||||||
return sprintf(buf, "%d\n", sensor_inst->enable);
|
return sprintf(buf, "%d\n", sensor_inst->enable);
|
||||||
}
|
}
|
||||||
@@ -237,8 +236,7 @@ static ssize_t enable_sensor_store(struct device *dev,
|
|||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
|
||||||
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
|
|
||||||
int value;
|
int value;
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
@@ -283,8 +281,7 @@ static const struct attribute_group enable_sensor_attr_group = {
|
|||||||
static ssize_t show_value(struct device *dev, struct device_attribute *attr,
|
static ssize_t show_value(struct device *dev, struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
|
||||||
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
|
|
||||||
struct hid_sensor_hub_attribute_info *attribute;
|
struct hid_sensor_hub_attribute_info *attribute;
|
||||||
int index, usage, field_index;
|
int index, usage, field_index;
|
||||||
char name[HID_CUSTOM_NAME_LENGTH];
|
char name[HID_CUSTOM_NAME_LENGTH];
|
||||||
@@ -392,8 +389,7 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr,
|
|||||||
static ssize_t store_value(struct device *dev, struct device_attribute *attr,
|
static ssize_t store_value(struct device *dev, struct device_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
|
||||||
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
|
|
||||||
int index, field_index, usage;
|
int index, field_index, usage;
|
||||||
char name[HID_CUSTOM_NAME_LENGTH];
|
char name[HID_CUSTOM_NAME_LENGTH];
|
||||||
int value;
|
int value;
|
||||||
|
Reference in New Issue
Block a user