Hi Alexandre, Le 18/04/2013 17:38, Alexandre Belloni a écrit : > + nau7802_i2c_write(st, NAU7802_REG_PUCTRL, data); > + nau7802_i2c_write(st, NAU7802_REG_ADC_CTRL, 0x30); > + > + if (tmp >= 2400) { > + data = NAU7802_CTRL1_VLDO((4500 - tmp) / 300); > + nau7802_i2c_write(st, NAU7802_REG_CTRL1, data); > + } You should probably make a macro or inline function (with a comment) out of that computation explaining why you are doing this. > + > + st->min_conversions = 6; I'd prefer to see this as a define. > + > + /* > + * The ADC fires continuously and we can't do anything about > + * it. So we need to have the IRQ disabled by default, and we > + * will enable them back when we will need them.. > + */ > + if (client->irq) { > + irq_set_status_flags(client->irq, IRQ_NOAUTOEN); > + ret = request_threaded_irq(client->irq, > + NULL, > + nau7802_eoc_trigger, > + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > + client->dev.driver->name, > + idev); > + if (ret) { > + /* > + * What may happen here is that our IRQ controller is > + * not able to get level interrupt but this is required > + * by this ADC as when going over 40 sample per second, > + * the interrupt line may stay high between conversions. > + * So, we continue no matter what but we switch to > + * polling mode. > + */ > + dev_info(&client->dev, > + "Failed to allocate IRQ, using polling mode\n"); > + client->irq = 0; > + /* > + * We are polling, use the fastest sample rate by > + * default > + */ > + st->sample_rate = 0x7; Ditto. Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html