PCI: Move static keyword to the front of declarations in pci-bridge-emul.c
Subsystems (2)
PATCH 1/1 PCI: Move static keyword to the front of declarations in pci-bridge-emul.c
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).
--- drivers/pci/pci-bridge-emul.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pci-bridge-emul.c +2 -2
@@ -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
Signature · 1 line
2.22.1
[+cc Thomas]
Quoted 4 lines · Krzysztof Wilczynski
Move the static keyword to the front of declarations of
pci_regs_behaviorandpcie_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).
Quoted 30 lines
Signed-off-by Krzysztof Wilczynski <[email protected]>--- drivers/pci/pci-bridge-emul.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/pci/pci-bridge-emul.c +2
-2@@ -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 Signature · 1 line
2.22.1
Thomas Petazzoni
Acked-byHello,
Quoted 21 lines · On Tue, 27 Aug 2019 18:30:17 -0500 Bjorn Helgaas <[email protected]> wrote:
[+cc Thomas]
Quoted 4 lines · Krzysztof Wilczynski
Move the static keyword to the front of declarations of
pci_regs_behaviorandpcie_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 {
Quoted 4 lines
Those should probably be fixed, too (but in separate patches since other maintainers would take them).
Quoted 1 line
Signed-off-by Krzysztof Wilczynski <[email protected]>
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Hello Bjorn and Thomas,
Thank you for the feedback.
[...]
Quoted 6 lines
Quoted 4 lines
Move the static keyword to the front of declarations of
pci_regs_behaviorandpcie_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.
Good point. Sorry about that. I will send a v2 that includes updated commit message.
Quoted 17 lines
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 structof_device_id
cpu_pmu_of_device_ids[] = {
drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static structmsm_dsi_host_cfg_opsmsm_dsi_v2_host_ops= {
drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static structmsm_dsi_host_cfg_opsmsm_dsi_6g_host_ops= {
drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static structmsm_dsi_host_cfg_opsmsm_dsi_6g_v2_host_ops= {
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:const static
structwiphy_iftype_ext_capabhe_iftypes_ext_capa[] = {
fs/unicode/utf8-selftest.c:const static struct { fs/unicode/utf8-selftest.c:const static struct {
Quoted 2 lines
Those should probably be fixed, too (but in separate patches since other maintainers would take them).
I will take care about these too.
Krzysztof
PATCH v2 1/1 PCI: Move static keyword to the front of declarations in pci-bridge-emul.c
In reply to Krzysztof WilczynskiMove the static keyword to the front of declarations of pci_regs_behavior and pcie_cap_regs_behavior, and resolve the following compiler warning that can be seen when building with warnings enabled (W=1):
drivers/pci/pci-bridge-emul.c:41:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
const static struct pci_bridge_reg_behavior pci_regs_behavior[] = {
^drivers/pci/pci-bridge-emul.c:176:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
const static struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
^
---
Changes in v2:
Update commit message to include compiler warning.
drivers/pci/pci-bridge-emul.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pci-bridge-emul.c +2 -2
@@ -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
Signature · 1 line
2.22.1
Hello,
Quoted 5 lines · On Wed, 28 Aug 2019 15:17:33 +0200 Krzysztof Wilczynski <[email protected]> wrote:
Move the static keyword to the front of declarations of
pci_regs_behaviorandpcie_cap_regs_behavior, and resolve the following compiler warning that can be seen when building with warnings enabled (W=1):
Quoted 8 lines
drivers/pci/pci-bridge-emul.c:41:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
const static structpci_bridge_reg_behaviorpci_regs_behavior[] = {
^drivers/pci/pci-bridge-emul.c:176:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
const static structpci_bridge_reg_behaviorpcie_cap_regs_behavior[] = {
^Signed-off-by Krzysztof Wilczynski <[email protected]>
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com