From: Tom Rini <trini@konsulko.com>
To: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
Joe Hershberger <joe.hershberger@ni.com>,
Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@denx.de>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>,
Ramon Fried <rfried.dev@gmail.com>,
Roman Stratiienko <r.stratiienko@gmail.com>,
Sean Anderson <seanga2@gmail.com>, Simon Glass <sjg@chromium.org>,
Stefan Roese <sr@denx.de>,
U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH] fastboot: remove #ifdef CONFIG when it is possible
Date: Fri, 6 Jan 2023 09:31:47 -0500 [thread overview]
Message-ID: <20230106143147.GT3787616@bill-the-cat> (raw)
In-Reply-To: <89f414c5-306d-8a10-9a72-f32381ec593e@foss.st.com>
[-- Attachment #1: Type: text/plain, Size: 2797 bytes --]
On Thu, Jan 05, 2023 at 12:37:58PM +0100, Patrick DELAUNAY wrote:
> Hi Tom,
>
> On 1/3/23 21:35, Tom Rini wrote:
> > On Thu, Dec 15, 2022 at 10:15:50AM +0100, Patrick Delaunay wrote:
> > > Much of the fastboot code predates the introduction of Kconfig and
> > > has quite a few #ifdefs in it which is unnecessary now that we can use
> > > IS_ENABLED() et al.
> > >
> > > Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> > > ---
> > >
> > > cmd/fastboot.c | 35 +++++------
> > > drivers/fastboot/fb_command.c | 104 ++++++++++++--------------------
> > > drivers/fastboot/fb_common.c | 11 ++--
> > > drivers/fastboot/fb_getvar.c | 49 ++++++---------
> > > drivers/usb/gadget/f_fastboot.c | 7 +--
> > > include/fastboot.h | 13 ----
> > > net/fastboot.c | 8 +--
> > > 7 files changed, 82 insertions(+), 145 deletions(-)
> > >
> > > diff --git a/cmd/fastboot.c b/cmd/fastboot.c
> > > index b498e4b22bb3..b94dbd548843 100644
> > > --- a/cmd/fastboot.c
> > > +++ b/cmd/fastboot.c
> > > @@ -19,8 +19,14 @@
> > > static int do_fastboot_udp(int argc, char *const argv[],
> > > uintptr_t buf_addr, size_t buf_size)
> > > {
> > > -#if CONFIG_IS_ENABLED(UDP_FUNCTION_FASTBOOT)
> > > - int err = net_loop(FASTBOOT);
> > > + int err;
> > > +
> > > + if (!CONFIG_IS_ENABLED(UDP_FUNCTION_FASTBOOT)) {
> > > + pr_err("Fastboot UDP not enabled\n");
> > > + return CMD_RET_FAILURE;
> > > + }
> > > +
> > > + err = net_loop(FASTBOOT);
> > > if (err < 0) {
> > > printf("fastboot udp error: %d\n", err);
> > > @@ -28,21 +34,21 @@ static int do_fastboot_udp(int argc, char *const argv[],
> > > }
> > > return CMD_RET_SUCCESS;
> > > -#else
> > > - pr_err("Fastboot UDP not enabled\n");
> > > - return CMD_RET_FAILURE;
> > > -#endif
> > > }
> > This probably needs to become an if (CONFIG_IS_ENABLED(...)) { ... }
> > else { ... } in order to remain size-neutral.
>
>
> Are you sure ?
>
>
> {
> if (!CONFIG_IS_ENABLED(UDP_FUNCTION_FASTBOOT)) {
> ....
> return CMD_RET_FAILURE;
> }
>
> ....
>
> return CMD_RET_SUCCESS;
> }
>
>
> For me, it is exactly the same size after compiler/linker than :
>
>
> {
> if (!CONFIG_IS_ENABLED(UDP_FUNCTION_FASTBOOT)) {
> ....
> return CMD_RET_FAILURE;
> } else {
> ....
> return CMD_RET_SUCCESS;
>
> }
>
> }
>
>
> if UDP_FUNCTION_FASTBOOTis activated or not....
>
> or I forget something during the Christmas break.
If you've size-tested and it's the same, OK. I'm just worried about
strings not being discarded since that's sometimes an unexpected side
effect / bug.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2023-01-06 14:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 9:15 [PATCH] fastboot: remove #ifdef CONFIG when it is possible Patrick Delaunay
2022-12-15 13:45 ` Mattijs Korpershoek
2022-12-16 7:50 ` Mattijs Korpershoek
2022-12-15 14:30 ` Marek Vasut
2022-12-15 15:37 ` Sean Anderson
2022-12-15 15:40 ` Sean Anderson
2023-01-03 12:39 ` Patrick DELAUNAY
2023-01-03 20:35 ` Tom Rini
2023-01-05 11:37 ` Patrick DELAUNAY
2023-01-06 14:31 ` Tom Rini [this message]
2023-01-12 15:18 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230106143147.GT3787616@bill-the-cat \
--to=trini@konsulko.com \
--cc=joe.hershberger@ni.com \
--cc=lukma@denx.de \
--cc=marex@denx.de \
--cc=mkorpershoek@baylibre.com \
--cc=patrick.delaunay@foss.st.com \
--cc=r.stratiienko@gmail.com \
--cc=rfried.dev@gmail.com \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
--cc=uboot-stm32@st-md-mailman.stormreply.com \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox