* [U-Boot] [U-boot] [Patch] keystone2: replace printf on puts where it's possible
@ 2014-11-03 23:44 Ivan Khoronzhuk
2014-11-04 16:46 ` Tom Rini
0 siblings, 1 reply; 3+ messages in thread
From: Ivan Khoronzhuk @ 2014-11-03 23:44 UTC (permalink / raw)
To: u-boot
It is better to use simple puts() function instead of printf()
when it's possible. Also remove redundant sprintf().
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
arch/arm/cpu/armv7/keystone/ddr3.c | 2 +-
arch/arm/cpu/armv7/keystone/keystone.c | 4 ++--
board/ti/ks2_evm/board.c | 7 ++-----
board/ti/ks2_evm/ddr3_k2e.c | 4 ++--
board/ti/ks2_evm/ddr3_k2hk.c | 10 +++++-----
board/ti/ks2_evm/ddr3_k2l.c | 2 +-
6 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/arch/arm/cpu/armv7/keystone/ddr3.c b/arch/arm/cpu/armv7/keystone/ddr3.c
index 923906a..3e65c2e 100644
--- a/arch/arm/cpu/armv7/keystone/ddr3.c
+++ b/arch/arm/cpu/armv7/keystone/ddr3.c
@@ -352,7 +352,7 @@ void ddr3_err_reset_workaround(void)
tmp_b = __raw_readl(KS2_DDR3B_DDRPHYC + KS2_DDRPHY_PGSR0_OFFSET);
if (((tmp_a & 0x0FE00000) != 0) || ((tmp_b & 0x0FE00000) != 0)) {
- printf("DDR Leveling Error Detected!\n");
+ puts("DDR Leveling Error Detected!\n");
printf("DDR3A PGSR0 = 0x%x\n", tmp_a);
printf("DDR3B PGSR0 = 0x%x\n", tmp_b);
diff --git a/arch/arm/cpu/armv7/keystone/keystone.c b/arch/arm/cpu/armv7/keystone/keystone.c
index 11a9357..52cb6fc 100644
--- a/arch/arm/cpu/armv7/keystone/keystone.c
+++ b/arch/arm/cpu/armv7/keystone/keystone.c
@@ -32,7 +32,7 @@ int cpu_to_bus(u32 *ptr, u32 length)
static int turn_off_myself(void)
{
- printf("Turning off ourselves\r\n");
+ puts("Turning off ourselves\r\n");
mon_power_off(0);
psc_disable_module(KS2_LPSC_TETRIS);
@@ -42,7 +42,7 @@ static int turn_off_myself(void)
"dsb\n"
"wfi\n");
- printf("What! Should not see that\n");
+ puts("What! Should not see that\n");
return 0;
}
diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
index 4029493..ff7bc4b 100644
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -122,7 +122,6 @@ void ft_board_setup(void *blob, bd_t *bd)
int nbanks;
u64 size[2];
u64 start[2];
- char name[32];
int nodeoffset;
u32 ddr3a_size;
int unitrd_fixup = 0;
@@ -158,15 +157,13 @@ void ft_board_setup(void *blob, bd_t *bd)
}
/* reserve memory at start of bank */
- sprintf(name, "mem_reserve_head");
- env = getenv(name);
+ env = getenv("mem_reserve_head");
if (env) {
start[0] += ustrtoul(env, &endp, 0);
size[0] -= ustrtoul(env, &endp, 0);
}
- sprintf(name, "mem_reserve");
- env = getenv(name);
+ env = getenv("mem_reserve");
if (env)
size[0] -= ustrtoul(env, &endp, 0);
diff --git a/board/ti/ks2_evm/ddr3_k2e.c b/board/ti/ks2_evm/ddr3_k2e.c
index 40fd966..3f100ed 100644
--- a/board/ti/ks2_evm/ddr3_k2e.c
+++ b/board/ti/ks2_evm/ddr3_k2e.c
@@ -31,7 +31,7 @@ void ddr3_init(void)
if (!strcmp(dimm_name, "18KSF1G72HZ-1G6E2 ")) {
/* 8G SO-DIMM */
ddr3_size = 8;
- printf("DRAM: 8 GiB\n");
+ puts("DRAM: 8 GiB\n");
ddr3phy_1600_8g.zq0cr1 |= 0x10000;
ddr3phy_1600_8g.zq1cr1 |= 0x10000;
ddr3phy_1600_8g.zq2cr1 |= 0x10000;
@@ -40,7 +40,7 @@ void ddr3_init(void)
} else if (!strcmp(dimm_name, "18KSF51272HZ-1G6K2")) {
/* 4G SO-DIMM */
ddr3_size = 4;
- printf("DRAM: 4 GiB\n");
+ puts("DRAM: 4 GiB\n");
ddr3_init_ddrphy(KS2_DDR3A_DDRPHYC, &ddr3phy_1600_4g);
ddr3_init_ddremif(KS2_DDR3A_EMIF_CTRL_BASE, &ddr3_1600_4g);
}
diff --git a/board/ti/ks2_evm/ddr3_k2hk.c b/board/ti/ks2_evm/ddr3_k2hk.c
index a1c3d05..115aed7 100644
--- a/board/ti/ks2_evm/ddr3_k2hk.c
+++ b/board/ti/ks2_evm/ddr3_k2hk.c
@@ -45,14 +45,14 @@ void ddr3_init(void)
ddr3_init_ddremif(KS2_DDR3A_EMIF_CTRL_BASE,
&ddr3_1600_8g);
- printf("DRAM: Capacity 8 GiB (includes reported below)\n");
+ puts("DRAM: Capacity 8 GiB (includes reported below)\n");
ddr3_size = 8;
} else {
ddr3_init_ddrphy(KS2_DDR3A_DDRPHYC, &ddr3phy_1600_8g);
ddr3_1600_8g.sdcfg |= 0x1000;
ddr3_init_ddremif(KS2_DDR3A_EMIF_CTRL_BASE,
&ddr3_1600_8g);
- printf("DRAM: Capacity 4 GiB (includes reported below)\n");
+ puts("DRAM: Capacity 4 GiB (includes reported below)\n");
ddr3_size = 4;
}
} else if (!strcmp(dimm_name, "SQR-SD3T-2G1333SED")) {
@@ -75,17 +75,17 @@ void ddr3_init(void)
ddr3_init_ddremif(KS2_DDR3A_EMIF_CTRL_BASE,
&ddr3_1333_2g);
ddr3_size = 2;
- printf("DRAM: 2 GiB");
+ puts("DRAM: 2 GiB\n");
} else {
ddr3_init_ddrphy(KS2_DDR3A_DDRPHYC, &ddr3phy_1333_2g);
ddr3_1333_2g.sdcfg |= 0x1000;
ddr3_init_ddremif(KS2_DDR3A_EMIF_CTRL_BASE,
&ddr3_1333_2g);
ddr3_size = 1;
- printf("DRAM: 1 GiB");
+ puts("DRAM: 1 GiB\n");
}
} else {
- printf("Unknown SO-DIMM. Cannot configure DDR3\n");
+ puts("Unknown SO-DIMM. Cannot configure DDR3\n");
while (1)
;
}
diff --git a/board/ti/ks2_evm/ddr3_k2l.c b/board/ti/ks2_evm/ddr3_k2l.c
index 15a14f2..32fb4b7 100644
--- a/board/ti/ks2_evm/ddr3_k2l.c
+++ b/board/ti/ks2_evm/ddr3_k2l.c
@@ -19,7 +19,7 @@ void ddr3_init(void)
init_pll(&ddr3_400);
/* No SO-DIMM, 2GB discreet DDR */
- printf("DRAM: 2 GiB\n");
+ puts("DRAM: 2 GiB\n");
ddr3_size = 2;
/* Reset DDR3 PHY after PLL enabled */
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [U-boot] [Patch] keystone2: replace printf on puts where it's possible
2014-11-03 23:44 [U-Boot] [U-boot] [Patch] keystone2: replace printf on puts where it's possible Ivan Khoronzhuk
@ 2014-11-04 16:46 ` Tom Rini
2014-11-04 17:05 ` Ivan Khoronzhuk
0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2014-11-04 16:46 UTC (permalink / raw)
To: u-boot
On Tue, Nov 04, 2014 at 01:44:53AM +0200, Ivan Khoronzhuk wrote:
> It is better to use simple puts() function instead of printf()
> when it's possible. Also remove redundant sprintf().
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
One of the outcomes of the mini-summit and I think was summarized on the
list as well was that we're going to stop with the "use puts instead of
printf!" thing as it ends up being more annoying to contributors than
useful in terms of functionality and code size.
> diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
> index 4029493..ff7bc4b 100644
> --- a/board/ti/ks2_evm/board.c
> +++ b/board/ti/ks2_evm/board.c
> @@ -122,7 +122,6 @@ void ft_board_setup(void *blob, bd_t *bd)
> int nbanks;
> u64 size[2];
> u64 start[2];
> - char name[32];
> int nodeoffset;
> u32 ddr3a_size;
> int unitrd_fixup = 0;
> @@ -158,15 +157,13 @@ void ft_board_setup(void *blob, bd_t *bd)
> }
>
> /* reserve memory at start of bank */
> - sprintf(name, "mem_reserve_head");
> - env = getenv(name);
> + env = getenv("mem_reserve_head");
> if (env) {
> start[0] += ustrtoul(env, &endp, 0);
> size[0] -= ustrtoul(env, &endp, 0);
> }
>
> - sprintf(name, "mem_reserve");
> - env = getenv(name);
> + env = getenv("mem_reserve");
> if (env)
> size[0] -= ustrtoul(env, &endp, 0);
This is good to fix however.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141104/74beee07/attachment.pgp>
^ permalink raw reply [flat|nested] 3+ messages in thread* [U-Boot] [U-boot] [Patch] keystone2: replace printf on puts where it's possible
2014-11-04 16:46 ` Tom Rini
@ 2014-11-04 17:05 ` Ivan Khoronzhuk
0 siblings, 0 replies; 3+ messages in thread
From: Ivan Khoronzhuk @ 2014-11-04 17:05 UTC (permalink / raw)
To: u-boot
On 11/04/2014 06:46 PM, Tom Rini wrote:
> On Tue, Nov 04, 2014 at 01:44:53AM +0200, Ivan Khoronzhuk wrote:
>
>> It is better to use simple puts() function instead of printf()
>> when it's possible. Also remove redundant sprintf().
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> One of the outcomes of the mini-summit and I think was summarized on the
> list as well was that we're going to stop with the "use puts instead of
> printf!" thing as it ends up being more annoying to contributors than
> useful in terms of functionality and code size.
>
>> diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
>> index 4029493..ff7bc4b 100644
>> --- a/board/ti/ks2_evm/board.c
>> +++ b/board/ti/ks2_evm/board.c
>> @@ -122,7 +122,6 @@ void ft_board_setup(void *blob, bd_t *bd)
>> int nbanks;
>> u64 size[2];
>> u64 start[2];
>> - char name[32];
>> int nodeoffset;
>> u32 ddr3a_size;
>> int unitrd_fixup = 0;
>> @@ -158,15 +157,13 @@ void ft_board_setup(void *blob, bd_t *bd)
>> }
>>
>> /* reserve memory at start of bank */
>> - sprintf(name, "mem_reserve_head");
>> - env = getenv(name);
>> + env = getenv("mem_reserve_head");
>> if (env) {
>> start[0] += ustrtoul(env, &endp, 0);
>> size[0] -= ustrtoul(env, &endp, 0);
>> }
>>
>> - sprintf(name, "mem_reserve");
>> - env = getenv(name);
>> + env = getenv("mem_reserve");
>> if (env)
>> size[0] -= ustrtoul(env, &endp, 0);
> This is good to fix however.
>
Ok,
Reject this patch.
I will send new patch that delete only sprintf.
Thanks!
--
Regards,
Ivan Khoronzhuk
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-04 17:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03 23:44 [U-Boot] [U-boot] [Patch] keystone2: replace printf on puts where it's possible Ivan Khoronzhuk
2014-11-04 16:46 ` Tom Rini
2014-11-04 17:05 ` Ivan Khoronzhuk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox