Skip to content

Commit

Permalink
drm/msm/dp: store dp_display in the driver data
Browse files Browse the repository at this point in the history
Store the dp_display in the platform driver data instead of the
dp_display_private.

This is required to allow other sub-modules to reuse the platform
driver data.

Changes in v3: none
Changes in v4: none
Changes in v5: none
Changes in v6: rebase on top of latest patchset of dependency

Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
  • Loading branch information
Abhinav Kumar authored and Rob Clark committed Sep 15, 2020
1 parent 8ede2ec commit 061eb62
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions drivers/gpu/drm/msm/dp/dp_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ static int dp_display_bind(struct device *dev, struct device *master,
struct dp_display_private *dp;
struct drm_device *drm;
struct msm_drm_private *priv;
struct platform_device *pdev = to_platform_device(dev);

drm = dev_get_drvdata(master);

dp = platform_get_drvdata(pdev);
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
if (!dp) {
DRM_ERROR("DP driver bind failed. Invalid driver data\n");
return -EINVAL;
Expand Down Expand Up @@ -220,11 +220,11 @@ static void dp_display_unbind(struct device *dev, struct device *master,
void *data)
{
struct dp_display_private *dp;
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = dev_get_drvdata(master);
struct msm_drm_private *priv = drm->dev_private;

dp = platform_get_drvdata(pdev);
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
if (!dp) {
DRM_ERROR("Invalid DP driver data\n");
return;
Expand Down Expand Up @@ -359,7 +359,8 @@ static int dp_display_usbpd_configure_cb(struct device *dev)
goto end;
}

dp = dev_get_drvdata(dev);
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
if (!dp) {
DRM_ERROR("no driver data found\n");
rc = -ENODEV;
Expand All @@ -383,7 +384,8 @@ static int dp_display_usbpd_disconnect_cb(struct device *dev)
int rc = 0;
struct dp_display_private *dp;

dp = dev_get_drvdata(dev);
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);

dp_add_event(dp, EV_USER_NOTIFICATION, false, 0);

Expand Down Expand Up @@ -435,7 +437,8 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
return -EINVAL;
}

dp = dev_get_drvdata(dev);
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
if (!dp) {
DRM_ERROR("no driver data found\n");
return -ENODEV;
Expand Down Expand Up @@ -1070,12 +1073,14 @@ static int dp_display_probe(struct platform_device *pdev)
return -EPROBE_DEFER;
}

platform_set_drvdata(pdev, dp);

mutex_init(&dp->event_mutex);

init_completion(&dp->resume_comp);

g_dp_display = &dp->dp_display;

platform_set_drvdata(pdev, g_dp_display);

rc = component_add(&pdev->dev, &dp_display_comp_ops);
if (rc) {
DRM_ERROR("component add failed, rc=%d\n", rc);
Expand All @@ -1089,7 +1094,8 @@ static int dp_display_remove(struct platform_device *pdev)
{
struct dp_display_private *dp;

dp = platform_get_drvdata(pdev);
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);

dp_display_deinit_sub_modules(dp);

Expand Down

0 comments on commit 061eb62

Please sign in to comment.