Re: [PATCH] PCI: Move static keyword to the front of declarations in pci-bridge-emul.c

From: Bjorn Helgaas
Date: Tue Aug 27 2019 - 19:30:20 EST


[+cc Thomas]

On Mon, Aug 26, 2019 at 05:14:36PM +0200, Krzysztof Wilczynski wrote:
> Move the static keyword to the front of declarations of
> pci_regs_behavior and pcie_cap_regs_behavior, and resolve
> compiler warning that can be seen when building with
> warnings enabled (W=1).

It would be useful to include the compiler warning in the commit log.

I notice there are a few similar occurrences elsewhere in the tree:

arch/csky/kernel/perf_event.c:const static struct of_device_id csky_pmu_of_device_ids[] = {
arch/nds32/kernel/perf_event_cpu.c:const static struct of_device_id cpu_pmu_of_device_ids[] = {
drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static struct msm_dsi_host_cfg_ops msm_dsi_v2_host_ops = {
drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static struct msm_dsi_host_cfg_ops msm_dsi_6g_host_ops = {
drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops = {
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:const static struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = {
fs/unicode/utf8-selftest.c:const static struct {
fs/unicode/utf8-selftest.c:const static struct {

Those should probably be fixed, too (but in separate patches since
other maintainers would take them).

> Signed-off-by: Krzysztof Wilczynski <kw@xxxxxxxxx>
> ---
> drivers/pci/pci-bridge-emul.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c
> index 06083b86d4f4..5fd90105510d 100644
> --- a/drivers/pci/pci-bridge-emul.c
> +++ b/drivers/pci/pci-bridge-emul.c
> @@ -38,7 +38,7 @@ struct pci_bridge_reg_behavior {
> u32 rsvd;
> };
>
> -const static struct pci_bridge_reg_behavior pci_regs_behavior[] = {
> +static const struct pci_bridge_reg_behavior pci_regs_behavior[] = {
> [PCI_VENDOR_ID / 4] = { .ro = ~0 },
> [PCI_COMMAND / 4] = {
> .rw = (PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
> @@ -173,7 +173,7 @@ const static struct pci_bridge_reg_behavior pci_regs_behavior[] = {
> },
> };
>
> -const static struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
> +static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
> [PCI_CAP_LIST_ID / 4] = {
> /*
> * Capability ID, Next Capability Pointer and
> --
> 2.22.1
>