* [PATCH 1/1] hid: hid-sensor-custom: simplify getting .driver_data
@ 2019-03-19 16:36 Wolfram Sang
2019-03-25 16:20 ` Srinivas Pandruvada
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wolfram Sang @ 2019-03-19 16:36 UTC (permalink / raw)
To: linux-kernel
Cc: linux-renesas-soc, Wolfram Sang, Jiri Kosina, Jonathan Cameron,
Srinivas Pandruvada, Benjamin Tissoires, linux-input, linux-iio
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>
---
Build tested only. buildbot is happy.
drivers/hid/hid-sensor-custom.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index bb012bc032e0..462e653a7bbb 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -157,8 +157,7 @@ static int usage_id_cmp(const void *p1, const void *p2)
static ssize_t enable_sensor_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
+ struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
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,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
+ struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
int value;
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,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
+ struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
struct hid_sensor_hub_attribute_info *attribute;
int index, usage, field_index;
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,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
+ struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
int index, field_index, usage;
char name[HID_CUSTOM_NAME_LENGTH];
int value;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] hid: hid-sensor-custom: simplify getting .driver_data
2019-03-19 16:36 [PATCH 1/1] hid: hid-sensor-custom: simplify getting .driver_data Wolfram Sang
@ 2019-03-25 16:20 ` Srinivas Pandruvada
2019-03-27 12:12 ` Simon Horman
2019-03-27 13:06 ` Jiri Kosina
2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Pandruvada @ 2019-03-25 16:20 UTC (permalink / raw)
To: Wolfram Sang, linux-kernel
Cc: linux-renesas-soc, Jiri Kosina, Jonathan Cameron,
Benjamin Tissoires, linux-input, linux-iio
On Tue, 2019-03-19 at 17:36 +0100, Wolfram Sang wrote:
> 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>
> ---
>
> Build tested only. buildbot is happy.
>
> drivers/hid/hid-sensor-custom.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-
> sensor-custom.c
> index bb012bc032e0..462e653a7bbb 100644
> --- a/drivers/hid/hid-sensor-custom.c
> +++ b/drivers/hid/hid-sensor-custom.c
> @@ -157,8 +157,7 @@ static int usage_id_cmp(const void *p1, const
> void *p2)
> static ssize_t enable_sensor_show(struct device *dev,
> struct device_attribute *attr, char
> *buf)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hid_sensor_custom *sensor_inst =
> platform_get_drvdata(pdev);
> + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
>
> 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,
> const char *buf, size_t count)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hid_sensor_custom *sensor_inst =
> platform_get_drvdata(pdev);
> + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
> int value;
> 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,
> char *buf)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hid_sensor_custom *sensor_inst =
> platform_get_drvdata(pdev);
> + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
> struct hid_sensor_hub_attribute_info *attribute;
> int index, usage, field_index;
> 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,
> const char *buf, size_t count)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hid_sensor_custom *sensor_inst =
> platform_get_drvdata(pdev);
> + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
> int index, field_index, usage;
> char name[HID_CUSTOM_NAME_LENGTH];
> int value;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] hid: hid-sensor-custom: simplify getting .driver_data
2019-03-19 16:36 [PATCH 1/1] hid: hid-sensor-custom: simplify getting .driver_data Wolfram Sang
2019-03-25 16:20 ` Srinivas Pandruvada
@ 2019-03-27 12:12 ` Simon Horman
2019-03-27 13:06 ` Jiri Kosina
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2019-03-27 12:12 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-kernel, linux-renesas-soc, Jiri Kosina, Jonathan Cameron,
Srinivas Pandruvada, Benjamin Tissoires, linux-input, linux-iio
On Tue, Mar 19, 2019 at 05:36:38PM +0100, Wolfram Sang wrote:
> 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>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
> ---
>
> Build tested only. buildbot is happy.
>
> drivers/hid/hid-sensor-custom.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
> index bb012bc032e0..462e653a7bbb 100644
> --- a/drivers/hid/hid-sensor-custom.c
> +++ b/drivers/hid/hid-sensor-custom.c
> @@ -157,8 +157,7 @@ static int usage_id_cmp(const void *p1, const void *p2)
> static ssize_t enable_sensor_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
> + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
>
> 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,
> const char *buf, size_t count)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
> + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
> int value;
> 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,
> char *buf)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
> + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
> struct hid_sensor_hub_attribute_info *attribute;
> int index, usage, field_index;
> 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,
> const char *buf, size_t count)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
> + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
> int index, field_index, usage;
> char name[HID_CUSTOM_NAME_LENGTH];
> int value;
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] hid: hid-sensor-custom: simplify getting .driver_data
2019-03-19 16:36 [PATCH 1/1] hid: hid-sensor-custom: simplify getting .driver_data Wolfram Sang
2019-03-25 16:20 ` Srinivas Pandruvada
2019-03-27 12:12 ` Simon Horman
@ 2019-03-27 13:06 ` Jiri Kosina
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2019-03-27 13:06 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-kernel, linux-renesas-soc, Jonathan Cameron,
Srinivas Pandruvada, Benjamin Tissoires, linux-input, linux-iio
On Tue, 19 Mar 2019, Wolfram Sang wrote:
> 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>
Applied to for-5.2/sensor, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-27 13:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 16:36 [PATCH 1/1] hid: hid-sensor-custom: simplify getting .driver_data Wolfram Sang
2019-03-25 16:20 ` Srinivas Pandruvada
2019-03-27 12:12 ` Simon Horman
2019-03-27 13:06 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).