drm/drv: use enum drm_minor_type when appropriate
Subsystems (2)
PATCH 1/3 drm/drv: use enum drm_minor_type when appropriate
This makes it easier to figure out what the "type" variable can be set to when reading the implementation of these functions.
--- drivers/gpu/drm/drm_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_drv.c +4 -4
@@ -84,7 +84,7 @@ DEFINE_STATIC_SRCU(drm_unplug_srcu);*/ static struct drm_minor **drm_minor_get_slot (struct drm_device *dev, -unsigned int type) +enum drm_minor_type type) {switch (type) {case DRM_MINOR_PRIMARY :
@@ -116,7 +116,7 @@ static void drm_minor_alloc_release(struct drm_device *dev, void *data) } } -static int drm_minor_alloc (struct drm_device *dev,unsigned int type) +static int drm_minor_alloc (struct drm_device *dev,enum drm_minor_type type) {struct drm_minor *minor;unsigned long flags;
@@ -160,7 +160,7 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type)return 0 ; } -static int drm_minor_register (struct drm_device *dev,unsigned int type) +static int drm_minor_register (struct drm_device *dev,enum drm_minor_type type) {struct drm_minor *minor;unsigned long flags;
@@ -203,7 +203,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)return ret; } -static void drm_minor_unregister (struct drm_device *dev,unsigned int type) +static void drm_minor_unregister (struct drm_device *dev,enum drm_minor_type type) {struct drm_minor *minor;unsigned long flags;
Signature · 1 line
2.41.0
PATCH 2/3 drm/file: use explicit values for enum drm_minor_type
This makes it clearer that the values cannot be changed because they are ABI.
--- include/drm/drm_file.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/drm/drm_file.h +4 -4
@@ -50,16 +50,16 @@ struct file;* header include loops we need it here for now. */ -/* Note that the order of this enum is ABI (it determines +/* Note that the values of this enum are ABI (it determines * /dev/dri/renderD* numbers). * * Setting DRM_MINOR_ACCEL to 32 gives enough space for more drm minors to * be implemented before we hit any future */ enum drm_minor_type { -DRM_MINOR_PRIMARY , -DRM_MINOR_CONTROL , -DRM_MINOR_RENDER , +DRM_MINOR_PRIMARY =0 , +DRM_MINOR_CONTROL =1 , +DRM_MINOR_RENDER =2 ,DRM_MINOR_ACCEL =32 , };
Signature · 1 line
2.41.0
RFC PATCH 3/3 drm/file: drop DRM_MINOR_CONTROL
In reply to Simon SerThis entry should never be used by the kernel. Record the historical context in a comment.
--- include/drm/drm_file.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/drm/drm_file.h +3 -1
@@ -53,12 +53,14 @@ struct file;/* Note that the values of this enum are ABI (it determines * /dev/dri/renderD* numbers). * +* There used to be a DRM_MINOR_CONTROL = 1 entry, but such nodes were never +* exposed. Still, some user-space has logic to handle them. +* * Setting DRM_MINOR_ACCEL to 32 gives enough space for more drm minors to * be implemented before we hit any future */ enum drm_minor_type {DRM_MINOR_PRIMARY =0 , -DRM_MINOR_CONTROL =1 ,DRM_MINOR_RENDER =2 ,DRM_MINOR_ACCEL =32 , };
Signature · 1 line
2.41.0
Re: [RFC PATCH 3/3] drm/file: drop DRM_MINOR_CONTROL
Hi Simon
Am 14.07.23 um 12:46 schrieb Simon Ser:
Quoted 19 lines
This entry should never be used by the kernel. Record the historical context in a comment.
Signed-off-by Simon Ser <[email protected]>Cc Christian König <[email protected]>Cc James Zhu <[email protected]>Cc Marek Olšák <[email protected]>Cc Daniel Vetter <[email protected]>--- include/drm/drm_file.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/drm/drm_file.h +0
-0@@ -53,12 +53,14 @@ struct file;/* Note that the values of this enum are ABI (it determines * /dev/dri/renderD* numbers).
include/drm/drm_file.h struct file; · line 61
Quoted 10 lines
include/drm/drm_file.h +3
-1* +* There used to be a DRM_MINOR_CONTROL = 1 entry, but such nodes were never +* exposed. Still, some user-space has logic to handle them. +* * Setting DRM_MINOR_ACCEL to 32 gives enough space for more drm minors to * be implemented before we hit any future */ enum drm_minor_type {DRM_MINOR_PRIMARY =0 , -DRM_MINOR_CONTROL =1 ,
Maybe rather leave this line in and comment it with "// obsolete". Otherwise someone might accidentally use 1 for something.
In any case
for the whole series.
Best regards
Thomas
Quoted 3 lines
include/drm/drm_file.h +0
-0DRM_MINOR_RENDER =2 , DRM_MINOR_ACCEL = 32, };
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [RFC PATCH 3/3] drm/file: drop DRM_MINOR_CONTROL
Quoted 27 lines · Thomas Zimmermann
Hi Simon
Am 14.07.23 um 12:46 schrieb Simon Ser:
Quoted 24 lines
This entry should never be used by the kernel. Record the historical context in a comment.
Signed-off-by Simon Ser <[email protected]>Cc Christian König <[email protected]>Cc James Zhu <[email protected]>Cc Marek Olšák <[email protected]>Cc Daniel Vetter <[email protected]>--- include/drm/drm_file.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/drm/drm_file.h +3
-0@@ -53,12 +53,14 @@ struct file;/* Note that the values of this enum are ABI (it determines * /dev/dri/renderD* numbers). * +* There used to be a DRM_MINOR_CONTROL = 1 entry, but such nodes were never +* exposed. Still, some user-space has logic to handle them. +* * Setting DRM_MINOR_ACCEL to 32 gives enough space for more drm minors to
Quoted 8 lines
include/drm/drm_file.h struct file; · line 61
Quoted 5 lines
include/drm/drm_file.h +0
-1* be implemented before we hit any future */ enum drm_minor_type {DRM_MINOR_PRIMARY =0 , -DRM_MINOR_CONTROL =1 ,Maybe rather leave this line in and comment it with "// obsolete". Otherwise someone might accidentally use 1 for something.
Yeah... That's why I added the comment. But maybe better to leave the entry indeed, even if we risk someone accidentally using it.
Quoted 5 lines
In any case
Reviewed-by Thomas Zimmermann <[email protected]>for the whole series.
Thanks for the review!
Thomas Zimmermann
maintainerRe: [RFC PATCH 3/3] drm/file: drop DRM_MINOR_CONTROL
Hi
Am 14.07.23 um 16:37 schrieb Simon Ser:
Quoted 38 lines · Thomas Zimmermann
Quoted 28 lines
Hi Simon
Am 14.07.23 um 12:46 schrieb Simon Ser:
Quoted 24 lines
This entry should never be used by the kernel. Record the historical context in a comment.
Signed-off-by Simon Ser <[email protected]>Cc Christian König <[email protected]>Cc James Zhu <[email protected]>Cc Marek Olšák <[email protected]>Cc Daniel Vetter <[email protected]>--- include/drm/drm_file.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/drm/drm_file.h +3
-0@@ -53,12 +53,14 @@ struct file;/* Note that the values of this enum are ABI (it determines * /dev/dri/renderD* numbers). * +* There used to be a DRM_MINOR_CONTROL = 1 entry, but such nodes were never +* exposed. Still, some user-space has logic to handle them. +* * Setting DRM_MINOR_ACCEL to 32 gives enough space for more drm minors to Quoted 8 lines
include/drm/drm_file.h struct file; · line 61
Quoted 5 lines
include/drm/drm_file.h +0
-1* be implemented before we hit any future */ enum drm_minor_type {DRM_MINOR_PRIMARY =0 , -DRM_MINOR_CONTROL =1 ,Maybe rather leave this line in and comment it with "// obsolete". Otherwise someone might accidentally use 1 for something.
Quoted 2 lines
Yeah... That's why I added the comment. But maybe better to leave the entry indeed, even if we risk someone accidentally using it.
You could still out-comment the line as a whole. Simply having it there will warn potential users.
Best regards
Thomas
Quoted 8 lines
Quoted 6 lines
In any case
Reviewed-by Thomas Zimmermann <[email protected]>for the whole series.
Thanks for the review!
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Hi Simon
Thanks!
Quoted 52 lines · Simon Ser
This makes it easier to figure out what the "type" variable can be set to when reading the implementation of these functions.
Signed-off-by Simon Ser<[email protected]>Cc Christian König<[email protected]>Cc James Zhu<[email protected]>Cc Marek Olšák<[email protected]>Cc Daniel Vetter<[email protected]>--- drivers/gpu/drm/drm_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_drv.c +4
-4@@ -84,7 +84,7 @@ DEFINE_STATIC_SRCU(drm_unplug_srcu);*/ static struct drm_minor **drm_minor_get_slot (struct drm_device *dev, -unsigned int type) +enum drm_minor_type type) {switch (type) {case DRM_MINOR_PRIMARY :@@ -116,7 +116,7 @@ static void drm_minor_alloc_release(struct drm_device *dev, void *data) } } -static int drm_minor_alloc (struct drm_device *dev,unsigned int type) +static int drm_minor_alloc (struct drm_device *dev,enum drm_minor_type type) {struct drm_minor *minor;unsigned long flags;@@ -160,7 +160,7 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type)return 0 ; } -static int drm_minor_register (struct drm_device *dev,unsigned int type) +static int drm_minor_register (struct drm_device *dev,enum drm_minor_type type) {struct drm_minor *minor;unsigned long flags;@@ -203,7 +203,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)return ret; } -static void drm_minor_unregister (struct drm_device *dev,unsigned int type) +static void drm_minor_unregister (struct drm_device *dev,enum drm_minor_type type) {struct drm_minor *minor;unsigned long flags;