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@xxxxxxxxx> > Signed-off-by: Simon Wood <simon@xxxxxxxxxxxxx> > --- > 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 -- 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