From: "Jernej Škrabec" <jernej.skrabec@gmail.com>
To: Jagan Teki <jagan@amarulasolutions.com>,
Mikhail Kalashnikov <iuncuim@gmail.com>,
Andre Przywara <andre.przywara@arm.com>
Cc: Samuel Holland <samuel@sholland.org>,
Icenowy Zheng <uwu@icenowy.me>,
Piotr Oniszczuk <piotr.oniszczuk@gmail.com>,
u-boot@lists.denx.de, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 1/5] sunxi: dram: make MBUS configuration functions static
Date: Fri, 09 Jun 2023 22:24:18 +0200 [thread overview]
Message-ID: <5943646.lOV4Wx5bFT@jernej-laptop> (raw)
In-Reply-To: <20230607000745.10245-2-andre.przywara@arm.com>
Dne sreda, 07. junij 2023 ob 02:07:41 CEST je Andre Przywara napisal(a):
> The usage of the C keyword "inline" seems to be a common
> misunderstanding: it's a *hint* only, and modern compilers will inline
> (or not) functions based on their own judgement and provided compiler
> options.
> So while marking functions as "inline" does not do much, missing the
> "static" keyword will force to compiler to spell out a version of the
> function for potential external callers, which actually increases the
> code size (though hopefully the linker will drop the function).
>
> Change the "inline" attribute for the mbus_configure_port() functions in
> some Allwinner DRAM drivers to "static", so that the explicit version
> can actually be dropped from the object file, reducing the code size.
>
> "static inline" has a use case in header files, where it avoids a warning
> if a .c file including this header does not use the particular function.
> In a .c file itself "static inline" is not useful otherwise, so just use
> static here as well.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Nice catch! Could it be put into common functions? These functions look the
same. Anyway:
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> arch/arm/mach-sunxi/dram_sun50i_h6.c | 3 ++-
> arch/arm/mach-sunxi/dram_sun50i_h616.c | 2 +-
> arch/arm/mach-sunxi/dram_sunxi_dw.c | 18 +++++++++---------
> 3 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/mach-sunxi/dram_sun50i_h6.c b/arch/arm/mach-sunxi/dram_sun50i_h6.c
> index b332f3a3e4a..bff2e42513c 100644
> --- a/arch/arm/mach-sunxi/dram_sun50i_h6.c
> +++ b/arch/arm/mach-sunxi/dram_sun50i_h6.c
> @@ -93,7 +93,8 @@ enum {
> MBUS_QOS_HIGH,
> MBUS_QOS_HIGHEST
> };
> -inline void mbus_configure_port(u8 port,
> +
> +static void mbus_configure_port(u8 port,
> bool bwlimit,
> bool priority,
> u8 qos,
> diff --git a/arch/arm/mach-sunxi/dram_sun50i_h616.c b/arch/arm/mach-sunxi/dram_sun50i_h616.c
> index 1f9416d6eaf..02f6b2a06d4 100644
> --- a/arch/arm/mach-sunxi/dram_sun50i_h616.c
> +++ b/arch/arm/mach-sunxi/dram_sun50i_h616.c
> @@ -31,7 +31,7 @@ enum {
> MBUS_QOS_HIGHEST
> };
>
> -inline void mbus_configure_port(u8 port,
> +static void mbus_configure_port(u8 port,
> bool bwlimit,
> bool priority,
> u8 qos,
> diff --git a/arch/arm/mach-sunxi/dram_sunxi_dw.c b/arch/arm/mach-sunxi/dram_sunxi_dw.c
> index 4af5922f334..9382d3d0be8 100644
> --- a/arch/arm/mach-sunxi/dram_sunxi_dw.c
> +++ b/arch/arm/mach-sunxi/dram_sunxi_dw.c
> @@ -81,15 +81,15 @@ enum {
> MBUS_QOS_HIGHEST
> };
>
> -static inline void mbus_configure_port(u8 port,
> - bool bwlimit,
> - bool priority,
> - u8 qos, /* MBUS_QOS_LOWEST .. MBUS_QOS_HIGEST */
> - u8 waittime, /* 0 .. 0xf */
> - u8 acs, /* 0 .. 0xff */
> - u16 bwl0, /* 0 .. 0xffff, bandwidth limit in MB/s */
> - u16 bwl1,
> - u16 bwl2)
> +static void mbus_configure_port(u8 port,
> + bool bwlimit,
> + bool priority,
> + u8 qos, /* MBUS_QOS_LOWEST .. MBUS_QOS_HIGEST */
> + u8 waittime, /* 0 .. 0xf */
> + u8 acs, /* 0 .. 0xff */
> + u16 bwl0, /* 0 .. 0xffff, bandwidth limit in MB/s */
> + u16 bwl1,
> + u16 bwl2)
> {
> struct sunxi_mctl_com_reg * const mctl_com =
> (struct sunxi_mctl_com_reg *)SUNXI_DRAM_COM_BASE;
>
next prev parent reply other threads:[~2023-06-09 20:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 0:07 [PATCH 0/5] sunxi: H616: improve DRAM setup and add LPDDR3 support Andre Przywara
2023-06-07 0:07 ` [PATCH 1/5] sunxi: dram: make MBUS configuration functions static Andre Przywara
2023-06-09 20:24 ` Jernej Škrabec [this message]
2023-06-07 0:07 ` [PATCH 2/5] sunxi: H616: dram: const-ify DRAM function parameters Andre Przywara
2023-06-09 20:24 ` Jernej Škrabec
2023-06-07 0:07 ` [PATCH 3/5] sunxi: H616: dram: split struct dram_para Andre Przywara
2023-06-09 20:26 ` Jernej Škrabec
2023-06-09 22:48 ` Andre Przywara
2023-06-07 0:07 ` [PATCH 4/5] sunxi: H616: add DRAM type selection Andre Przywara
2023-06-09 20:29 ` Jernej Škrabec
2023-06-07 0:07 ` [PATCH 5/5] sunxi: H616: add LPDDR3 DRAM support Andre Przywara
2023-06-09 20:38 ` Jernej Škrabec
2023-06-09 21:15 ` Andre Przywara
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=5943646.lOV4Wx5bFT@jernej-laptop \
--to=jernej.skrabec@gmail.com \
--cc=andre.przywara@arm.com \
--cc=iuncuim@gmail.com \
--cc=jagan@amarulasolutions.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=piotr.oniszczuk@gmail.com \
--cc=samuel@sholland.org \
--cc=u-boot@lists.denx.de \
--cc=uwu@icenowy.me \
/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