The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Simon Wood <simon@mungewell.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>,
	Michael Bauer <michael@m-bauer.org>,
	Michal Maly <madcatxster@gmail.com>
Subject: Re: [PATCH 1/2] HID: hid-lg4ff: Use Private Data
Date: Mon, 02 Apr 2012 18:32:06 +0200	[thread overview]
Message-ID: <4F79D486.5090605@suse.cz> (raw)
In-Reply-To: <1333378444-3117-1-git-send-email-simon@mungewell.org>

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


  parent reply	other threads:[~2012-04-02 16:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a4e40aa5c43be934d83240849aa25f3b.squirrel@mungewell.org>
2012-04-02 14:54 ` [PATCH 1/2] HID: hid-lg4ff: Use Private Data Simon Wood
2012-04-02 14:54   ` [PATCH 2/2] HID: hid-lg4ff: Add support for G27 leds Simon Wood
2012-04-02 16:38     ` Jiri Slaby
2012-04-02 16:32   ` Jiri Slaby [this message]
2012-04-02 17:01     ` [PATCH 1/2] HID: hid-lg4ff: Use Private Data simon
2012-04-02 17:30       ` Jiri Slaby
2012-04-03  2:14       ` Jiri Kosina
2012-04-03  2:13   ` Jiri Kosina
2012-04-03  8:02     ` Michal Malý

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F79D486.5090605@suse.cz \
    --to=jslaby@suse.cz \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madcatxster@gmail.com \
    --cc=michael@m-bauer.org \
    --cc=simon@mungewell.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox