@@ -305,6 +305,7 @@ static int rp1dpi_platform_probe(struct platform_device *pdev)
305305 struct drm_bridge * bridge = NULL ;
306306 const char * rgb_order = NULL ;
307307 struct drm_panel * panel ;
308+ u32 missing_gpios ;
308309 int i , j , ret ;
309310
310311 dev_info (dev , __func__ );
@@ -382,8 +383,8 @@ static int rp1dpi_platform_probe(struct platform_device *pdev)
382383 }
383384
384385 /* Check if all of GPIOs 1, 2 and 3 are assigned to DPI */
385- ret = 0 ;
386- for (i = 0 ; ret < 0xE ; i ++ ) {
386+ missing_gpios = BIT ( 1 ) | BIT ( 2 ) | BIT ( 3 ) ;
387+ for (i = 0 ; missing_gpios ; i ++ ) {
387388 u32 p = 0 ;
388389 const char * str = NULL ;
389390 struct device_node * np1 = of_parse_phandle (dev -> of_node , "pinctrl-0" , i );
@@ -392,26 +393,26 @@ static int rp1dpi_platform_probe(struct platform_device *pdev)
392393 break ;
393394
394395 if (!of_property_read_string (np1 , "function" , & str ) && !strcmp (str , "dpi" )) {
395- for (j = 0 ; ret < 0xE ; j ++ ) {
396+ for (j = 0 ; missing_gpios ; j ++ ) {
396397 if (of_property_read_string_index (np1 , "pins" , j , & str ))
397398 break ;
398399 if (!strcmp (str , "gpio1" ))
399- ret |= BIT (1 );
400+ missing_gpios &= ~ BIT (1 );
400401 else if (!strcmp (str , "gpio2" ))
401- ret |= BIT (2 );
402+ missing_gpios &= ~ BIT (2 );
402403 else if (!strcmp (str , "gpio3" ))
403- ret |= BIT (3 );
404+ missing_gpios &= ~ BIT (3 );
404405 }
405- for (j = 0 ; ret < 3 ; j ++ ) {
406+ for (j = 0 ; missing_gpios ; j ++ ) {
406407 if (of_property_read_u32_index (np1 , "brcm,pins" , j , & p ))
407408 break ;
408- if (p >= 1 && p <= 3 )
409- ret |= (1 << p );
409+ if (p < 32 )
410+ missing_gpios &= ~ (1 << p );
410411 }
411412 }
412413 of_node_put (np1 );
413414 }
414- dpi -> sync_gpios_mapped = ( ret >= 0xE ) ;
415+ dpi -> sync_gpios_mapped = ! missing_gpios ;
415416
416417 /* Now we have all our resources, finish driver initialization */
417418 dma_set_mask_and_coherent (dev , DMA_BIT_MASK (64 ));
0 commit comments