diff options
author | Dave Airlie <airlied@redhat.com> | 2013-10-11 00:07:25 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-10-22 04:37:40 -0400 |
commit | 5bdebb183c9702a8c57a01dff09337be3de337a6 (patch) | |
tree | e4ae9a441e4b2c4739902e4914852696accf1682 | |
parent | 14c8d110e083d3a09ccf8cfe18ad22fe1450c2e9 (diff) |
drm/sysfs: sort out minor and connector device object lifetimes.
So drm was abusing device lifetimes, by having embedded device structures
in the minor and connector it meant that the lifetime of the internal drm
objects (drm_minor and drm_connector) were tied to the lifetime of the device
files in sysfs, so if something kept those files opened the current code
would kfree the objects and things would go downhill from there.
Now in reality there is no need for these lifetimes to be so intertwined,
especailly with hotplugging of devices where we wish to remove the sysfs
and userspace facing pieces before we can unwind the internal objects due
to open userspace files or mmaps, so split the objects out so the struct
device is no longer embedded and do what fbdev does and just allocate
and remove the sysfs inodes separately.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_sysfs.c | 94 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/cdv_intel_dp.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_sysfs.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_backlight.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_encoders.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 2 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 2 |
11 files changed, 61 insertions, 87 deletions
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 2290b3b73832..dae42c79154f 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -22,8 +22,8 @@ | |||
22 | #include <drm/drm_core.h> | 22 | #include <drm/drm_core.h> |
23 | #include <drm/drmP.h> | 23 | #include <drm/drmP.h> |
24 | 24 | ||
25 | #define to_drm_minor(d) container_of(d, struct drm_minor, kdev) | 25 | #define to_drm_minor(d) dev_get_drvdata(d) |
26 | #define to_drm_connector(d) container_of(d, struct drm_connector, kdev) | 26 | #define to_drm_connector(d) dev_get_drvdata(d) |
27 | 27 | ||
28 | static struct device_type drm_sysfs_device_minor = { | 28 | static struct device_type drm_sysfs_device_minor = { |
29 | .name = "drm_minor" | 29 | .name = "drm_minor" |
@@ -162,20 +162,6 @@ void drm_sysfs_destroy(void) | |||
162 | drm_class = NULL; | 162 | drm_class = NULL; |
163 | } | 163 | } |
164 | 164 | ||
165 | /** | ||
166 | * drm_sysfs_device_release - do nothing | ||
167 | * @dev: Linux device | ||
168 | * | ||
169 | * Normally, this would free the DRM device associated with @dev, along | ||
170 | * with cleaning up any other stuff. But we do that in the DRM core, so | ||
171 | * this function can just return and hope that the core does its job. | ||
172 | */ | ||
173 | static void drm_sysfs_device_release(struct device *dev) | ||
174 | { | ||
175 | memset(dev, 0, sizeof(struct device)); | ||
176 | return; | ||
177 | } | ||
178 | |||
179 | /* | 165 | /* |
180 | * Connector properties | 166 | * Connector properties |
181 | */ | 167 | */ |
@@ -394,29 +380,26 @@ int drm_sysfs_connector_add(struct drm_connector *connector) | |||
394 | int i; | 380 | int i; |
395 | int ret; | 381 | int ret; |
396 | 382 | ||
397 | /* We shouldn't get called more than once for the same connector */ | 383 | if (connector->kdev) |
398 | BUG_ON(device_is_registered(&connector->kdev)); | 384 | return 0; |
399 | |||
400 | connector->kdev.parent = &dev->primary->kdev; | ||
401 | connector->kdev.class = drm_class; | ||
402 | connector->kdev.release = drm_sysfs_device_release; | ||
403 | 385 | ||
386 | /* We shouldn't get called more than once for the same connector */ | ||
387 | connector->kdev = device_create(drm_class, dev->primary->kdev, | ||
388 | 0, connector, "card%d-%s", | ||
389 | dev->primary->index, drm_get_connector_name(connector)); | ||
404 | DRM_DEBUG("adding \"%s\" to sysfs\n", | 390 | DRM_DEBUG("adding \"%s\" to sysfs\n", |
405 | drm_get_connector_name(connector)); | 391 | drm_get_connector_name(connector)); |
406 | 392 | ||
407 | dev_set_name(&connector->kdev, "card%d-%s", | 393 | if (IS_ERR(connector->kdev)) { |
408 | dev->primary->index, drm_get_connector_name(connector)); | 394 | DRM_ERROR("failed to register connector device: %ld\n", PTR_ERR(connector->kdev)); |
409 | ret = device_register(&connector->kdev); | 395 | ret = PTR_ERR(connector->kdev); |
410 | |||
411 | if (ret) { | ||
412 | DRM_ERROR("failed to register connector device: %d\n", ret); | ||
413 | goto out; | 396 | goto out; |
414 | } | 397 | } |
415 | 398 | ||
416 | /* Standard attributes */ | 399 | /* Standard attributes */ |
417 | 400 | ||
418 | for (attr_cnt = 0; attr_cnt < ARRAY_SIZE(connector_attrs); attr_cnt++) { | 401 | for (attr_cnt = 0; attr_cnt < ARRAY_SIZE(connector_attrs); attr_cnt++) { |
419 | ret = device_create_file(&connector->kdev, &connector_attrs[attr_cnt]); | 402 | ret = device_create_file(connector->kdev, &connector_attrs[attr_cnt]); |
420 | if (ret) | 403 | if (ret) |
421 | goto err_out_files; | 404 | goto err_out_files; |
422 | } | 405 | } |
@@ -433,7 +416,7 @@ int drm_sysfs_connector_add(struct drm_connector *connector) | |||
433 | case DRM_MODE_CONNECTOR_Component: | 416 | case DRM_MODE_CONNECTOR_Component: |
434 | case DRM_MODE_CONNECTOR_TV: | 417 | case DRM_MODE_CONNECTOR_TV: |
435 | for (opt_cnt = 0; opt_cnt < ARRAY_SIZE(connector_attrs_opt1); opt_cnt++) { | 418 | for (opt_cnt = 0; opt_cnt < ARRAY_SIZE(connector_attrs_opt1); opt_cnt++) { |
436 | ret = device_create_file(&connector->kdev, &connector_attrs_opt1[opt_cnt]); | 419 | ret = device_create_file(connector->kdev, &connector_attrs_opt1[opt_cnt]); |
437 | if (ret) | 420 | if (ret) |
438 | goto err_out_files; | 421 | goto err_out_files; |
439 | } | 422 | } |
@@ -442,7 +425,7 @@ int drm_sysfs_connector_add(struct drm_connector *connector) | |||
442 | break; | 425 | break; |
443 | } | 426 | } |
444 | 427 | ||
445 | ret = sysfs_create_bin_file(&connector->kdev.kobj, &edid_attr); | 428 | ret = sysfs_create_bin_file(&connector->kdev->kobj, &edid_attr); |
446 | if (ret) | 429 | if (ret) |
447 | goto err_out_files; | 430 | goto err_out_files; |
448 | 431 | ||
@@ -453,10 +436,11 @@ int drm_sysfs_connector_add(struct drm_connector *connector) | |||
453 | 436 | ||
454 | err_out_files: | 437 | err_out_files: |
455 | for (i = 0; i < opt_cnt; i++) | 438 | for (i = 0; i < opt_cnt; i++) |
456 | device_remove_file(&connector->kdev, &connector_attrs_opt1[i]); | 439 | device_remove_file(connector->kdev, &connector_attrs_opt1[i]); |
457 | for (i = 0; i < attr_cnt; i++) | 440 | for (i = 0; i < attr_cnt; i++) |
458 | device_remove_file(&connector->kdev, &connector_attrs[i]); | 441 | device_remove_file(connector->kdev, &connector_attrs[i]); |
459 | device_unregister(&connector->kdev); | 442 | put_device(connector->kdev); |
443 | device_unregister(connector->kdev); | ||
460 | 444 | ||
461 | out: | 445 | out: |
462 | return ret; | 446 | return ret; |
@@ -480,16 +464,17 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) | |||
480 | { | 464 | { |
481 | int i; | 465 | int i; |
482 | 466 | ||
483 | if (!connector->kdev.parent) | 467 | if (!connector->kdev) |
484 | return; | 468 | return; |
485 | DRM_DEBUG("removing \"%s\" from sysfs\n", | 469 | DRM_DEBUG("removing \"%s\" from sysfs\n", |
486 | drm_get_connector_name(connector)); | 470 | drm_get_connector_name(connector)); |
487 | 471 | ||
488 | for (i = 0; i < ARRAY_SIZE(connector_attrs); i++) | 472 | for (i = 0; i < ARRAY_SIZE(connector_attrs); i++) |
489 | device_remove_file(&connector->kdev, &connector_attrs[i]); | 473 | device_remove_file(connector->kdev, &connector_attrs[i]); |
490 | sysfs_remove_bin_file(&connector->kdev.kobj, &edid_attr); | 474 | sysfs_remove_bin_file(&connector->kdev->kobj, &edid_attr); |
491 | device_unregister(&connector->kdev); | 475 | put_device(connector->kdev); |
492 | connector->kdev.parent = NULL; | 476 | device_unregister(connector->kdev); |
477 | connector->kdev = NULL; | ||
493 | } | 478 | } |
494 | EXPORT_SYMBOL(drm_sysfs_connector_remove); | 479 | EXPORT_SYMBOL(drm_sysfs_connector_remove); |
495 | 480 | ||
@@ -508,7 +493,7 @@ void drm_sysfs_hotplug_event(struct drm_device *dev) | |||
508 | 493 | ||
509 | DRM_DEBUG("generating hotplug event\n"); | 494 | DRM_DEBUG("generating hotplug event\n"); |
510 | 495 | ||
511 | kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, envp); | 496 | kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp); |
512 | } | 497 | } |
513 | EXPORT_SYMBOL(drm_sysfs_hotplug_event); | 498 | EXPORT_SYMBOL(drm_sysfs_hotplug_event); |
514 | 499 | ||
@@ -523,15 +508,8 @@ EXPORT_SYMBOL(drm_sysfs_hotplug_event); | |||
523 | */ | 508 | */ |
524 | int drm_sysfs_device_add(struct drm_minor *minor) | 509 | int drm_sysfs_device_add(struct drm_minor *minor) |
525 | { | 510 | { |
526 | int err; | ||
527 | char *minor_str; | 511 | char *minor_str; |
528 | 512 | ||
529 | minor->kdev.parent = minor->dev->dev; | ||
530 | |||
531 | minor->kdev.class = drm_class; | ||
532 | minor->kdev.release = drm_sysfs_device_release; | ||
533 | minor->kdev.devt = minor->device; | ||
534 | minor->kdev.type = &drm_sysfs_device_minor; | ||
535 | if (minor->type == DRM_MINOR_CONTROL) | 513 | if (minor->type == DRM_MINOR_CONTROL) |
536 | minor_str = "controlD%d"; | 514 | minor_str = "controlD%d"; |
537 | else if (minor->type == DRM_MINOR_RENDER) | 515 | else if (minor->type == DRM_MINOR_RENDER) |
@@ -539,18 +517,14 @@ int drm_sysfs_device_add(struct drm_minor *minor) | |||
539 | else | 517 | else |
540 | minor_str = "card%d"; | 518 | minor_str = "card%d"; |
541 | 519 | ||
542 | dev_set_name(&minor->kdev, minor_str, minor->index); | 520 | minor->kdev = device_create(drm_class, minor->dev->dev, |
543 | 521 | MKDEV(DRM_MAJOR, minor->index), | |
544 | err = device_register(&minor->kdev); | 522 | minor, minor_str, minor->index); |
545 | if (err) { | 523 | if (IS_ERR(minor->kdev)) { |
546 | DRM_ERROR("device add failed: %d\n", err); | 524 | DRM_ERROR("device create failed %ld\n", PTR_ERR(minor->kdev)); |
547 | goto err_out; | 525 | return PTR_ERR(minor->kdev); |
548 | } | 526 | } |
549 | |||
550 | return 0; | 527 | return 0; |
551 | |||
552 | err_out: | ||
553 | return err; | ||
554 | } | 528 | } |
555 | 529 | ||
556 | /** | 530 | /** |
@@ -562,9 +536,9 @@ err_out: | |||
562 | */ | 536 | */ |
563 | void drm_sysfs_device_remove(struct drm_minor *minor) | 537 | void drm_sysfs_device_remove(struct drm_minor *minor) |
564 | { | 538 | { |
565 | if (minor->kdev.parent) | 539 | if (minor->kdev) |
566 | device_unregister(&minor->kdev); | 540 | device_destroy(drm_class, MKDEV(DRM_MAJOR, minor->index)); |
567 | minor->kdev.parent = NULL; | 541 | minor->kdev = NULL; |
568 | } | 542 | } |
569 | 543 | ||
570 | 544 | ||
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c index f4eb43573cad..f88a1815d87c 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c | |||
@@ -666,7 +666,7 @@ cdv_intel_dp_i2c_init(struct gma_connector *connector, | |||
666 | strncpy (intel_dp->adapter.name, name, sizeof(intel_dp->adapter.name) - 1); | 666 | strncpy (intel_dp->adapter.name, name, sizeof(intel_dp->adapter.name) - 1); |
667 | intel_dp->adapter.name[sizeof(intel_dp->adapter.name) - 1] = '\0'; | 667 | intel_dp->adapter.name[sizeof(intel_dp->adapter.name) - 1] = '\0'; |
668 | intel_dp->adapter.algo_data = &intel_dp->algo; | 668 | intel_dp->adapter.algo_data = &intel_dp->algo; |
669 | intel_dp->adapter.dev.parent = &connector->base.kdev; | 669 | intel_dp->adapter.dev.parent = connector->base.kdev; |
670 | 670 | ||
671 | if (is_edp(encoder)) | 671 | if (is_edp(encoder)) |
672 | cdv_intel_edp_panel_vdd_on(encoder); | 672 | cdv_intel_edp_panel_vdd_on(encoder); |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 418ad642c742..d1739d3bdae9 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -942,7 +942,7 @@ static void ivybridge_parity_work(struct work_struct *work) | |||
942 | parity_event[4] = kasprintf(GFP_KERNEL, "SLICE=%d", slice); | 942 | parity_event[4] = kasprintf(GFP_KERNEL, "SLICE=%d", slice); |
943 | parity_event[5] = NULL; | 943 | parity_event[5] = NULL; |
944 | 944 | ||
945 | kobject_uevent_env(&dev_priv->dev->primary->kdev.kobj, | 945 | kobject_uevent_env(&dev_priv->dev->primary->kdev->kobj, |
946 | KOBJ_CHANGE, parity_event); | 946 | KOBJ_CHANGE, parity_event); |
947 | 947 | ||
948 | DRM_DEBUG("Parity error: Slice = %d, Row = %d, Bank = %d, Sub bank = %d.\n", | 948 | DRM_DEBUG("Parity error: Slice = %d, Row = %d, Bank = %d, Sub bank = %d.\n", |
@@ -1539,7 +1539,7 @@ static void i915_error_work_func(struct work_struct *work) | |||
1539 | char *reset_done_event[] = { I915_ERROR_UEVENT "=0", NULL }; | 1539 | char *reset_done_event[] = { I915_ERROR_UEVENT "=0", NULL }; |
1540 | int ret; | 1540 | int ret; |
1541 | 1541 | ||
1542 | kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, error_event); | 1542 | kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, error_event); |
1543 | 1543 | ||
1544 | /* | 1544 | /* |
1545 | * Note that there's only one work item which does gpu resets, so we | 1545 | * Note that there's only one work item which does gpu resets, so we |
@@ -1553,7 +1553,7 @@ static void i915_error_work_func(struct work_struct *work) | |||
1553 | */ | 1553 | */ |
1554 | if (i915_reset_in_progress(error) && !i915_terminally_wedged(error)) { | 1554 | if (i915_reset_in_progress(error) && !i915_terminally_wedged(error)) { |
1555 | DRM_DEBUG_DRIVER("resetting chip\n"); | 1555 | DRM_DEBUG_DRIVER("resetting chip\n"); |
1556 | kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, | 1556 | kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, |
1557 | reset_event); | 1557 | reset_event); |
1558 | 1558 | ||
1559 | /* | 1559 | /* |
@@ -1580,7 +1580,7 @@ static void i915_error_work_func(struct work_struct *work) | |||
1580 | smp_mb__before_atomic_inc(); | 1580 | smp_mb__before_atomic_inc(); |
1581 | atomic_inc(&dev_priv->gpu_error.reset_counter); | 1581 | atomic_inc(&dev_priv->gpu_error.reset_counter); |
1582 | 1582 | ||
1583 | kobject_uevent_env(&dev->primary->kdev.kobj, | 1583 | kobject_uevent_env(&dev->primary->kdev->kobj, |
1584 | KOBJ_CHANGE, reset_done_event); | 1584 | KOBJ_CHANGE, reset_done_event); |
1585 | } else { | 1585 | } else { |
1586 | atomic_set(&error->reset_counter, I915_WEDGED); | 1586 | atomic_set(&error->reset_counter, I915_WEDGED); |
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c index 3ae47951c1bd..1beec51b8e26 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "intel_drv.h" | 32 | #include "intel_drv.h" |
33 | #include "i915_drv.h" | 33 | #include "i915_drv.h" |
34 | 34 | ||
35 | #define dev_to_drm_minor(d) container_of((d), struct drm_minor, kdev) | 35 | #define dev_to_drm_minor(d) dev_get_drvdata((d)) |
36 | 36 | ||
37 | #ifdef CONFIG_PM | 37 | #ifdef CONFIG_PM |
38 | static u32 calc_residency(struct drm_device *dev, const u32 reg) | 38 | static u32 calc_residency(struct drm_device *dev, const u32 reg) |
@@ -75,7 +75,7 @@ show_rc6_mask(struct device *kdev, struct device_attribute *attr, char *buf) | |||
75 | static ssize_t | 75 | static ssize_t |
76 | show_rc6_ms(struct device *kdev, struct device_attribute *attr, char *buf) | 76 | show_rc6_ms(struct device *kdev, struct device_attribute *attr, char *buf) |
77 | { | 77 | { |
78 | struct drm_minor *dminor = dev_to_drm_minor(kdev); | 78 | struct drm_minor *dminor = dev_get_drvdata(kdev); |
79 | u32 rc6_residency = calc_residency(dminor->dev, GEN6_GT_GFX_RC6); | 79 | u32 rc6_residency = calc_residency(dminor->dev, GEN6_GT_GFX_RC6); |
80 | return snprintf(buf, PAGE_SIZE, "%u\n", rc6_residency); | 80 | return snprintf(buf, PAGE_SIZE, "%u\n", rc6_residency); |
81 | } | 81 | } |
@@ -543,19 +543,19 @@ void i915_setup_sysfs(struct drm_device *dev) | |||
543 | 543 | ||
544 | #ifdef CONFIG_PM | 544 | #ifdef CONFIG_PM |
545 | if (INTEL_INFO(dev)->gen >= 6) { | 545 | if (INTEL_INFO(dev)->gen >= 6) { |
546 | ret = sysfs_merge_group(&dev->primary->kdev.kobj, | 546 | ret = sysfs_merge_group(&dev->primary->kdev->kobj, |
547 | &rc6_attr_group); | 547 | &rc6_attr_group); |
548 | if (ret) | 548 | if (ret) |
549 | DRM_ERROR("RC6 residency sysfs setup failed\n"); | 549 | DRM_ERROR("RC6 residency sysfs setup failed\n"); |
550 | } | 550 | } |
551 | #endif | 551 | #endif |
552 | if (HAS_L3_DPF(dev)) { | 552 | if (HAS_L3_DPF(dev)) { |
553 | ret = device_create_bin_file(&dev->primary->kdev, &dpf_attrs); | 553 | ret = device_create_bin_file(dev->primary->kdev, &dpf_attrs); |
554 | if (ret) | 554 | if (ret) |
555 | DRM_ERROR("l3 parity sysfs setup failed\n"); | 555 | DRM_ERROR("l3 parity sysfs setup failed\n"); |
556 | 556 | ||
557 | if (NUM_L3_SLICES(dev) > 1) { | 557 | if (NUM_L3_SLICES(dev) > 1) { |
558 | ret = device_create_bin_file(&dev->primary->kdev, | 558 | ret = device_create_bin_file(dev->primary->kdev, |
559 | &dpf_attrs_1); | 559 | &dpf_attrs_1); |
560 | if (ret) | 560 | if (ret) |
561 | DRM_ERROR("l3 parity slice 1 setup failed\n"); | 561 | DRM_ERROR("l3 parity slice 1 setup failed\n"); |
@@ -564,13 +564,13 @@ void i915_setup_sysfs(struct drm_device *dev) | |||
564 | 564 | ||
565 | ret = 0; | 565 | ret = 0; |
566 | if (IS_VALLEYVIEW(dev)) | 566 | if (IS_VALLEYVIEW(dev)) |
567 | ret = sysfs_create_files(&dev->primary->kdev.kobj, vlv_attrs); | 567 | ret = sysfs_create_files(&dev->primary->kdev->kobj, vlv_attrs); |
568 | else if (INTEL_INFO(dev)->gen >= 6) | 568 | else if (INTEL_INFO(dev)->gen >= 6) |
569 | ret = sysfs_create_files(&dev->primary->kdev.kobj, gen6_attrs); | 569 | ret = sysfs_create_files(&dev->primary->kdev->kobj, gen6_attrs); |
570 | if (ret) | 570 | if (ret) |
571 | DRM_ERROR("RPS sysfs setup failed\n"); | 571 | DRM_ERROR("RPS sysfs setup failed\n"); |
572 | 572 | ||
573 | ret = sysfs_create_bin_file(&dev->primary->kdev.kobj, | 573 | ret = sysfs_create_bin_file(&dev->primary->kdev->kobj, |
574 | &error_state_attr); | 574 | &error_state_attr); |
575 | if (ret) | 575 | if (ret) |
576 | DRM_ERROR("error_state sysfs setup failed\n"); | 576 | DRM_ERROR("error_state sysfs setup failed\n"); |
@@ -578,14 +578,14 @@ void i915_setup_sysfs(struct drm_device *dev) | |||
578 | 578 | ||
579 | void i915_teardown_sysfs(struct drm_device *dev) | 579 | void i915_teardown_sysfs(struct drm_device *dev) |
580 | { | 580 | { |
581 | sysfs_remove_bin_file(&dev->primary->kdev.kobj, &error_state_attr); | 581 | sysfs_remove_bin_file(&dev->primary->kdev->kobj, &error_state_attr); |
582 | if (IS_VALLEYVIEW(dev)) | 582 | if (IS_VALLEYVIEW(dev)) |
583 | sysfs_remove_files(&dev->primary->kdev.kobj, vlv_attrs); | 583 | sysfs_remove_files(&dev->primary->kdev->kobj, vlv_attrs); |
584 | else | 584 | else |
585 | sysfs_remove_files(&dev->primary->kdev.kobj, gen6_attrs); | 585 | sysfs_remove_files(&dev->primary->kdev->kobj, gen6_attrs); |
586 | device_remove_bin_file(&dev->primary->kdev, &dpf_attrs_1); | 586 | device_remove_bin_file(dev->primary->kdev, &dpf_attrs_1); |
587 | device_remove_bin_file(&dev->primary->kdev, &dpf_attrs); | 587 | device_remove_bin_file(dev->primary->kdev, &dpf_attrs); |
588 | #ifdef CONFIG_PM | 588 | #ifdef CONFIG_PM |
589 | sysfs_unmerge_group(&dev->primary->kdev.kobj, &rc6_attr_group); | 589 | sysfs_unmerge_group(&dev->primary->kdev->kobj, &rc6_attr_group); |
590 | #endif | 590 | #endif |
591 | } | 591 | } |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4f52ec75b39f..d5bd349105e5 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -737,7 +737,7 @@ intel_dp_i2c_init(struct intel_dp *intel_dp, | |||
737 | strncpy(intel_dp->adapter.name, name, sizeof(intel_dp->adapter.name) - 1); | 737 | strncpy(intel_dp->adapter.name, name, sizeof(intel_dp->adapter.name) - 1); |
738 | intel_dp->adapter.name[sizeof(intel_dp->adapter.name) - 1] = '\0'; | 738 | intel_dp->adapter.name[sizeof(intel_dp->adapter.name) - 1] = '\0'; |
739 | intel_dp->adapter.algo_data = &intel_dp->algo; | 739 | intel_dp->adapter.algo_data = &intel_dp->algo; |
740 | intel_dp->adapter.dev.parent = &intel_connector->base.kdev; | 740 | intel_dp->adapter.dev.parent = intel_connector->base.kdev; |
741 | 741 | ||
742 | ironlake_edp_panel_vdd_on(intel_dp); | 742 | ironlake_edp_panel_vdd_on(intel_dp); |
743 | ret = i2c_dp_aux_add_bus(&intel_dp->adapter); | 743 | ret = i2c_dp_aux_add_bus(&intel_dp->adapter); |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 54684168de1e..c81020923ee4 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -722,7 +722,7 @@ int intel_panel_setup_backlight(struct drm_connector *connector) | |||
722 | } | 722 | } |
723 | dev_priv->backlight.device = | 723 | dev_priv->backlight.device = |
724 | backlight_device_register("intel_backlight", | 724 | backlight_device_register("intel_backlight", |
725 | &connector->kdev, dev, | 725 | connector->kdev, dev, |
726 | &intel_panel_bl_ops, &props); | 726 | &intel_panel_bl_ops, &props); |
727 | 727 | ||
728 | if (IS_ERR(dev_priv->backlight.device)) { | 728 | if (IS_ERR(dev_priv->backlight.device)) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index 2ffad2176b7f..630f6e84fc01 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c | |||
@@ -82,7 +82,7 @@ nv40_backlight_init(struct drm_connector *connector) | |||
82 | memset(&props, 0, sizeof(struct backlight_properties)); | 82 | memset(&props, 0, sizeof(struct backlight_properties)); |
83 | props.type = BACKLIGHT_RAW; | 83 | props.type = BACKLIGHT_RAW; |
84 | props.max_brightness = 31; | 84 | props.max_brightness = 31; |
85 | bd = backlight_device_register("nv_backlight", &connector->kdev, drm, | 85 | bd = backlight_device_register("nv_backlight", connector->kdev, drm, |
86 | &nv40_bl_ops, &props); | 86 | &nv40_bl_ops, &props); |
87 | if (IS_ERR(bd)) | 87 | if (IS_ERR(bd)) |
88 | return PTR_ERR(bd); | 88 | return PTR_ERR(bd); |
@@ -204,7 +204,7 @@ nv50_backlight_init(struct drm_connector *connector) | |||
204 | memset(&props, 0, sizeof(struct backlight_properties)); | 204 | memset(&props, 0, sizeof(struct backlight_properties)); |
205 | props.type = BACKLIGHT_RAW; | 205 | props.type = BACKLIGHT_RAW; |
206 | props.max_brightness = 100; | 206 | props.max_brightness = 100; |
207 | bd = backlight_device_register("nv_backlight", &connector->kdev, | 207 | bd = backlight_device_register("nv_backlight", connector->kdev, |
208 | nv_encoder, ops, &props); | 208 | nv_encoder, ops, &props); |
209 | if (IS_ERR(bd)) | 209 | if (IS_ERR(bd)) |
210 | return PTR_ERR(bd); | 210 | return PTR_ERR(bd); |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 32923d2f6002..28e2dc48e015 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -213,7 +213,7 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
213 | props.type = BACKLIGHT_RAW; | 213 | props.type = BACKLIGHT_RAW; |
214 | snprintf(bl_name, sizeof(bl_name), | 214 | snprintf(bl_name, sizeof(bl_name), |
215 | "radeon_bl%d", dev->primary->index); | 215 | "radeon_bl%d", dev->primary->index); |
216 | bd = backlight_device_register(bl_name, &drm_connector->kdev, | 216 | bd = backlight_device_register(bl_name, drm_connector->kdev, |
217 | pdata, &radeon_atom_backlight_ops, &props); | 217 | pdata, &radeon_atom_backlight_ops, &props); |
218 | if (IS_ERR(bd)) { | 218 | if (IS_ERR(bd)) { |
219 | DRM_ERROR("Backlight registration failed\n"); | 219 | DRM_ERROR("Backlight registration failed\n"); |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 62cd512f5c8d..c89971d904c3 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -392,7 +392,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, | |||
392 | props.type = BACKLIGHT_RAW; | 392 | props.type = BACKLIGHT_RAW; |
393 | snprintf(bl_name, sizeof(bl_name), | 393 | snprintf(bl_name, sizeof(bl_name), |
394 | "radeon_bl%d", dev->primary->index); | 394 | "radeon_bl%d", dev->primary->index); |
395 | bd = backlight_device_register(bl_name, &drm_connector->kdev, | 395 | bd = backlight_device_register(bl_name, drm_connector->kdev, |
396 | pdata, &radeon_backlight_ops, &props); | 396 | pdata, &radeon_backlight_ops, &props); |
397 | if (IS_ERR(bd)) { | 397 | if (IS_ERR(bd)) { |
398 | DRM_ERROR("Backlight registration failed\n"); | 398 | DRM_ERROR("Backlight registration failed\n"); |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 2b954adf5bd4..7062307a4a2d 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1046,7 +1046,7 @@ struct drm_minor { | |||
1046 | int index; /**< Minor device number */ | 1046 | int index; /**< Minor device number */ |
1047 | int type; /**< Control or render */ | 1047 | int type; /**< Control or render */ |
1048 | dev_t device; /**< Device number for mknod */ | 1048 | dev_t device; /**< Device number for mknod */ |
1049 | struct device kdev; /**< Linux device */ | 1049 | struct device *kdev; /**< Linux device */ |
1050 | struct drm_device *dev; | 1050 | struct drm_device *dev; |
1051 | 1051 | ||
1052 | struct dentry *debugfs_root; | 1052 | struct dentry *debugfs_root; |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index ba407f6b4f1f..755dd2532612 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -595,7 +595,7 @@ enum drm_connector_force { | |||
595 | */ | 595 | */ |
596 | struct drm_connector { | 596 | struct drm_connector { |
597 | struct drm_device *dev; | 597 | struct drm_device *dev; |
598 | struct device kdev; | 598 | struct device *kdev; |
599 | struct device_attribute *attr; | 599 | struct device_attribute *attr; |
600 | struct list_head head; | 600 | struct list_head head; |
601 | 601 | ||