]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/sun4i: sun8i-hdmi-phy: Use of_device_get_match_data
authorSamuel Holland <samuel@sholland.org>
Wed, 15 Jun 2022 04:55:38 +0000 (23:55 -0500)
committerMaxime Ripard <maxime@cerno.tech>
Thu, 16 Jun 2022 07:27:46 +0000 (09:27 +0200)
Now that the HDMI PHY is using a platform driver, we can use the usual
helper function for getting the variant structure.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220615045543.62813-2-samuel@sholland.org
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c

index bffe1b9cd3dcb435f019d25668cd3e9c02beaf2c..0adbfac6eb314c9b974f42b2619a4828c92de3d3 100644 (file)
@@ -173,7 +173,7 @@ struct sun8i_hdmi_phy {
        unsigned int                    rcal;
        struct regmap                   *regs;
        struct reset_control            *rst_phy;
-       struct sun8i_hdmi_phy_variant   *variant;
+       const struct sun8i_hdmi_phy_variant *variant;
 };
 
 struct sun8i_dw_hdmi_quirks {
index 2860e6bff8b77594c9f3d0f15fe90dc96455f3a1..4553e04144fe54a0a0773bf91a778f4f3e7e508d 100644 (file)
@@ -565,7 +565,7 @@ void sun8i_hdmi_phy_deinit(struct sun8i_hdmi_phy *phy)
 void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy,
                            struct dw_hdmi_plat_data *plat_data)
 {
-       struct sun8i_hdmi_phy_variant *variant = phy->variant;
+       const struct sun8i_hdmi_phy_variant *variant = phy->variant;
 
        if (variant->is_custom_phy) {
                plat_data->phy_ops = &sun8i_hdmi_phy_ops;
@@ -672,7 +672,6 @@ int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
 
 static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
 {
-       const struct of_device_id *match;
        struct device *dev = &pdev->dev;
        struct device_node *node = dev->of_node;
        struct sun8i_hdmi_phy *phy;
@@ -680,17 +679,11 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
        void __iomem *regs;
        int ret;
 
-       match = of_match_node(sun8i_hdmi_phy_of_table, node);
-       if (!match) {
-               dev_err(dev, "Incompatible HDMI PHY\n");
-               return -EINVAL;
-       }
-
        phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
        if (!phy)
                return -ENOMEM;
 
-       phy->variant = (struct sun8i_hdmi_phy_variant *)match->data;
+       phy->variant = of_device_get_match_data(dev);
        phy->dev = dev;
 
        ret = of_address_to_resource(node, 0, &res);