diff mbox series

[06/11] lib/sha*.c: Update header list

Message ID 20231122131154.2444690-6-trini@konsulko.com
State Superseded
Delegated to: Tom Rini
Headers show
Series [01/11] global: Remove duplicate common.h inclusions | expand

Commit Message

Tom Rini Nov. 22, 2023, 1:11 p.m. UTC
Cleanup the list of headers we include here. For the tools build we only
need to exclude <cyclic.h> as that's used by the target build for the
prototype for schedule(), and we don't need to get that via
<watchdog.h>. We can also make use of our <string.h> intentionally
existing as a redirection to <linux/string.h> to reduce ifdef'd lines.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 lib/sha1.c   | 7 ++-----
 lib/sha256.c | 7 ++-----
 lib/sha512.c | 6 +-----
 3 files changed, 5 insertions(+), 15 deletions(-)

Comments

Simon Glass Dec. 2, 2023, 6:23 p.m. UTC | #1
Hi Tom,

On Wed, 22 Nov 2023 at 06:12, Tom Rini <trini@konsulko.com> wrote:
>
> Cleanup the list of headers we include here. For the tools build we only
> need to exclude <cyclic.h> as that's used by the target build for the
> prototype for schedule(), and we don't need to get that via
> <watchdog.h>. We can also make use of our <string.h> intentionally
> existing as a redirection to <linux/string.h> to reduce ifdef'd lines.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  lib/sha1.c   | 7 ++-----
>  lib/sha256.c | 7 ++-----
>  lib/sha512.c | 6 +-----
>  3 files changed, 5 insertions(+), 15 deletions(-)

As mentioned in my series this will prevent dropping the #ifdefs in this file:

#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)

Actually I see that I didn't send the v2 so I just did that now[1].

Regards,
Simon

[1] https://patchwork.ozlabs.org/project/uboot/patch/20231202153400.537050-2-sjg@chromium.org/
Tom Rini Dec. 9, 2023, 3:48 p.m. UTC | #2
On Sat, Dec 02, 2023 at 11:23:13AM -0700, Simon Glass wrote:
> Hi Tom,
> 
> On Wed, 22 Nov 2023 at 06:12, Tom Rini <trini@konsulko.com> wrote:
> >
> > Cleanup the list of headers we include here. For the tools build we only
> > need to exclude <cyclic.h> as that's used by the target build for the
> > prototype for schedule(), and we don't need to get that via
> > <watchdog.h>. We can also make use of our <string.h> intentionally
> > existing as a redirection to <linux/string.h> to reduce ifdef'd lines.
> >
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> >  lib/sha1.c   | 7 ++-----
> >  lib/sha256.c | 7 ++-----
> >  lib/sha512.c | 6 +-----
> >  3 files changed, 5 insertions(+), 15 deletions(-)
> 
> As mentioned in my series this will prevent dropping the #ifdefs in this file:
> 
> #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
> 
> Actually I see that I didn't send the v2 so I just did that now[1].
> 
> Regards,
> Simon
> 
> [1] https://patchwork.ozlabs.org/project/uboot/patch/20231202153400.537050-2-sjg@chromium.org/

Yes, I prefer what I did here instead of [1].
diff mbox series

Patch

diff --git a/lib/sha1.c b/lib/sha1.c
index 8d0740789349..7ef536f4b5db 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -17,12 +17,9 @@ 
 #endif
 
 #ifndef USE_HOSTCC
-#include <common.h>
-#include <linux/string.h>
-#else
-#include <string.h>
+#include <cyclic.h>
 #endif /* USE_HOSTCC */
-#include <watchdog.h>
+#include <string.h>
 #include <u-boot/sha1.h>
 
 #include <linux/compiler_attributes.h>
diff --git a/lib/sha256.c b/lib/sha256.c
index 4d26aea1c8ce..665ba6f152e5 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -6,12 +6,9 @@ 
  */
 
 #ifndef USE_HOSTCC
-#include <common.h>
-#include <linux/string.h>
-#else
-#include <string.h>
+#include <cyclic.h>
 #endif /* USE_HOSTCC */
-#include <watchdog.h>
+#include <string.h>
 #include <u-boot/sha256.h>
 
 #include <linux/compiler_attributes.h>
diff --git a/lib/sha512.c b/lib/sha512.c
index fbe8d5f5bfe9..ffe2c5cd9642 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -11,13 +11,9 @@ 
  */
 
 #ifndef USE_HOSTCC
-#include <common.h>
-#include <linux/string.h>
-#else
-#include <string.h>
+#include <cyclic.h>
 #endif /* USE_HOSTCC */
 #include <compiler.h>
-#include <watchdog.h>
 #include <u-boot/sha512.h>
 
 const uint8_t sha384_der_prefix[SHA384_DER_LEN] = {