[PATCH 6/7] drm/i915: i2c: unconditionally set up gpio fallback

Eugeni Dodonov eugeni at dodonov.net
Tue Feb 14 15:47:01 PST 2012


On Tue, Feb 14, 2012 at 19:37, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:

>        /* Hardware may not support GMBUS over these pins? Try GPIO
> bitbanging instead. */
> -       bus->force_bit = intel_gpio_create(bus, bus->reg0 & 0xff);
> -       if (!bus->force_bit)
> -               ret = -ENOMEM;
> -       else
> -               ret = intel_i2c_quirk_xfer(bus, bus->force_bit, msgs, num);
> +       ret = -EIO;
> +       if (bus->has_gpio) {
> +               bus->force_bit = true;
> +               ret = intel_i2c_quirk_xfer(bus, msgs, num);
> +       }
>

<bikeshedding>
Wouldn't it be cleaner and more consistent with the rest of the code to use:

if (!bus->has_gpio)
    ret = -EIO;
else {
    bus->force_bit = true;
    ret = intel_i2c_quirk_xfer(bus, msgs, num);
}

instead?
</bikeshedding>

Other than that, it looks correct to me, and certainly makes code more
clean.

Reviewed-by: Eugeni Dodonov <eugeni.dodonov at intel.com>

-- 
Eugeni Dodonov
<http://eugeni.dodonov.net/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20120214/a59f3d5e/attachment.htm>


More information about the dri-devel mailing list