drm/msm/hdmi: remove useless kref

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>
This commit is contained in:
Rob Clark 2014-11-18 08:40:44 -05:00
parent 3f307963fc
commit d1a717bd27
4 changed files with 13 additions and 32 deletions

View File

@ -55,9 +55,8 @@ static irqreturn_t hdmi_irq(int irq, void *dev_id)
return IRQ_HANDLED; 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; struct hdmi_phy *phy = hdmi->phy;
if (phy) if (phy)
@ -85,8 +84,6 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
goto fail; goto fail;
} }
kref_init(&hdmi->refcount);
hdmi->pdev = pdev; hdmi->pdev = pdev;
hdmi->config = config; hdmi->config = config;
@ -183,7 +180,7 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
fail: fail:
if (hdmi) if (hdmi)
hdmi_destroy(&hdmi->refcount); hdmi_destroy(hdmi);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
@ -269,12 +266,6 @@ fail:
#include <linux/of_gpio.h> #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 #ifdef CONFIG_OF
static int get_gpio(struct device *dev, struct device_node *of_node, const char *name) 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) 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 = {}; static struct hdmi_platform_config config = {};
struct hdmi *hdmi; struct hdmi *hdmi;
#ifdef CONFIG_OF #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)); hdmi = hdmi_init(to_platform_device(dev));
if (IS_ERR(hdmi)) if (IS_ERR(hdmi))
return PTR_ERR(hdmi); return PTR_ERR(hdmi);
set_hdmi(dev_get_drvdata(master), hdmi); priv->hdmi = hdmi;
return 0; return 0;
} }
static void hdmi_unbind(struct device *dev, struct device *master, static void hdmi_unbind(struct device *dev, struct device *master,
void *data) 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 = { static const struct component_ops hdmi_ops = {

View File

@ -38,8 +38,6 @@ struct hdmi_audio {
}; };
struct hdmi { struct hdmi {
struct kref refcount;
struct drm_device *dev; struct drm_device *dev;
struct platform_device *pdev; struct platform_device *pdev;
@ -100,7 +98,6 @@ struct hdmi_platform_config {
}; };
void hdmi_set_mode(struct hdmi *hdmi, bool power_on); 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) 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); 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, * 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 * so split the phy related functions out and load the correct one at

View File

@ -26,7 +26,6 @@ struct hdmi_bridge {
static void hdmi_bridge_destroy(struct drm_bridge *bridge) static void hdmi_bridge_destroy(struct drm_bridge *bridge)
{ {
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
hdmi_unreference(hdmi_bridge->hdmi);
drm_bridge_cleanup(bridge); drm_bridge_cleanup(bridge);
kfree(hdmi_bridge); kfree(hdmi_bridge);
} }
@ -218,7 +217,7 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
goto fail; goto fail;
} }
hdmi_bridge->hdmi = hdmi_reference(hdmi); hdmi_bridge->hdmi = hdmi;
bridge = &hdmi_bridge->base; bridge = &hdmi_bridge->base;

View File

@ -330,8 +330,6 @@ static void hdmi_connector_destroy(struct drm_connector *connector)
drm_connector_unregister(connector); drm_connector_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
hdmi_unreference(hdmi_connector->hdmi);
kfree(hdmi_connector); kfree(hdmi_connector);
} }
@ -425,7 +423,7 @@ struct drm_connector *hdmi_connector_init(struct hdmi *hdmi)
goto fail; goto fail;
} }
hdmi_connector->hdmi = hdmi_reference(hdmi); hdmi_connector->hdmi = hdmi;
INIT_WORK(&hdmi_connector->hpd_work, hotplug_work); INIT_WORK(&hdmi_connector->hpd_work, hotplug_work);
connector = &hdmi_connector->base; connector = &hdmi_connector->base;