Re: [PATCH 2/4] leds: Driver for National Semiconductors LP5523chip

From: Matti J. Aaltonen
Date: Mon Sep 27 2010 - 06:54:48 EST


Moi.

On Thu, 2010-09-16 at 12:12 +0200, Onkalo Samu.P (Nokia-MS/Tampere)
wrote:
> +
> + for (i = 0; i < LP5523_ENGINES; i++) {
> + if (chip->engines[i].mode == LP5523_CMD_LOAD)
> + sysfs_remove_group(&dev->kobj, &lp5523_engine_group[i]);
> + }
> +
> + for (i = 0; i < chip->num_leds; i++)
> + sysfs_remove_group(&chip->leds[i].cdev.dev->kobj,
> + &lp5523_led_attribute_group);
> +}

Tossa ylla on se asia, josta puhuttiin, style guide sanoo:

Do not unnecessarily use braces where a single statement will do.

if (condition)
action();

Tossa ylla on kummankin for:in jalkeen single statement joista kumpikaan
ei mahdu yhdelle riville... Mun nakemyksen mukaan ne molemmat olis yhta
selkeita ilman sulkuja...


> + if (mode == LP5523_CMD_RUN)
> + ret = lp5523_run_program(engine);
> +
> + else if (mode == LP5523_CMD_LOAD) {
> +
> + lp5523_set_engine_mode(engine, LP5523_CMD_DISABLED);
> + lp5523_set_engine_mode(engine, LP5523_CMD_LOAD);
> +
> + ret = sysfs_create_group(&dev->kobj, engine->attributes);
> + if (ret)
> + return ret;
> + }
> +

Aaltosulut myos if:n jalkeiseen statementtiin....

t.m.a.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/