[ltp] Re: [Patch 2/3] ibm-acpi: LED Subsystem integration.

Stefan Schmidt linux-thinkpad@linux-thinkpad.org
Thu, 26 Oct 2006 14:30:24 +0200


--2FWNEMwxOgX6dEWt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello.

On Thu, 2006-10-26 at 04:10, Shem Multinymous wrote:
> >+static struct led_classdev thinklight_led =3D {
> >+       .name                   =3D "thinklight:white",
> >+       .default_trigger        =3D "none",
> >+       .brightness_set         =3D led_thinklight_set,
> >+};
>=20
> Add this to the above macro too.
> There should be exactly one line per LED in all of the above, with the
> rest factored out.

Yes, that sounds good.

> >+       ret =3D led_classdev_register(parent, &thinklight_led);
> >+       if (ret < 0) {
> >+               led_classdev_unregister(&power_led);
> >+               led_classdev_unregister(&battery_amber_led);
> >+               led_classdev_unregister(&battery_green_led);
> >+               led_classdev_unregister(&ultrabase_led);
> >+               led_classdev_unregister(&ultrabay_led);
> >+               led_classdev_unregister(&standby_led);
> >+       }
> >+
> >+       return ret;
> >+}
>=20
> Don't duplicate the cleanup on error. Instead, put a single cleanup
> sequence at the end, with labels for each line, and use goto to jump
> to the right point.

Indeed. Even if goto is not the right thing on other problems, it can
make the code less bloated here.

Thanks again for your fast response. I really appricate your feedback.

I'm a bit busy the next days, but I hope I can come up with a new
version in the beginning of the next week.

regards
Stefan Schmidt

--2FWNEMwxOgX6dEWt
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: http://www.datenfreihafen.org/contact.html

iD8DBQFFQKpfbNSsvd31FmURAst/AKDUWu9b6LvknxhBLvnjJKfSQ5yIyACgn3mO
h0MD7c9cfT15dpgYgloJy20=
=66oj
-----END PGP SIGNATURE-----

--2FWNEMwxOgX6dEWt--