[v3,2/2] drm/debugfs: also take per device driver features into account
diff mbox series

Message ID 20200122155030.29304-2-jani.nikula@intel.com
State New
Headers show
Series
  • [v3,1/2] drm: add drm_core_check_all_features() to check for a mask of features
Related show

Commit Message

Jani Nikula Jan. 22, 2020, 3:50 p.m. UTC
Use drm_core_check_all_features() to ensure both the driver features and
the per-device driver features are taken into account when registering
debugfs files.

v2:
- use drm_core_check_all_features()

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_debugfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Thomas Zimmermann Jan. 22, 2020, 4:11 p.m. UTC | #1
Hi

Am 22.01.20 um 16:50 schrieb Jani Nikula:
> Use drm_core_check_all_features() to ensure both the driver features and
> the per-device driver features are taken into account when registering
> debugfs files.
> 
> v2:
> - use drm_core_check_all_features()
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>  drivers/gpu/drm/drm_debugfs.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index eab0f2687cd6..0c70b4b22c8a 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -180,10 +180,7 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
>  	int i;
>  
>  	for (i = 0; i < count; i++) {
> -		u32 features = files[i].driver_features;
> -
> -		if (features != 0 &&
> -		    (dev->driver->driver_features & features) != features)
> +		if (!drm_core_check_all_features(dev, files[i].driver_features))
>  			continue;
>  
>  		tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
>
Jani Nikula Jan. 23, 2020, 1:01 p.m. UTC | #2
On Wed, 22 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 22.01.20 um 16:50 schrieb Jani Nikula:
>> Use drm_core_check_all_features() to ensure both the driver features and
>> the per-device driver features are taken into account when registering
>> debugfs files.
>> 
>> v2:
>> - use drm_core_check_all_features()
>> 
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
>
>> ---
>>  drivers/gpu/drm/drm_debugfs.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
>> index eab0f2687cd6..0c70b4b22c8a 100644
>> --- a/drivers/gpu/drm/drm_debugfs.c
>> +++ b/drivers/gpu/drm/drm_debugfs.c
>> @@ -180,10 +180,7 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
>>  	int i;
>>  
>>  	for (i = 0; i < count; i++) {
>> -		u32 features = files[i].driver_features;
>> -
>> -		if (features != 0 &&
>> -		    (dev->driver->driver_features & features) != features)
>> +		if (!drm_core_check_all_features(dev, files[i].driver_features))
>>  			continue;

Thanks for the review, but actually files[i].driver_features == 0 means
"don't care about features", and the way drm_core_check_all_features()
is defined features == 0 leads to false. So we fail to register most
debugfs files. *blush*

New version on the list.

BR,
Jani.


>>  
>>  		tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
>>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index eab0f2687cd6..0c70b4b22c8a 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -180,10 +180,7 @@  int drm_debugfs_create_files(const struct drm_info_list *files, int count,
 	int i;
 
 	for (i = 0; i < count; i++) {
-		u32 features = files[i].driver_features;
-
-		if (features != 0 &&
-		    (dev->driver->driver_features & features) != features)
+		if (!drm_core_check_all_features(dev, files[i].driver_features))
 			continue;
 
 		tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);