diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 3ab26fb9..a381fa4a 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -966,7 +966,8 @@ static int gk20a_create_device( | |||
966 | struct device *dev, int devno, | 966 | struct device *dev, int devno, |
967 | const char *interface_name, const char *cdev_name, | 967 | const char *interface_name, const char *cdev_name, |
968 | struct cdev *cdev, struct device **out, | 968 | struct cdev *cdev, struct device **out, |
969 | const struct file_operations *ops) | 969 | const struct file_operations *ops, |
970 | struct class *class) | ||
970 | { | 971 | { |
971 | struct device *subdev; | 972 | struct device *subdev; |
972 | int err; | 973 | int err; |
@@ -982,7 +983,7 @@ static int gk20a_create_device( | |||
982 | return err; | 983 | return err; |
983 | } | 984 | } |
984 | 985 | ||
985 | subdev = device_create(&nvgpu_class, NULL, devno, NULL, | 986 | subdev = device_create(class, NULL, devno, NULL, |
986 | interface_name, cdev_name); | 987 | interface_name, cdev_name); |
987 | 988 | ||
988 | if (IS_ERR(subdev)) { | 989 | if (IS_ERR(subdev)) { |
@@ -997,42 +998,42 @@ static int gk20a_create_device( | |||
997 | return 0; | 998 | return 0; |
998 | } | 999 | } |
999 | 1000 | ||
1000 | void gk20a_user_deinit(struct device *dev) | 1001 | void gk20a_user_deinit(struct device *dev, struct class *class) |
1001 | { | 1002 | { |
1002 | struct gk20a *g = gk20a_from_dev(dev); | 1003 | struct gk20a *g = gk20a_from_dev(dev); |
1003 | 1004 | ||
1004 | if (g->channel.node) { | 1005 | if (g->channel.node) { |
1005 | device_destroy(&nvgpu_class, g->channel.cdev.dev); | 1006 | device_destroy(class, g->channel.cdev.dev); |
1006 | cdev_del(&g->channel.cdev); | 1007 | cdev_del(&g->channel.cdev); |
1007 | } | 1008 | } |
1008 | 1009 | ||
1009 | if (g->as.node) { | 1010 | if (g->as.node) { |
1010 | device_destroy(&nvgpu_class, g->as.cdev.dev); | 1011 | device_destroy(class, g->as.cdev.dev); |
1011 | cdev_del(&g->as.cdev); | 1012 | cdev_del(&g->as.cdev); |
1012 | } | 1013 | } |
1013 | 1014 | ||
1014 | if (g->ctrl.node) { | 1015 | if (g->ctrl.node) { |
1015 | device_destroy(&nvgpu_class, g->ctrl.cdev.dev); | 1016 | device_destroy(class, g->ctrl.cdev.dev); |
1016 | cdev_del(&g->ctrl.cdev); | 1017 | cdev_del(&g->ctrl.cdev); |
1017 | } | 1018 | } |
1018 | 1019 | ||
1019 | if (g->dbg.node) { | 1020 | if (g->dbg.node) { |
1020 | device_destroy(&nvgpu_class, g->dbg.cdev.dev); | 1021 | device_destroy(class, g->dbg.cdev.dev); |
1021 | cdev_del(&g->dbg.cdev); | 1022 | cdev_del(&g->dbg.cdev); |
1022 | } | 1023 | } |
1023 | 1024 | ||
1024 | if (g->prof.node) { | 1025 | if (g->prof.node) { |
1025 | device_destroy(&nvgpu_class, g->prof.cdev.dev); | 1026 | device_destroy(class, g->prof.cdev.dev); |
1026 | cdev_del(&g->prof.cdev); | 1027 | cdev_del(&g->prof.cdev); |
1027 | } | 1028 | } |
1028 | 1029 | ||
1029 | if (g->tsg.node) { | 1030 | if (g->tsg.node) { |
1030 | device_destroy(&nvgpu_class, g->tsg.cdev.dev); | 1031 | device_destroy(class, g->tsg.cdev.dev); |
1031 | cdev_del(&g->tsg.cdev); | 1032 | cdev_del(&g->tsg.cdev); |
1032 | } | 1033 | } |
1033 | 1034 | ||
1034 | if (g->ctxsw.node) { | 1035 | if (g->ctxsw.node) { |
1035 | device_destroy(&nvgpu_class, g->ctxsw.cdev.dev); | 1036 | device_destroy(class, g->ctxsw.cdev.dev); |
1036 | cdev_del(&g->ctxsw.cdev); | 1037 | cdev_del(&g->ctxsw.cdev); |
1037 | } | 1038 | } |
1038 | 1039 | ||
@@ -1040,7 +1041,8 @@ void gk20a_user_deinit(struct device *dev) | |||
1040 | unregister_chrdev_region(g->cdev_region, GK20A_NUM_CDEVS); | 1041 | unregister_chrdev_region(g->cdev_region, GK20A_NUM_CDEVS); |
1041 | } | 1042 | } |
1042 | 1043 | ||
1043 | int gk20a_user_init(struct device *dev, const char *interface_name) | 1044 | int gk20a_user_init(struct device *dev, const char *interface_name, |
1045 | struct class *class) | ||
1044 | { | 1046 | { |
1045 | int err; | 1047 | int err; |
1046 | dev_t devno; | 1048 | dev_t devno; |
@@ -1055,44 +1057,51 @@ int gk20a_user_init(struct device *dev, const char *interface_name) | |||
1055 | 1057 | ||
1056 | err = gk20a_create_device(dev, devno++, interface_name, "", | 1058 | err = gk20a_create_device(dev, devno++, interface_name, "", |
1057 | &g->channel.cdev, &g->channel.node, | 1059 | &g->channel.cdev, &g->channel.node, |
1058 | &gk20a_channel_ops); | 1060 | &gk20a_channel_ops, |
1061 | class); | ||
1059 | if (err) | 1062 | if (err) |
1060 | goto fail; | 1063 | goto fail; |
1061 | 1064 | ||
1062 | err = gk20a_create_device(dev, devno++, interface_name, "-as", | 1065 | err = gk20a_create_device(dev, devno++, interface_name, "-as", |
1063 | &g->as.cdev, &g->as.node, | 1066 | &g->as.cdev, &g->as.node, |
1064 | &gk20a_as_ops); | 1067 | &gk20a_as_ops, |
1068 | class); | ||
1065 | if (err) | 1069 | if (err) |
1066 | goto fail; | 1070 | goto fail; |
1067 | 1071 | ||
1068 | err = gk20a_create_device(dev, devno++, interface_name, "-ctrl", | 1072 | err = gk20a_create_device(dev, devno++, interface_name, "-ctrl", |
1069 | &g->ctrl.cdev, &g->ctrl.node, | 1073 | &g->ctrl.cdev, &g->ctrl.node, |
1070 | &gk20a_ctrl_ops); | 1074 | &gk20a_ctrl_ops, |
1075 | class); | ||
1071 | if (err) | 1076 | if (err) |
1072 | goto fail; | 1077 | goto fail; |
1073 | 1078 | ||
1074 | err = gk20a_create_device(dev, devno++, interface_name, "-dbg", | 1079 | err = gk20a_create_device(dev, devno++, interface_name, "-dbg", |
1075 | &g->dbg.cdev, &g->dbg.node, | 1080 | &g->dbg.cdev, &g->dbg.node, |
1076 | &gk20a_dbg_ops); | 1081 | &gk20a_dbg_ops, |
1082 | class); | ||
1077 | if (err) | 1083 | if (err) |
1078 | goto fail; | 1084 | goto fail; |
1079 | 1085 | ||
1080 | err = gk20a_create_device(dev, devno++, interface_name, "-prof", | 1086 | err = gk20a_create_device(dev, devno++, interface_name, "-prof", |
1081 | &g->prof.cdev, &g->prof.node, | 1087 | &g->prof.cdev, &g->prof.node, |
1082 | &gk20a_prof_ops); | 1088 | &gk20a_prof_ops, |
1089 | class); | ||
1083 | if (err) | 1090 | if (err) |
1084 | goto fail; | 1091 | goto fail; |
1085 | 1092 | ||
1086 | err = gk20a_create_device(dev, devno++, interface_name, "-tsg", | 1093 | err = gk20a_create_device(dev, devno++, interface_name, "-tsg", |
1087 | &g->tsg.cdev, &g->tsg.node, | 1094 | &g->tsg.cdev, &g->tsg.node, |
1088 | &gk20a_tsg_ops); | 1095 | &gk20a_tsg_ops, |
1096 | class); | ||
1089 | if (err) | 1097 | if (err) |
1090 | goto fail; | 1098 | goto fail; |
1091 | 1099 | ||
1092 | #ifdef CONFIG_GK20A_CTXSW_TRACE | 1100 | #ifdef CONFIG_GK20A_CTXSW_TRACE |
1093 | err = gk20a_create_device(dev, devno++, interface_name, "-ctxsw", | 1101 | err = gk20a_create_device(dev, devno++, interface_name, "-ctxsw", |
1094 | &g->ctxsw.cdev, &g->ctxsw.node, | 1102 | &g->ctxsw.cdev, &g->ctxsw.node, |
1095 | &gk20a_ctxsw_ops); | 1103 | &gk20a_ctxsw_ops, |
1104 | class); | ||
1096 | if (err) | 1105 | if (err) |
1097 | goto fail; | 1106 | goto fail; |
1098 | #endif | 1107 | #endif |
@@ -1100,7 +1109,7 @@ int gk20a_user_init(struct device *dev, const char *interface_name) | |||
1100 | 1109 | ||
1101 | return 0; | 1110 | return 0; |
1102 | fail: | 1111 | fail: |
1103 | gk20a_user_deinit(dev); | 1112 | gk20a_user_deinit(dev, &nvgpu_class); |
1104 | return err; | 1113 | return err; |
1105 | } | 1114 | } |
1106 | 1115 | ||
@@ -1464,7 +1473,7 @@ static int gk20a_probe(struct platform_device *dev) | |||
1464 | if (gk20a->irq_stall != gk20a->irq_nonstall) | 1473 | if (gk20a->irq_stall != gk20a->irq_nonstall) |
1465 | disable_irq(gk20a->irq_nonstall); | 1474 | disable_irq(gk20a->irq_nonstall); |
1466 | 1475 | ||
1467 | err = gk20a_user_init(&dev->dev, INTERFACE_NAME); | 1476 | err = gk20a_user_init(&dev->dev, INTERFACE_NAME, &nvgpu_class); |
1468 | if (err) | 1477 | if (err) |
1469 | return err; | 1478 | return err; |
1470 | 1479 | ||
@@ -1644,7 +1653,7 @@ static int __exit gk20a_remove(struct platform_device *pdev) | |||
1644 | if (g->remove_support) | 1653 | if (g->remove_support) |
1645 | g->remove_support(dev); | 1654 | g->remove_support(dev); |
1646 | 1655 | ||
1647 | gk20a_user_deinit(dev); | 1656 | gk20a_user_deinit(dev, &nvgpu_class); |
1648 | 1657 | ||
1649 | debugfs_remove_recursive(platform->debugfs); | 1658 | debugfs_remove_recursive(platform->debugfs); |
1650 | debugfs_remove_recursive(platform->debugfs_alias); | 1659 | debugfs_remove_recursive(platform->debugfs_alias); |
@@ -1751,7 +1760,6 @@ static int gk20a_domain_init(struct of_device_id *matches) | |||
1751 | } | 1760 | } |
1752 | #endif | 1761 | #endif |
1753 | 1762 | ||
1754 | |||
1755 | struct class nvgpu_class = { | 1763 | struct class nvgpu_class = { |
1756 | .owner = THIS_MODULE, | 1764 | .owner = THIS_MODULE, |
1757 | .name = CLASS_NAME, | 1765 | .name = CLASS_NAME, |