[PATCH 10/12] drm/modes: parse_cmdline: Remove some unnecessary code

Hans de Goede hdegoede at redhat.com
Tue Nov 12 10:39:22 UTC 2019


Hi,

On 12-11-2019 10:44, Daniel Vetter wrote:
> On Sun, Nov 10, 2019 at 04:40:59PM +0100, Hans de Goede wrote:
>> Remove 2 bits of dead-code:
>>
>> 1) drm_mode_parse_command_line_for_connector() always gets called with a
>> zero-ed drm_cmdline_mode struct and assumes so in most places, so there is
>> no reason to set mode->specified to false if no mode_option is present.
>>
> 
> Hm I'd keep that part, just for safety. It's not really a performance
> critical path really ...

But we do not explicitly set bpp_specified or refresh_specified to false
ever. So this is inconsistent, which bugs me :)

Alternative proposal: Add an explicit memset(..., 0, ...) at the top of
the function to make sure that we clear everything and not just 1 of
the 3 specified flags.

Regards,

Hans




> -Daniel
> 
>> 2) fb_get_options() will return fb_mode_option if no video=<connector-name>
>> argument is present on the kernel commandline, so there is no need to also
>> do this in drm_mode_parse_command_line_for_connector() as our only caller
>> uses fb_get_options() to get the mode_option argument.
>>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>>   drivers/gpu/drm/drm_modes.c | 7 -------
>>   1 file changed, 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
>> index 119fed7ab815..0bf3cb8c08ff 100644
>> --- a/drivers/gpu/drm/drm_modes.c
>> +++ b/drivers/gpu/drm/drm_modes.c
>> @@ -1747,15 +1747,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
>>   
>>   	mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
>>   
>> -#ifdef CONFIG_FB
>>   	if (!mode_option)
>> -		mode_option = fb_mode_option;
>> -#endif
>> -
>> -	if (!mode_option) {
>> -		mode->specified = false;
>>   		return false;
>> -	}
>>   
>>   	name = mode_option;
>>   
>> -- 
>> 2.23.0
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 



More information about the dri-devel mailing list