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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13DCECCA47B for ; Tue, 14 Jun 2022 18:14:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235239AbiFNSOA (ORCPT ); Tue, 14 Jun 2022 14:14:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbiFNSN6 (ORCPT ); Tue, 14 Jun 2022 14:13:58 -0400 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4002919C32 for ; Tue, 14 Jun 2022 11:13:57 -0700 (PDT) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-30c143c41e5so38456087b3.3 for ; Tue, 14 Jun 2022 11:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZsjTA9iJIzTxX4ygR8FdKM9wnHJIUgreAx1BZ2osk+k=; b=elkEMMAy3wPQwGf1ROmnn/4Isu60xOrk5kwhUf9POtxNbXra9m+VOIyaYdDcP+3CU3 2JT5ARrP4xwLtPX0Ds74mSJUDU0WpEwRhBDquEnA4hNv+/G/6Q6UFzYcWShmefjq8AjX gz+FlbByjs1p+vyfBLAp58Tc0jFjVzOn1TINg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZsjTA9iJIzTxX4ygR8FdKM9wnHJIUgreAx1BZ2osk+k=; b=QmT8jfjpuPvBWVyocAyt4RBgizWIHIs9QJvIg3NjHya9ZVtN2IMKaSzdRpTbgKKLUQ Ur1Lbxuc+s4M3WmTxwNBReNwWdPozWzgWtSeMYgYTVnerWGzOL8q1CPrjkXN5WeriZH9 9pRcGlyEfZVJp2Y4B5LsfezSjg+Y/a1vV57eL8hHrklPS2FGOMwXUvLBAOZs6IE3kAZp YCKyqfU1ycCzI7HrC/u7wPHyYx4KgHCYk7zIx8vIx9U+LLE6XrtoH0WD0yQ+wAD8osN/ KtpUgN4E0lGov8VjokWJo/t9o8/F45SPqpBFF8ap9hAFw0RO10FI1NaSrUMJV8heHbL5 k0tg== X-Gm-Message-State: AJIora9d/1Ef1i+tLWDOAMpSw3tVkFCkSlPg/pRYmjkrwmTVix+/V9+t 8Fkf7O4JmI8Ev5jM+sd1ztw+X8wRG24u4yHPh7G68w== X-Google-Smtp-Source: AGRyM1uE67Atomlar3nLQdgT+jy4zLDSFTPt4ERa1X/kLBHMBihOauBraRP729dfHSV8ag/nSgM1IEdsAe/aMtNwTF8= X-Received: by 2002:a81:fd1:0:b0:30f:f98b:4957 with SMTP id 200-20020a810fd1000000b0030ff98b4957mr7329858ywp.350.1655230436484; Tue, 14 Jun 2022 11:13:56 -0700 (PDT) MIME-Version: 1.0 References: <20220609181106.3695103-1-pmalani@chromium.org> <20220609181106.3695103-6-pmalani@chromium.org> In-Reply-To: From: Prashant Malani Date: Tue, 14 Jun 2022 11:13:45 -0700 Message-ID: Subject: Re: [PATCH v2 5/7] drm/bridge: anx7625: Register number of Type C switches To: AngeloGioacchino Del Regno Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, heikki.krogerus@linux.intel.com, Andrzej Hajda , Neil Armstrong , David Airlie , "open list:DRM DRIVERS" , Laurent Pinchart , Krzysztof Kozlowski , Sam Ravnborg , Jernej Skrabec , Tzung-Bi Shih , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Thomas Zimmermann , =?UTF-8?B?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Jonas Karlman , swboyd@chromium.org, Pin-Yen Lin , Rob Herring , Maxime Ripard , Hsin-Yi Wang , Xin Ji , Greg Kroah-Hartman , Robert Foss , =?UTF-8?B?Sm9zw6kgRXhww7NzaXRv?= Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 14, 2022 at 1:22 AM AngeloGioacchino Del Regno wrote: > > Il 09/06/22 20:09, Prashant Malani ha scritto: > > Parse the "switches" node, if available, and count and store the number > > of Type-C switches within it. Since we currently don't do anything with > > this info, no functional changes are expected from this change. > > > > This patch sets a foundation for the actual registering of Type-C > > switches with the Type-C connector class framework. > > > > Signed-off-by: Prashant Malani > > --- > > > > Changes since v1: > > - No changes. > > > > drivers/gpu/drm/bridge/analogix/anx7625.c | 20 ++++++++++++++++++++ > > drivers/gpu/drm/bridge/analogix/anx7625.h | 1 + > > 2 files changed, 21 insertions(+) > > > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c > > index 53a5da6c49dd..07ed44c6b839 100644 > > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c > > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c > > @@ -2581,6 +2581,22 @@ static void anx7625_runtime_disable(void *data) > > pm_runtime_disable(data); > > } > > > > +static int anx7625_register_typec_switches(struct device *device, struct anx7625_data *ctx) > > +{ > > + struct device_node *of = NULL; > > + int ret = 0; > > + > > + of = of_get_child_by_name(device->of_node, "switches"); > > + if (!of) > > + return -ENODEV; > > + > > + ctx->num_typec_switches = of_get_child_count(of); > > + if (ctx->num_typec_switches <= 0) > > + return -ENODEV; > > + > > + return ret; > > You aren't using the `ret` variable for anything other than returning zero: > remove it and simply return 0 here. The very next patch does use it, but sure I'll remove it from here and introduce it in v6. > > > +} > > + > > static int anx7625_i2c_probe(struct i2c_client *client, > > const struct i2c_device_id *id) > > { > > @@ -2686,6 +2702,10 @@ static int anx7625_i2c_probe(struct i2c_client *client, > > if (platform->pdata.intp_irq) > > queue_work(platform->workqueue, &platform->work); > > > > + ret = anx7625_register_typec_switches(dev, platform); > > + if (ret) > > + dev_info(dev, "Didn't register Type C switches, err: %d\n", ret); > > Type-C switches are optional for this driver and this will print a sort of error > on boards that are *not* declaring any switches on purpose (because perhaps they > don't have any, or for any other reason). > > Even though this is a dev_info and not a dev_err, it's still printing an alarming > (and useless, in the aforementioned case) message. I'll go ahead and convert this to dev_warn, but only trigger if there is an error other than ENODEV. > > Please fix this. > > Regards, > Angelo > 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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3AC36C433EF for ; Tue, 14 Jun 2022 18:13:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E22410F18F; Tue, 14 Jun 2022 18:13:58 +0000 (UTC) Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5844C10F154 for ; Tue, 14 Jun 2022 18:13:57 +0000 (UTC) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-3137c877092so37851477b3.13 for ; Tue, 14 Jun 2022 11:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZsjTA9iJIzTxX4ygR8FdKM9wnHJIUgreAx1BZ2osk+k=; b=elkEMMAy3wPQwGf1ROmnn/4Isu60xOrk5kwhUf9POtxNbXra9m+VOIyaYdDcP+3CU3 2JT5ARrP4xwLtPX0Ds74mSJUDU0WpEwRhBDquEnA4hNv+/G/6Q6UFzYcWShmefjq8AjX gz+FlbByjs1p+vyfBLAp58Tc0jFjVzOn1TINg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZsjTA9iJIzTxX4ygR8FdKM9wnHJIUgreAx1BZ2osk+k=; b=34x5TbhxezShaci2y+kc+Bq3/KxusEimoXBEt7dE0Tk4/RYKeg7IBHuOrz2HAMJYV9 h0rZbvp/NMASA08uDg5PQrVeXykWC4VMKAjCs5v4pXe1Xnpd3P3G3UyS7R2iuN8rxqRa 4kGi+US6fwI50HcVFS98qbt8SUVJppEF0jkB4zxyOtOI6YdXIoIGjUz9XdzpsybFE4GJ cpSj2gF9w/Ry+F06EIGR6OWzC2xMJ+qYC7r7o078SFBehSlE0x/WJwLdqjTrxE14z3W0 Ta9gxDUPlsTSgX1Jmldlk22jkwpmEicLFZtHX5H4JyIXXdyzhlPyHrEWAAVHiMGOj49h aerg== X-Gm-Message-State: AJIora/eRM/tpiq5ArAqxcmkqi/vV1RvM5qaw43cMCfMd4BZ0n0ObjCr S3NqXNz1JmyLC9IZtAMFlzhpIrKvueCFWFIvtWgmyg== X-Google-Smtp-Source: AGRyM1uE67Atomlar3nLQdgT+jy4zLDSFTPt4ERa1X/kLBHMBihOauBraRP729dfHSV8ag/nSgM1IEdsAe/aMtNwTF8= X-Received: by 2002:a81:fd1:0:b0:30f:f98b:4957 with SMTP id 200-20020a810fd1000000b0030ff98b4957mr7329858ywp.350.1655230436484; Tue, 14 Jun 2022 11:13:56 -0700 (PDT) MIME-Version: 1.0 References: <20220609181106.3695103-1-pmalani@chromium.org> <20220609181106.3695103-6-pmalani@chromium.org> In-Reply-To: From: Prashant Malani Date: Tue, 14 Jun 2022 11:13:45 -0700 Message-ID: Subject: Re: [PATCH v2 5/7] drm/bridge: anx7625: Register number of Type C switches To: AngeloGioacchino Del Regno Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heikki.krogerus@linux.intel.com, Andrzej Hajda , Neil Armstrong , David Airlie , "open list:DRM DRIVERS" , Laurent Pinchart , Krzysztof Kozlowski , Sam Ravnborg , Jernej Skrabec , Tzung-Bi Shih , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , =?UTF-8?B?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Jonas Karlman , swboyd@chromium.org, Pin-Yen Lin , Rob Herring , Maxime Ripard , Hsin-Yi Wang , Xin Ji , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Foss , Thomas Zimmermann , =?UTF-8?B?Sm9zw6kgRXhww7NzaXRv?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Jun 14, 2022 at 1:22 AM AngeloGioacchino Del Regno wrote: > > Il 09/06/22 20:09, Prashant Malani ha scritto: > > Parse the "switches" node, if available, and count and store the number > > of Type-C switches within it. Since we currently don't do anything with > > this info, no functional changes are expected from this change. > > > > This patch sets a foundation for the actual registering of Type-C > > switches with the Type-C connector class framework. > > > > Signed-off-by: Prashant Malani > > --- > > > > Changes since v1: > > - No changes. > > > > drivers/gpu/drm/bridge/analogix/anx7625.c | 20 ++++++++++++++++++++ > > drivers/gpu/drm/bridge/analogix/anx7625.h | 1 + > > 2 files changed, 21 insertions(+) > > > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c > > index 53a5da6c49dd..07ed44c6b839 100644 > > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c > > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c > > @@ -2581,6 +2581,22 @@ static void anx7625_runtime_disable(void *data) > > pm_runtime_disable(data); > > } > > > > +static int anx7625_register_typec_switches(struct device *device, struct anx7625_data *ctx) > > +{ > > + struct device_node *of = NULL; > > + int ret = 0; > > + > > + of = of_get_child_by_name(device->of_node, "switches"); > > + if (!of) > > + return -ENODEV; > > + > > + ctx->num_typec_switches = of_get_child_count(of); > > + if (ctx->num_typec_switches <= 0) > > + return -ENODEV; > > + > > + return ret; > > You aren't using the `ret` variable for anything other than returning zero: > remove it and simply return 0 here. The very next patch does use it, but sure I'll remove it from here and introduce it in v6. > > > +} > > + > > static int anx7625_i2c_probe(struct i2c_client *client, > > const struct i2c_device_id *id) > > { > > @@ -2686,6 +2702,10 @@ static int anx7625_i2c_probe(struct i2c_client *client, > > if (platform->pdata.intp_irq) > > queue_work(platform->workqueue, &platform->work); > > > > + ret = anx7625_register_typec_switches(dev, platform); > > + if (ret) > > + dev_info(dev, "Didn't register Type C switches, err: %d\n", ret); > > Type-C switches are optional for this driver and this will print a sort of error > on boards that are *not* declaring any switches on purpose (because perhaps they > don't have any, or for any other reason). > > Even though this is a dev_info and not a dev_err, it's still printing an alarming > (and useless, in the aforementioned case) message. I'll go ahead and convert this to dev_warn, but only trigger if there is an error other than ENODEV. > > Please fix this. > > Regards, > Angelo >