[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8376c4a183971aef9631c1bc64f9222c@protonic.nl>
Date: Mon, 29 Mar 2021 09:30:08 +0200
From: Robin van der Gracht <robin@...tonic.nl>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Rob Herring <robh+dt@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Paul Burton <paulburton@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
"open list:BROADCOM NVRAM DRIVER" <linux-mips@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 16/17] auxdisplay: ht16k33: Add support for segment
displays
On 2021-03-29 09:15, Geert Uytterhoeven wrote:
> Hoi Robin,
>
> On Mon, Mar 29, 2021 at 9:09 AM Robin van der Gracht
> <robin@...tonic.nl> wrote:
>> On 2021-03-22 15:48, Geert Uytterhoeven wrote:
>> > The Holtek HT16K33 LED controller is not only used for driving
>> > dot-matrix displays, but also for driving segment displays.
>> >
>> > Add support for 4-digit 7-segment and quad 14-segment alphanumeric
>> > displays, like the Adafruit 7-segment and 14-segment display backpack
>> > and FeatherWing expansion boards. Use the character line display core
>> > support to display a message, which will be scrolled if it doesn't fit.
>> >
>> > Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
>> > ---
>> > The 7-segment support is based on schematics, and untested on actual
>> > hardware.
>> > ---
>> > drivers/auxdisplay/ht16k33.c | 198 +++++++++++++++++++++++++++++++++--
>> > 1 file changed, 191 insertions(+), 7 deletions(-)
>> >
>> ...
>> >
>> > +static int ht16k33_seg_probe(struct i2c_client *client,
>> > + struct ht16k33_priv *priv, uint32_t brightness)
>> > +{
>> > + struct ht16k33_seg *seg = &priv->seg;
>> > + struct device *dev = &client->dev;
>> > + int err;
>> > +
>> > + err = ht16k33_brightness_set(priv, MAX_BRIGHTNESS);
>> > + if (err)
>> > + return err;
>> > +
>> > + switch (priv->type) {
>> > + case DISP_MATRIX:
>> > + /* not handled here */
>> > + break;
>>
>> This 'case' shouldn't happen. Having said that, the break here will
>> still
>> cause the linedisp_register() function to be called for the
>> DISP_MATRIX
>> type.
>> If you'd like to handle this case, a return (or setting 'err') should
>> prevent this.
>
> This function is never called if priv->type == DISP_MATRIX, so this
> cannot happen. However, gcc complains if not all enum values are
> handled in a switch() statement, hence the dummy case.
I see. But if it's there it should work right? :P
> Is there a better way to handle this?
How about adding the default case:
default:
/* not handled */
err = -EINVAL;
Groetjes/Kind regards,
Robin van der Gracht
--
Protonic Holland
Factorij 36
1689AL Zwaag
+31 (0)229 212928
https://www.protonic.nl
Powered by blists - more mailing lists