mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: simon@mungewell.org
To: "Jiri Kosina" <jkosina@suse.cz>
Cc: "Simon Wood" <simon@mungewell.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Michael Bauer" <michael@m-bauer.org>,
	"Michal Maly" <madcatxster@gmail.com>
Subject: Re: [PATCH 1/2] HID: hid-lg4ff: Add support for G27 LEDs
Date: Wed, 18 Apr 2012 10:58:39 -0400	[thread overview]
Message-ID: <2702029527a38f9e28882007b36eaf73.squirrel@mungewell.org> (raw)
In-Reply-To: <alpine.LNX.2.00.1204181320180.16373@pobox.suse.cz>

>> +	__u8  led_state;
>> +	struct led_classdev *led[5];
>
> Why not put this under the CONFIG_LEDS_CLASS condition as well?

Can do, I don't think these are referenced anywhere else.

>> +	/* register led subsystem - G27 only */
>> +	entry->led_state = 0;
>> +	for (j = 0; j < 5; j++)
>> +		entry->led[j] = NULL;
>> +
>
> The same here.

OK.

>> +			if (error) {
>> +				hid_err(hid, "failed to register LED %d. Aborting.\n", j);
>> +err:
>> +				/* Deregister LEDs (if any) but let the driver continue */
>> +				for (j = 0; j < 5; j++) {
>> +					led = entry->led[j];
>> +					entry->led[j] = NULL;
>> +					if (!led)
>> +						continue;
>> +					led_classdev_unregister(led);
>> +				kfree(led);
>
> Indentation seems to be wrong here.

Bugger...

>
>> +				}
>> +				break;	/* Don't create any more LEDs */
>
> Putting the whole err: label outside the outer for cycle would make the
> whole thing much more readable (and would save you the break). Could you
> please redo this?

The 'break' is actually not needed as 'j' has reached maximum value and
the outer for loop would be at completion. I put the 'break' there just to
highlight this fact.

Maybe just a comment would be OK, such as 'on error fall though to driver
completion'.

The reason I'd like this code here is that it seems traditional to output
the following 'hid_info' line once the driver is fully active.

>>  	hid_info(hid, "Force feedback for Logitech Speed Force Wireless by
>> Simon Wood <simon@mungewell.org>\n");

Moving the 'err:' code would have to:
1). Jump back to hit this hid_info line
2). Duplicate the hid_info line
3). Have err code called as a function

Any major objections to keeping it as is?


Man, it seems to be taking me ages to get this code right....
Simon


  reply	other threads:[~2012-04-18 14:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1649210.pcO5IpzBEF@qosmio-x300>
2012-04-09 16:08 ` [PATCH] " Simon Wood
2012-04-13 12:59   ` Jiri Kosina
2012-04-18  7:03     ` [PATCH 1/2] " Simon Wood
2012-04-18  7:03       ` [PATCH 2/2] HID: hid-lg4ff: Updated Comments Simon Wood
2012-04-18 11:24       ` [PATCH 1/2] HID: hid-lg4ff: Add support for G27 LEDs Jiri Kosina
2012-04-18 14:58         ` simon [this message]
2012-04-20 10:05           ` Jiri Kosina
2012-04-21 12:41             ` Simon Wood
2012-04-21 12:41               ` [PATCH 2/2] HID: hid-lg4ff: Updated Comments Simon Wood
2012-04-23 18:55               ` [PATCH 1/2] HID: hid-lg4ff: Add support for G27 LEDs Jiri Kosina
2012-03-13 21:08 [PATCH 1/2] HID: hid-lg4ff add " simon
2012-03-13 21:11 ` simon
2012-03-13 21:24 ` Jiri Kosina
2012-03-13 21:44   ` simon
2012-03-14  1:51   ` simon
  -- strict thread matches above, loose matches on Subject: below --
2012-03-12 15:17 Simon Wood
2012-03-12 15:46 ` Jiri Kosina
2012-03-12 18:04   ` simon
2012-03-12 18:07     ` Mark Brown
2012-03-12 18:19       ` simon
2012-03-12 18:32         ` Mark Brown
2012-03-12 19:05           ` simon
2012-03-12 19:12             ` Mark Brown
2012-03-13  8:23             ` Jiri Kosina
2012-03-12 16:09 ` Jiri Kosina

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=2702029527a38f9e28882007b36eaf73.squirrel@mungewell.org \
    --to=simon@mungewell.org \
    --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 \
    /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

all inboxes | Powered by JetHome®