From patchwork Tue Aug 30 22:58:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12960057 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15F6D6136 for ; Tue, 30 Aug 2022 22:58:35 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id p18so12498980plr.8 for ; Tue, 30 Aug 2022 15:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=k6LA1rNyhTjjcasNmZFLeY+W8E8y8NGMThT486iHSoY=; b=Ep24sHO070cnIFiiLG6kNJPWDqR2eSE+4qF+qy1Dpph5f6mj79zWGMf3QxdFk/MnWf S5NN4Jf7V/9x14Ed4VoZUnHArb2dtaW8KqL3LDsl17cTZoAmeNNJHhe90BGX5qkR34Gd UEfG8SF4TaeCxXk2M0BoSMAIfW2qddG9ZcM7Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=k6LA1rNyhTjjcasNmZFLeY+W8E8y8NGMThT486iHSoY=; b=5taN8SItORziTHvh4fr9QrTl5Jc8EtdDUEhtQKF094ytY6y/BxYu5KsuZqV/MPAD+X cu/EWmbGipX55Z4apPgqKOLRLVKoxF6jlW3RdFMxVKr0eLGaJrtDqO4PO3qZS5tO+AQt kha3vIgn5Ac8m2o+pwQs9SlKjMIwkGS5TJ4m5k+ywZg3srVexAVGx1tear6RxLw+gmCr khXXBsuk5/KnK8uvPdjrVFDrxvxYoj/6vTlagXaCI8lTra8KBwG851/U5MnANVaTG+FJ mY0tWd98jffSvyGpgAsP3Jq2Lyc4z5UbqeglwZr1lPbRWHVV1WhGE6qYGD/xGzrXLFjd U3jA== X-Gm-Message-State: ACgBeo1ubWqTrJR7OAi6S/xMyohhhFCb0LafXwrvcESUUV04cy8BqQWG JlIhefCCe1TqhZxK92znldbU1B3Z1RcJ1Q== X-Google-Smtp-Source: AA6agR6soIRzWhUs7dOLjwua1oVBUDAFDTUzVhZQra4bxTiH3oROVieLZEHDWGIr1KvJ5tedIvAXHw== X-Received: by 2002:a17:90a:f2cb:b0:1fd:90a0:56e3 with SMTP id gt11-20020a17090af2cb00b001fd90a056e3mr269959pjb.113.1661900314469; Tue, 30 Aug 2022 15:58:34 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:5f34:2f6:2856:188e]) by smtp.gmail.com with ESMTPSA id bf3-20020a170902b90300b001743be790b4sm10083539plb.215.2022.08.30.15.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 15:58:34 -0700 (PDT) From: Stephen Boyd To: Prashant Malani , Benson Leung Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, chrome-platform@lists.linux.dev, Tzung-Bi Shih Subject: [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk Date: Tue, 30 Aug 2022 15:58:28 -0700 Message-Id: <20220830225831.2362403-2-swboyd@chromium.org> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220830225831.2362403-1-swboyd@chromium.org> References: <20220830225831.2362403-1-swboyd@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We need a newline here to ensure the next printk starts fresh. Cc: Prashant Malani Cc: Tzung-Bi Shih Fixes: affc804c44c8 ("platform/chrome: cros_typec_switch: Add switch driver") Signed-off-by: Stephen Boyd Acked-by: Prashant Malani --- drivers/platform/chrome/cros_typec_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index f85687adb594..383daf2c66b7 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -244,7 +244,7 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) } if (index < 0 || index >= EC_USB_PD_MAX_PORTS) { - dev_err(fwnode->dev, "Invalid port index number: %llu", index); + dev_err(fwnode->dev, "Invalid port index number: %llu\n", index); ret = -EINVAL; goto err_switch; } From patchwork Tue Aug 30 22:58:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12960058 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E06AA6138 for ; Tue, 30 Aug 2022 22:58:35 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id h11-20020a17090a470b00b001fbc5ba5224so13309496pjg.2 for ; Tue, 30 Aug 2022 15:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=HwGs98rx5BCd9/rgNaN7+8SbaVUbF2hiZY4CVcaNvm4=; b=eB3MC0Tad/kB+uoOqsolA2dlwF8ySo8h9JTtZjitG+Gquo+Dyd6U0wXrnhlI9wf5fq JlVczQudCM5itV8dzFwRom6m3cIaoIo5oy2Ux5geWqHMWOZtyA6kqkxgfBqQeedxrt6u bi0PcJIDVpLWQgfcc1QRNrVY0jqV+m7v4XbbU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=HwGs98rx5BCd9/rgNaN7+8SbaVUbF2hiZY4CVcaNvm4=; b=ScTiAyFTkObV4tusXmCkb+Rs0/q607GjQY5QEFOrCFxOSR5Foz8CpYqysIdytGls2g 2tVD3+GLgEDkGlA2v/7o4c9kWc0LlpTEtxuOOt7qRXHACr1fKs4cRYD0Cdstfyp3/N65 yyRqYsIrkSP+eK+5MbQCUIiuatzL5A7o6JKwzQRwyPSmd8CzcPRFknuTh9GlEaxUGzgw DQQ81fVpg2JxAibGkljbk4z3jVmVKFnZ/B/9y9ZD+mLCTastCw+dsfykdOQtIbNMP770 wZGT/2jCM2iJclwmGZjkjFWWnebrEI3FvyXk3Raaw87pd/e2hf5eTDttYloHTvGvFL41 vOzw== X-Gm-Message-State: ACgBeo2fC3nhnFZX/WXaZ8EHknjI3fi2TSywOcMXGoH3pCUgJiZqfe5X 8rCxRg+0YjxL30/jX2jCZ3ULtQ== X-Google-Smtp-Source: AA6agR45HAcVMAFaGvKD+VuQ2Xa/q4B6SQ6eo25+pm9MGhFjmFQmLdcpsmWTCIr9hw1VRWyt+jKH8Q== X-Received: by 2002:a17:90b:4b48:b0:1fd:d2cd:896c with SMTP id mi8-20020a17090b4b4800b001fdd2cd896cmr296743pjb.120.1661900315349; Tue, 30 Aug 2022 15:58:35 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:5f34:2f6:2856:188e]) by smtp.gmail.com with ESMTPSA id bf3-20020a170902b90300b001743be790b4sm10083539plb.215.2022.08.30.15.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 15:58:35 -0700 (PDT) From: Stephen Boyd To: Prashant Malani , Benson Leung Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, chrome-platform@lists.linux.dev, Tzung-Bi Shih Subject: [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition Date: Tue, 30 Aug 2022 15:58:29 -0700 Message-Id: <20220830225831.2362403-3-swboyd@chromium.org> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220830225831.2362403-1-swboyd@chromium.org> References: <20220830225831.2362403-1-swboyd@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The type of 'index' is unsigned long long, which can't possibly be less than zero. Remove the impossible check. Cc: Prashant Malani Cc: Tzung-Bi Shih Signed-off-by: Stephen Boyd Acked-by: Prashant Malani --- drivers/platform/chrome/cros_typec_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 383daf2c66b7..3381d842c307 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -243,7 +243,7 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) goto err_switch; } - if (index < 0 || index >= EC_USB_PD_MAX_PORTS) { + if (index >= EC_USB_PD_MAX_PORTS) { dev_err(fwnode->dev, "Invalid port index number: %llu\n", index); ret = -EINVAL; goto err_switch; From patchwork Tue Aug 30 22:58:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12960059 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC7DE6137 for ; Tue, 30 Aug 2022 22:58:36 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id v5so6296026plo.9 for ; Tue, 30 Aug 2022 15:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=WK5uBdkvj+rzMOTx0eBPWRcJ3NkDpCrdfS9GYKxjc4Q=; b=K/Dv61fWG2RK5uP019ajuvWGOsaYy/JwPd+i+ycqaCclO2jktpeGBCOdGEJwue7Svf LFuue3Jw2/IhLPZzIDc+oSEoPyjT7Vv75KikMIlx3sZGkKcI1jfYCdnz+tXgxvZaTRUz mdDnW/OVw+tIn2VPx14agQ4ltazeNCRbuECis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=WK5uBdkvj+rzMOTx0eBPWRcJ3NkDpCrdfS9GYKxjc4Q=; b=Ncf9OeMLLGkcMmELV8NtmsWbY6BJGPMHDy8XxgMUJUWnOIygx9tWY1Sxi0viCmJLy1 aXreMe7dO7AIfL1Ip9j8+AIDdGsZkf3kJPaG5cJaWBGLQavzlGjS6AZ2P5QZJglEelMW gBuk5j0No/gY9gUFGHp+xsjbBy6YDQSKv7CyHewiU5FpRd6aJsiZL6HNjXG81J+Gn7Pk gaFguIpKEr4DNwDzbEqK6UyFVEUQnHX6nGllUCGakZiJmVSPQbN/q1KWM+lj13yrxv90 /fmTSvZJOWrNGBRn0tfb3BqKuhJ+mYpUfdvKbO23rLQIIsGKhwTuOiK6VqMEHiefpkDO tvUg== X-Gm-Message-State: ACgBeo2xuTWAqabqvFETOZILfWltxYi0POhFObctUBTnOCzNoDf4k0zv 3d1V9/jtWgWKXUaR3WkeucppMw== X-Google-Smtp-Source: AA6agR5BwgwGGR8CVgQETFRT37ajSM4Zq99RJV+txl3EQeraAhpPRS7nmypBzKJjaJBmUzqCHE10CA== X-Received: by 2002:a17:902:8f87:b0:172:83b5:d771 with SMTP id z7-20020a1709028f8700b0017283b5d771mr23053534plo.159.1661900316268; Tue, 30 Aug 2022 15:58:36 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:5f34:2f6:2856:188e]) by smtp.gmail.com with ESMTPSA id bf3-20020a170902b90300b001743be790b4sm10083539plb.215.2022.08.30.15.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 15:58:35 -0700 (PDT) From: Stephen Boyd To: Prashant Malani , Benson Leung Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, chrome-platform@lists.linux.dev, Tzung-Bi Shih Subject: [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify Date: Tue, 30 Aug 2022 15:58:30 -0700 Message-Id: <20220830225831.2362403-4-swboyd@chromium.org> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220830225831.2362403-1-swboyd@chromium.org> References: <20220830225831.2362403-1-swboyd@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the standard error pointer macro to shorten the code and simplify. Cc: Prashant Malani Cc: Tzung-Bi Shih Signed-off-by: Stephen Boyd Acked-by: Prashant Malani --- drivers/platform/chrome/cros_typec_switch.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 3381d842c307..09ad0d268f4b 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -185,10 +185,8 @@ static int cros_typec_register_mode_switch(struct cros_typec_port *port, }; port->mode_switch = typec_mux_register(port->sdata->dev, &mode_switch_desc); - if (IS_ERR(port->mode_switch)) - return PTR_ERR(port->mode_switch); - return 0; + return PTR_ERR_OR_ZERO(port->mode_switch); } static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwnode_handle *fwnode) @@ -201,10 +199,8 @@ static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwno }; port->retimer = typec_retimer_register(port->sdata->dev, &retimer_desc); - if (IS_ERR(port->retimer)) - return PTR_ERR(port->retimer); - return 0; + return PTR_ERR_OR_ZERO(port->retimer); } static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) From patchwork Tue Aug 30 22:58:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12960060 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2AE66138 for ; Tue, 30 Aug 2022 22:58:37 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id x23so12511205pll.7 for ; Tue, 30 Aug 2022 15:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=9i6pUjJNJbv0URDTN17d2CcuUvvkFRJoPPsB0ChrC84=; b=K2J5xRAk/tKVnjvdGCtwzZC/znuGdEUztUB2UHn4wXft/46xq8gyf0Ddl57gL2NETG M0vOBzYECWvKK4hidx1uBJNXH2NsR9pGU3zcm1+sXOa9rrbJrvaKTah1s9gjtU1As/XQ +GhjBJOLmxYXJbLlpGP3ExvkBiOw6dPva01r4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=9i6pUjJNJbv0URDTN17d2CcuUvvkFRJoPPsB0ChrC84=; b=B6b3LFZuLy3kshMt6D08XlFxW8R1gyKmXeTYqyEdmKanDUFzPIjj7CKqMZo66RFPRG UEMi3KTuI6ECbMOyZakRWfxR+x1Cl1K7U/G1KetaC2RUpWZ9A7Hyg9DX3C9fm+TL8AY4 6j6RWiQ+qsZFo4D7Q1M7Z6dUmu0MCTzSxryLQX/STwEG+vBU/M9+EngHEgw5VjmFCffF acEQPgVsMe64q1jh+khtQ3ztBWPPyCBS9gVtnZ9uaDgPCJGWtmAP39pqcsSwzUXTE8OI ZLo+ATHjWw/nNjLrbIMHRLx1duyvOW9X4jHw/jBlg/wxgFcEvfeurLoEVhXnbeyzhf2e PcXw== X-Gm-Message-State: ACgBeo1Edvb10nPnnjyqvRBdHGe1O5s8pq3bBKIUBslh0nvgOIgB4EFn AyZAh4PWkRxQkgWPo3IP+DkRRw== X-Google-Smtp-Source: AA6agR6wm6nWs+6nAf9TZDvola8E8ygfG4X7jJS1hsOIaTMHd8b0kiBAbmAJLdFsGBuzT3sT26/VrA== X-Received: by 2002:a17:90b:4d8f:b0:1fc:314a:17e7 with SMTP id oj15-20020a17090b4d8f00b001fc314a17e7mr284377pjb.194.1661900317130; Tue, 30 Aug 2022 15:58:37 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:5f34:2f6:2856:188e]) by smtp.gmail.com with ESMTPSA id bf3-20020a170902b90300b001743be790b4sm10083539plb.215.2022.08.30.15.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 15:58:36 -0700 (PDT) From: Stephen Boyd To: Prashant Malani , Benson Leung Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, chrome-platform@lists.linux.dev, Tzung-Bi Shih Subject: [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME Date: Tue, 30 Aug 2022 15:58:31 -0700 Message-Id: <20220830225831.2362403-5-swboyd@chromium.org> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220830225831.2362403-1-swboyd@chromium.org> References: <20220830225831.2362403-1-swboyd@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This macro is only used one place, let's inline it instead to save a line or two. Cc: Prashant Malani Cc: Tzung-Bi Shih Signed-off-by: Stephen Boyd Acked-by: Prashant Malani --- drivers/platform/chrome/cros_typec_switch.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 09ad0d268f4b..a26219e97c93 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -18,8 +18,6 @@ #include #include -#define DRV_NAME "cros-typec-switch" - /* Handles and other relevant data required for each port's switches. */ struct cros_typec_port { int port_num; @@ -309,7 +307,7 @@ MODULE_DEVICE_TABLE(acpi, cros_typec_switch_acpi_id); static struct platform_driver cros_typec_switch_driver = { .driver = { - .name = DRV_NAME, + .name = "cros-typec-switch", .acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id), }, .probe = cros_typec_switch_probe,