From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEA2AC4361B for ; Mon, 7 Dec 2020 14:29:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66FC0235FF for ; Mon, 7 Dec 2020 14:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726207AbgLGO3R (ORCPT ); Mon, 7 Dec 2020 09:29:17 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35165 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbgLGO3O (ORCPT ); Mon, 7 Dec 2020 09:29:14 -0500 Received: by mail-lj1-f193.google.com with SMTP id f11so3266031ljn.2; Mon, 07 Dec 2020 06:28:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oyG3xafNMDjBeHpTIfZ1CqSL3XaC5zJrd47UwVwp3Vc=; b=e4IjVz6wU26JdgXqKoymln+xYQE3ulqOVVZy+XNa+Ixp6HvUOP8mU7okOnqe0R25lt V/8QKYhF/QyWAmiQ6LShIY2L93/7Q6+Q+brP11DINT79WccLKZvGn/TfJ95L088TI+cY KIIavy0v8viDtBmxeACpaW4xF/CTrwuhwewdTCYv645nBrAzbKGqflwsYJko8dH5+cSQ K5HxfxM5FIpc8QcqJ3v+8C2h9m58ZCuKYqqupp4YGKwRuvcw23Gm69IPYasgO30GeqCU mXTx7q5mBVZbqLLeviyADPgmvV/PVU4qy6dmOz+NGkbGwrgove9zCvvgT/AO5YMykFeQ D8HA== X-Gm-Message-State: AOAM532JybUIy13gOUpCuBFkZCFZ54f5VK+4M6fOZUbNelYQ2nK/89WC jIGP25vGZ32rzrVewNqO5Cc= X-Google-Smtp-Source: ABdhPJweMD5isL/j9NGL6U2i6VJXDRPh6CRmvAZUUk8sDCLHT7DAuO5A3CouH5XiTmxY8qGlgeji6w== X-Received: by 2002:a2e:858b:: with SMTP id b11mr8849727lji.90.1607351306392; Mon, 07 Dec 2020 06:28:26 -0800 (PST) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id q20sm3079742ljp.90.2020.12.07.06.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 06:28:25 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1kmHVd-0002uS-BH; Mon, 07 Dec 2020 15:29:01 +0100 Date: Mon, 7 Dec 2020 15:29:01 +0100 From: Johan Hovold To: Marc Zyngier Cc: linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij , Bartosz Golaszewski , Johan Hovold , Greg Kroah-Hartman , kernel-team@android.com Subject: Re: [PATCH 3/4] USB: serial: ftdi_sio: Log the CBUS GPIO validity Message-ID: References: <20201204164739.781812-1-maz@kernel.org> <20201204164739.781812-4-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201204164739.781812-4-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Fri, Dec 04, 2020 at 04:47:38PM +0000, Marc Zyngier wrote: > The validity of the ftdi CBUS GPIO is pretty hidden so far, > and finding out *why* some GPIOs don't work is sometimes > hard to identify. So let's help the user by displaying the > map of the CBUS pins that are valid for a GPIO. > > Also, tell the user about the magic ftx-prog tool that can > make GPIOs appear: https://github.com/richardeoin/ftx-prog > > Suggested-by: Linus Walleij > Signed-off-by: Marc Zyngier > --- > drivers/usb/serial/ftdi_sio.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c > index 13e575f16bcd..b9d3b33891fc 100644 > --- a/drivers/usb/serial/ftdi_sio.c > +++ b/drivers/usb/serial/ftdi_sio.c > @@ -2012,6 +2012,15 @@ static int ftdi_gpio_init_valid_mask(struct gpio_chip *gc, > > bitmap_complement(valid_mask, &map, ngpios); > > + if (bitmap_empty(valid_mask, ngpios)) > + dev_warn(&port->dev, "No usable GPIO\n"); This isn't an error of any kind, and certainly not something that deserves a warning in the system log on every probe. Not everyone cares about the GPIO interface. > + else > + dev_info(&port->dev, "Enabling CBUS%*pbl for GPIO\n", > + ngpios, valid_mask); And while printing this mask has some worth I'm still reluctant to be spamming the logs with it. Just like gpolib has a dev_dbg() for registering chips, this should probably be demoted to KERN_DEBUG as well. > + > + if (!bitmap_full(valid_mask, ngpios)) > + dev_warn_once(&port->dev, "Consider using a tool such as ftx-prog to enable GPIOs if required\n"); > + And again, this is not something that belongs in the logs of just about every system with an attached ftdi device. While not possible to combine with the valid_mask approach, this is something which we could otherwise add to the request() callback for the first request that fails due to the mux configuration. > return 0; > } Johan