]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/msm/hdmi: remove useless kref
authorRob Clark <robdclark@gmail.com>
Tue, 18 Nov 2014 13:40:44 +0000 (08:40 -0500)
committerRob Clark <robdclark@gmail.com>
Fri, 21 Nov 2014 13:56:19 +0000 (08:56 -0500)
A left-over from prior to component framework.  The original intent was
to deal with hdmi getting unloaded before the master component, but that
isn't really going to work anyways.  These days with the component
framework taking care to unload the master component first, we don't
have to worry about this.

Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/hdmi/hdmi.c
drivers/gpu/drm/msm/hdmi/hdmi.h
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
drivers/gpu/drm/msm/hdmi/hdmi_connector.c

index db8c3b45bc24022cb20ad9a06daafb137e654c26..062c687253766278e69fe46429cc927c3223cada 100644 (file)
@@ -55,9 +55,8 @@ static irqreturn_t hdmi_irq(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-void hdmi_destroy(struct kref *kref)
+static void hdmi_destroy(struct hdmi *hdmi)
 {
-       struct hdmi *hdmi = container_of(kref, struct hdmi, refcount);
        struct hdmi_phy *phy = hdmi->phy;
 
        if (phy)
@@ -85,8 +84,6 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
                goto fail;
        }
 
-       kref_init(&hdmi->refcount);
-
        hdmi->pdev = pdev;
        hdmi->config = config;
 
@@ -183,7 +180,7 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
 
 fail:
        if (hdmi)
-               hdmi_destroy(&hdmi->refcount);
+               hdmi_destroy(hdmi);
 
        return ERR_PTR(ret);
 }
@@ -269,12 +266,6 @@ fail:
 
 #include <linux/of_gpio.h>
 
-static void set_hdmi(struct drm_device *dev, struct hdmi *hdmi)
-{
-       struct msm_drm_private *priv = dev->dev_private;
-       priv->hdmi = hdmi;
-}
-
 #ifdef CONFIG_OF
 static int get_gpio(struct device *dev, struct device_node *of_node, const char *name)
 {
@@ -295,6 +286,8 @@ static int get_gpio(struct device *dev, struct device_node *of_node, const char
 
 static int hdmi_bind(struct device *dev, struct device *master, void *data)
 {
+       struct drm_device *drm = dev_get_drvdata(master);
+       struct msm_drm_private *priv = drm->dev_private;
        static struct hdmi_platform_config config = {};
        struct hdmi *hdmi;
 #ifdef CONFIG_OF
@@ -389,14 +382,19 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
        hdmi = hdmi_init(to_platform_device(dev));
        if (IS_ERR(hdmi))
                return PTR_ERR(hdmi);
-       set_hdmi(dev_get_drvdata(master), hdmi);
+       priv->hdmi = hdmi;
        return 0;
 }
 
 static void hdmi_unbind(struct device *dev, struct device *master,
                void *data)
 {
-       set_hdmi(dev_get_drvdata(master), NULL);
+       struct drm_device *drm = dev_get_drvdata(master);
+       struct msm_drm_private *priv = drm->dev_private;
+       if (priv->hdmi) {
+               hdmi_destroy(priv->hdmi);
+               priv->hdmi = NULL;
+       }
 }
 
 static const struct component_ops hdmi_ops = {
index 0a6f538f012c0ae0956aef2d30857c6e74d15e3c..43e654f751b741a06578989b121d225139a3664a 100644 (file)
@@ -38,8 +38,6 @@ struct hdmi_audio {
 };
 
 struct hdmi {
-       struct kref refcount;
-
        struct drm_device *dev;
        struct platform_device *pdev;
 
@@ -100,7 +98,6 @@ struct hdmi_platform_config {
 };
 
 void hdmi_set_mode(struct hdmi *hdmi, bool power_on);
-void hdmi_destroy(struct kref *kref);
 
 static inline void hdmi_write(struct hdmi *hdmi, u32 reg, u32 data)
 {
@@ -112,17 +109,6 @@ static inline u32 hdmi_read(struct hdmi *hdmi, u32 reg)
        return msm_readl(hdmi->mmio + reg);
 }
 
-static inline struct hdmi * hdmi_reference(struct hdmi *hdmi)
-{
-       kref_get(&hdmi->refcount);
-       return hdmi;
-}
-
-static inline void hdmi_unreference(struct hdmi *hdmi)
-{
-       kref_put(&hdmi->refcount, hdmi_destroy);
-}
-
 /*
  * The phy appears to be different, for example between 8960 and 8x60,
  * so split the phy related functions out and load the correct one at
index f6cf745c249e60a604e8ab00f99ca75cb3af2b43..6902ad6da710fe2d4f7fb7e9f56c3f84ba1c5b49 100644 (file)
@@ -26,7 +26,6 @@ struct hdmi_bridge {
 static void hdmi_bridge_destroy(struct drm_bridge *bridge)
 {
        struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
-       hdmi_unreference(hdmi_bridge->hdmi);
        drm_bridge_cleanup(bridge);
        kfree(hdmi_bridge);
 }
@@ -218,7 +217,7 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
                goto fail;
        }
 
-       hdmi_bridge->hdmi = hdmi_reference(hdmi);
+       hdmi_bridge->hdmi = hdmi;
 
        bridge = &hdmi_bridge->base;
 
index 0aecb2580072f26bbde2e5a6ef52dc8e1500beb9..fbebb0405d76d7df217c1772a26cc43e78578b29 100644 (file)
@@ -330,8 +330,6 @@ static void hdmi_connector_destroy(struct drm_connector *connector)
        drm_connector_unregister(connector);
        drm_connector_cleanup(connector);
 
-       hdmi_unreference(hdmi_connector->hdmi);
-
        kfree(hdmi_connector);
 }
 
@@ -425,7 +423,7 @@ struct drm_connector *hdmi_connector_init(struct hdmi *hdmi)
                goto fail;
        }
 
-       hdmi_connector->hdmi = hdmi_reference(hdmi);
+       hdmi_connector->hdmi = hdmi;
        INIT_WORK(&hdmi_connector->hpd_work, hotplug_work);
 
        connector = &hdmi_connector->base;