lkml.org 
[lkml]   [2012]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] HID: hid-lg4ff: Use Private Data
On 04/02/2012 04:54 PM, Simon Wood wrote:
> Use private data in hid-lg4ff to store device properties.
>
> This code was writen by Michal, he asked me to check it and forward
> it on to the list.

So this patch is missing proper From: header.

> Signed-off-by: Michal Maly <madcatxster@gmail.com>
> Signed-off-by: Simon Wood <simon@mungewell.org>
> ---
> drivers/hid/hid-lg4ff.c | 96 +++++++++++++++++++++-------------------------
> 1 files changed, 44 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
> index 1145292..c3146e0 100644
> --- a/drivers/hid/hid-lg4ff.c
> +++ b/drivers/hid/hid-lg4ff.c
> @@ -285,18 +280,20 @@ static void hid_lg4ff_switch_native(struct hid_device *hid, const struct lg4ff_n
> /* Read current range and display it in terminal */
> static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute *attr, char *buf)
> {
> - struct lg4ff_device_entry *uninitialized_var(entry);
> - struct list_head *h;
> struct hid_device *hid = to_hid_device(dev);
> + struct lg4ff_device_entry *uninitialized_var(entry);
> + struct lg_drv_data *uninitialized_var(drv_data);

You don't need uninitialized_var bloat anymroe, right?

Here and at the other places too...

> size_t count;
>
> - list_for_each(h, &device_list.list) {
> - entry = list_entry(h, struct lg4ff_device_entry, list);
> - if (strcmp(entry->device_id, (&hid->dev)->kobj.name) == 0)
> - break;
> + drv_data = hid_get_drvdata(hid);
> + if (!drv_data) {
> + hid_err(hid, "Private driver data not found!\n");
> + return 0;
> }
> - if (h == &device_list.list) {
> - dbg_hid("Device not found!");
> +
> + entry = drv_data->device_props;
> + if (!entry) {
> + hid_err(hid, "Device properties not found!\n");
> return 0;
> }
>

--
js
suse labs



\
 
 \ /
  Last update: 2012-04-02 18:35    [W:0.108 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site