[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191103170327.GA32107@duo.ucw.cz>
Date: Mon, 4 Nov 2019 10:09:53 +0100
From: Pavel Machek <pavel@....cz>
To: Zahari Petkov <zahari@...ena.io>
Cc: Jacek Anaszewski <jacek.anaszewski@...il.com>,
Dan Murphy <dmurphy@...com>, linux-leds@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: pca963x: Fix open-drain initialization
On Mon 2019-10-14 15:36:04, Zahari Petkov wrote:
> OUTDRV setting (bit 2) of Mode register 2 has a default value of 1.
> During initialization when open-drain is used, instead of setting
> OUTDRV to 0, the driver keeps it as 1. OUTDRV setting is now correctly
> initialized to 0 when open-drain is used.
>
> Additionally the BIT macro is used for improved readibility.
You change more than you describe in the changelog.
> +++ b/drivers/leds/leds-pca963x.c
> @@ -438,12 +438,12 @@ static int pca963x_probe(struct i2c_client *client,
> PCA963X_MODE2);
> /* Configure output: open-drain or totem pole (push-pull) */
> if (pdata->outdrv == PCA963X_OPEN_DRAIN)
> - mode2 |= 0x01;
> + mode2 &= ~BIT(2);
| 0 -> & ~0x04;
> else
> - mode2 |= 0x05;
> + mode2 |= BIT(2);
| 5 -> | 0x04;
Are you sure?
Additionaly, we already have defines for bits in mode2 register:
#define PCA963X_MODE2_DMBLNK 0x20 /* Enable blinking */
So if you care about readability, perhaps you should add defines for
invert/ open drain there, and then use them?
Please keep using 0xab instead of BIT() for consistency with the rest
of the driver.
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists