From patchwork Thu Jul 25 19:24:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tuomas Tynkkynen X-Patchwork-Id: 261875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DDB9C2C0169 for ; Fri, 26 Jul 2013 05:24:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758049Ab3GYTY0 (ORCPT ); Thu, 25 Jul 2013 15:24:26 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:9564 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756762Ab3GYTYZ (ORCPT ); Thu, 25 Jul 2013 15:24:25 -0400 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Thu, 25 Jul 2013 12:24:14 -0700 Received: from hqemhub03.nvidia.com ([172.20.12.94]) by hqnvupgp07.nvidia.com (PGP Universal service); Thu, 25 Jul 2013 12:24:24 -0700 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Thu, 25 Jul 2013 12:24:24 -0700 Received: from ttynkkynen-lnx.Nvidia.com (172.20.144.16) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server (TLS) id 8.3.298.1; Thu, 25 Jul 2013 12:24:23 -0700 From: Tuomas Tynkkynen To: CC: , , , , , Tuomas Tynkkynen Subject: [PATCH] usb: phy: tegra: Use switch instead of if-else Date: Thu, 25 Jul 2013 22:24:09 +0300 Message-ID: <1374780249-22207-1-git-send-email-ttynkkynen@nvidia.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <20130725191734.GB26858@radagast> References: <20130725191734.GB26858@radagast> X-NVConfidentiality: public MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Use switch() instead of if-else when checking for the PHY type. Signed-off-by: Tuomas Tynkkynen --- Ah :). Here. drivers/usb/phy/phy-tegra-usb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c index 01c30ff..49fa2da 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c @@ -887,11 +887,14 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) of_property_read_bool(np, "nvidia,has-legacy-mode"); phy_type = of_usb_get_phy_mode(np); - if (phy_type == USBPHY_INTERFACE_MODE_UTMI) { + switch (phy_type) { + case USBPHY_INTERFACE_MODE_UTMI: err = utmi_phy_probe(tegra_phy, pdev); if (err < 0) return err; - } else if (phy_type == USBPHY_INTERFACE_MODE_ULPI) { + break; + + case USBPHY_INTERFACE_MODE_ULPI: tegra_phy->is_ulpi_phy = true; tegra_phy->reset_gpio = @@ -902,7 +905,9 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) return tegra_phy->reset_gpio; } tegra_phy->config = NULL; - } else { + break; + + default: dev_err(&pdev->dev, "phy_type is invalid or unsupported\n"); return -EINVAL; }