mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* panasonic-laptop driver oddity
@ 2009-01-15 15:47 Andy Whitcroft
  0 siblings, 0 replies; only message in thread
From: Andy Whitcroft @ 2009-01-15 15:47 UTC (permalink / raw)
  To: Harald Welte; +Cc: linux-kernel

We have been looking at your panasonic-laptop driver with a view to
back porting it to 2.6.27, and the following inconsistancy was pointed
out to me.  In bl_set_status() we ensure that bright is no lower than
sinf[SINF_AC_MIN_BRIGHT] and sinf[SINF_DC_MIN_BRIGHT], and then check if
it is lower than sinf[SINF_AC_MIN_BRIGHT].  That seems redundant.


    static int bl_set_status(struct backlight_device *bd)
    {
        struct pcc_acpi *pcc = bl_get_data(bd);
        int bright = bd->props.brightness;
        int rc;

        if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf))
                return -EIO;

        if (bright < pcc->sinf[SINF_AC_MIN_BRIGHT])
                bright = pcc->sinf[SINF_AC_MIN_BRIGHT];

        if (bright < pcc->sinf[SINF_DC_MIN_BRIGHT])
                bright = pcc->sinf[SINF_DC_MIN_BRIGHT];

        if (bright < pcc->sinf[SINF_AC_MIN_BRIGHT] ||
            bright > pcc->sinf[SINF_AC_MAX_BRIGHT])
                return -EINVAL;

We could not decide if this was simply belt and braces to constrain the
value, or if this should be a check against sinf[SINF_DC_MAX_BRIGHT].
Perhaps you could clarify?

-apw

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-15 15:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-15 15:47 panasonic-laptop driver oddity Andy Whitcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome