From patchwork Mon May 22 17:03:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 13250899 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D77F5C7EE26 for ; Mon, 22 May 2023 17:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VoKLv6JvDssQhgDAFgjd2n9vk04iQBXC1UehIIEM4iY=; b=KwN9sNHpQS3881 c+aO6EBj3lvj5yl9TpdbTuLVRzQkeFhxzvM8DBm3odezwQcE5YCWPdElkEWRqTFUsqw0uIFScuBGB k3/ML7ZsXiWpNkFAvqwwkFsipuWfMYnqQiYjJ2t4R9dZZD36KCdG3KmzDe5BMztwa+/6uNMXz0WpD hMnXN/SY4CJMcMv/VzUIwJkfShiHxMxUx3PrRomS4Spd4zcxWD7EifWA64OjQzP9bwKtB+T0CquoB 6yazLeLN7W+4suWx5rsGy9puUetKB7BCB6C7C9TLehnAm9QgT0H00t1rIGp1mY9ymoQ+vw4t8/M1z sQh6ij1t54DOPFk/X6sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q18xI-007Ie7-1c; Mon, 22 May 2023 17:04:20 +0000 Received: from madras.collabora.co.uk ([46.235.227.172]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q18wn-007IJj-30; Mon, 22 May 2023 17:03:51 +0000 Received: from jupiter.universe (dyndsl-091-248-208-162.ewe-ip-backbone.de [91.248.208.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: sre) by madras.collabora.co.uk (Postfix) with ESMTPSA id 12A966606E72; Mon, 22 May 2023 18:03:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1684775025; bh=MWtwyGF7akcYO5s0qhuBRzsJ9ydw4HewyiQSd80e/Q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WaqvdF6ocAzkI463kXIOimiwSO1fUcnLllx8va5AKRDNr9vD6FVlUO2X8Mpbc1sZs ctecFb+keRzRcbLylk/SHTTO1Pejil6HHad66nLkksi2NgRp6Zji3frtgpziqLWFbE FWx0xJ4cJ0Yxhbj3xZtkE+/wFLUqGzgzW3vGf6q5SUNLY00sJDzZul8XmLi9GP9oG7 u+bGhBc9X2ykxMjwGUgDkt2R2WY9gQKT9nJ9Eht1TAy9SIey3lv6ox7hJ6N+CgZWbZ E16rhGV/aO6mUiFy0qcecULKTRZ6UsNYmWg2tgtssWvh5rF+IYvg0mWeV3wFqcF+Sw z4eUy8i/NrJyw== Received: by jupiter.universe (Postfix, from userid 1000) id 81CCD4807F0; Mon, 22 May 2023 19:03:40 +0200 (CEST) From: Sebastian Reichel To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski Cc: Heiko Stuebner , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Sebastian Reichel , kernel@collabora.com Subject: [PATCH v3 6/7] phy: phy-rockchip-inno-usb2: simplify getting match data Date: Mon, 22 May 2023 19:03:23 +0200 Message-Id: <20230522170324.61349-7-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230522170324.61349-1-sebastian.reichel@collabora.com> References: <20230522170324.61349-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230522_100350_105221_AC5DA173 X-CRM114-Status: GOOD ( 13.30 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Simplify the code by directly getting the match data via device_get_match_data() instead of open coding its functionality. Signed-off-by: Sebastian Reichel --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 1cf84869e78b..f5c30f117cba 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1305,7 +1305,6 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) struct phy_provider *provider; struct rockchip_usb2phy *rphy; const struct rockchip_usb2phy_cfg *phy_cfgs; - const struct of_device_id *match; unsigned int reg; int index, ret; @@ -1313,12 +1312,6 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) if (!rphy) return -ENOMEM; - match = of_match_device(dev->driver->of_match_table, dev); - if (!match || !match->data) { - dev_err(dev, "phy configs are not assigned!\n"); - return -EINVAL; - } - if (!dev->parent || !dev->parent->of_node) { rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf"); if (IS_ERR(rphy->grf)) { @@ -1359,12 +1352,15 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) } rphy->dev = dev; - phy_cfgs = match->data; + phy_cfgs = device_get_match_data(dev); rphy->chg_state = USB_CHG_STATE_UNDEFINED; rphy->chg_type = POWER_SUPPLY_TYPE_UNKNOWN; rphy->irq = platform_get_irq_optional(pdev, 0); platform_set_drvdata(pdev, rphy); + if (!phy_cfgs) + return dev_err_probe(dev, -EINVAL, "phy configs are not assigned!\n"); + ret = rockchip_usb2phy_extcon_register(rphy); if (ret) return ret;