Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3392099pxf; Mon, 29 Mar 2021 00:31:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDBRyKSRX7Sytr9Dd4VDvT1fk303/bf257/LWseki8d+JDUetsaBMa9orhIMCiH0mBnSAq X-Received: by 2002:aa7:d0c2:: with SMTP id u2mr27052997edo.158.1617003117494; Mon, 29 Mar 2021 00:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617003117; cv=none; d=google.com; s=arc-20160816; b=Re8GpbPsJ9k1P5HFR6zoz5rmqoC1N6TFRfIc/EcwfVNguZgvH+zN6r2W0NHl0+0kVI H9YGaSX0uyEpum6exqPc/mDqkAXM7u98KnktWXv0gelbxS/MSOzUE5Ws1hA7VX5DXb+y oCwf9bCvVpapyyZVmrdLD7Jy7FTCSb7Fv2mL0LvHUhA495ERWIcQrjAfwiyXrSrzErZ7 zrUDPJWPwWPD8EJlmhhQbspAevHWxt8KaknURgPB6JsqutnApQj6reDpyzU9/wlMdsn/ isQOIH8F9HUgP4eVAz+rrP+8cTAH4Os2ELJB/M5Kf37odCCIRvNU5QkKowoYH4wrBqSV CuFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :message-id:user-agent:references:in-reply-to:reply-to:subject:cc:to :from:date:mime-version; bh=zxMHhTfzu5nmuv19ZJswMXTYx5ybQTgYoykr0HapoeI=; b=PznTGKp6FwWBpc5AA38wONbEDjb4Vznevv5NyW9hQC6k8+HsvhG7hzwn6caIVC9oY8 j04RiIH3Nrl1C8UMzo8abqmooFBEPvUZ999gLeE53iLFkJfQ5CDLn1K4tJstS1UD7ciL Sgwq0nlQwKaHR/dML4rSZxdObAJAeR6S2/XJh6dup3Gavpj3dBF9R0sJYAf0jNIZkuJg 2FfeqGYu1ipU1lCQ5/u/A0YuZ4uiTYFEow/uxTrcIj4Z++p4Deid4l3wDLTGfZvLfVwW JNTBklypDN0VkdIeZ1CneiLQOFeod99Kz8wz1cnaaTFABm65mE0Q4lcCXFTcJGM89CGC sQKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i10si12085571edy.452.2021.03.29.00.31.34; Mon, 29 Mar 2021 00:31:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229483AbhC2Ha0 (ORCPT + 99 others); Mon, 29 Mar 2021 03:30:26 -0400 Received: from protonic.xs4all.nl ([83.163.252.89]:46670 "EHLO protonic.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230503AbhC2HaK (ORCPT ); Mon, 29 Mar 2021 03:30:10 -0400 Received: from fiber.protonic.nl (edge2.prtnl [192.168.1.170]) by sparta.prtnl (Postfix) with ESMTP id D864544A022C; Mon, 29 Mar 2021 09:30:08 +0200 (CEST) MIME-Version: 1.0 Date: Mon, 29 Mar 2021 09:30:08 +0200 From: Robin van der Gracht To: Geert Uytterhoeven Cc: Rob Herring , Miguel Ojeda , Paul Burton , Greg Kroah-Hartman , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:BROADCOM NVRAM DRIVER" , Linux Kernel Mailing List Subject: Re: [PATCH 16/17] auxdisplay: ht16k33: Add support for segment displays Reply-To: robin@protonic.nl In-Reply-To: References: <20210322144848.1065067-1-geert@linux-m68k.org> <20210322144848.1065067-17-geert@linux-m68k.org> <2868cd091dc6ff0cab14b5da07f89984@protonic.nl> User-Agent: Roundcube Webmail/1.4.8 Message-ID: <8376c4a183971aef9631c1bc64f9222c@protonic.nl> X-Sender: robin@protonic.nl Organization: Protonic Holland Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-03-29 09:15, Geert Uytterhoeven wrote: > Hoi Robin, > > On Mon, Mar 29, 2021 at 9:09 AM Robin van der Gracht > 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 >> > --- >> > 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