arm64: zynqmp: Get rid of simple_itoa and replace it by snprintf
simple_itoa() is implemented only for !CONFIG_USE_TINY_PRINTF. Tiny printf
is normally used by SPL that's code which uses simple_itoa() has missing
reference. That's why refactor code by using on snprintf() instead of
strncpy()/strncat() combination. This change also descrease code size by
saving 24B based on buildman.
aarch64: (for 1/1 boards) all -22.0 rodata +2.0 text -24.0
         xilinx_zynqmp_virt: all -22 rodata +2 text -24
            u-boot: add: 0/0, grow: 0/-1 bytes: 0/-24 (-24)
              function                                   old     new   delta
              board_init                                 520     496     -24
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
			
			
This commit is contained in:
		
							parent
							
								
									f08d0c51b5
								
							
						
					
					
						commit
						0d76b71d93
					
				| 
						 | 
					@ -190,6 +190,7 @@ static char *zynqmp_get_silicon_idcode_name(void)
 | 
				
			||||||
	u32 idcode, idcode2;
 | 
						u32 idcode, idcode2;
 | 
				
			||||||
	char name[ZYNQMP_VERSION_SIZE];
 | 
						char name[ZYNQMP_VERSION_SIZE];
 | 
				
			||||||
	u32 ret_payload[PAYLOAD_ARG_CNT];
 | 
						u32 ret_payload[PAYLOAD_ARG_CNT];
 | 
				
			||||||
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
 | 
						xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -216,8 +217,10 @@ static char *zynqmp_get_silicon_idcode_name(void)
 | 
				
			||||||
		return "unknown";
 | 
							return "unknown";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Add device prefix to the name */
 | 
						/* Add device prefix to the name */
 | 
				
			||||||
	strncpy(name, "zu", ZYNQMP_VERSION_SIZE);
 | 
						ret = snprintf(name, ZYNQMP_VERSION_SIZE, "zu%d",
 | 
				
			||||||
	strncat(&name[2], simple_itoa(zynqmp_devices[i].device), 2);
 | 
							       zynqmp_devices[i].device);
 | 
				
			||||||
 | 
						if (ret <= 0)
 | 
				
			||||||
 | 
							return "unknown";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_EV) {
 | 
						if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_EV) {
 | 
				
			||||||
		/* Devices with EV variant might be EG/CG/EV family */
 | 
							/* Devices with EV variant might be EG/CG/EV family */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue