From: Bjorn Helgaas <helgaas@kernel.org>
To: "Krzysztof Wilczyński" <kw@linux.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Scott Murray <scott@spiteful.org>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: cpcihp: Move declaration of cpci_debug to the header file
Date: Thu, 1 Jul 2021 12:56:39 -0500 [thread overview]
Message-ID: <20210701175639.GA73684@bjorn-Precision-5520> (raw)
In-Reply-To: <20210510024529.3221347-1-kw@linux.com>
On Mon, May 10, 2021 at 02:45:29AM +0000, Krzysztof Wilczyński wrote:
> At the moment, the global variable cpci_debug is declared in the
> cpci_hotplug_core.c file. Since this variable has users outside of this
> file and uses the extern keyword to change its visibility, move the
> variable declaration to the header file.
>
> This resolves the following sparse warning:
>
> drivers/pci/hotplug/cpci_hotplug_core.c:47:5: warning: symbol 'cpci_debug' was not declared. Should it be static?
>
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
> ---
> drivers/pci/hotplug/cpci_hotplug.h | 3 +++
> drivers/pci/hotplug/cpci_hotplug_core.c | 1 -
> drivers/pci/hotplug/cpci_hotplug_pci.c | 2 --
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
> index f33ff2bca414..3fdd1b9bd8c3 100644
> --- a/drivers/pci/hotplug/cpci_hotplug.h
> +++ b/drivers/pci/hotplug/cpci_hotplug.h
> @@ -75,6 +75,9 @@ int cpci_hp_unregister_bus(struct pci_bus *bus);
> int cpci_hp_start(void);
> int cpci_hp_stop(void);
>
> +/* Global variables */
> +extern int cpci_debug;
> +
> /*
> * Internal function prototypes, these functions should not be used by
> * board/chassis drivers.
> diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
> index d0559d2faf50..7a78e6340291 100644
> --- a/drivers/pci/hotplug/cpci_hotplug_core.c
> +++ b/drivers/pci/hotplug/cpci_hotplug_core.c
> @@ -44,7 +44,6 @@ static DECLARE_RWSEM(list_rwsem);
> static LIST_HEAD(slot_list);
> static int slots;
> static atomic_t extracting;
> -int cpci_debug;
We can add a declaration, but we still need a *definition* somewhere,
right?
drivers/pci/hotplug/ has several drivers that are split over multiple
files. IMHO there is zero benefit to splitting them into multiple
files and one of the downsides is things like this that shouldn't be
global, but are global because of the split.
Not sure it's worth the churn of squashing them together, at least for
ancient things like this. pciehp is a perennial thorn in my side,
though. Every time I look for something, I try two or three files
before finding the right one.
> static struct cpci_hp_controller *controller;
> static struct task_struct *cpci_thread;
> static int thread_finished;
> diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
> index 2c16adb7f4ec..6c48066acb44 100644
> --- a/drivers/pci/hotplug/cpci_hotplug_pci.c
> +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
> @@ -19,8 +19,6 @@
>
> #define MY_NAME "cpci_hotplug"
>
> -extern int cpci_debug;
> -
> #define dbg(format, arg...) \
> do { \
> if (cpci_debug) \
> --
> 2.31.1
>
next prev parent reply other threads:[~2021-07-01 17:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 2:45 [PATCH] PCI: cpcihp: Move declaration of cpci_debug to the header file Krzysztof Wilczyński
2021-07-01 17:56 ` Bjorn Helgaas [this message]
2021-07-01 18:41 ` Krzysztof Wilczyński
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=20210701175639.GA73684@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=scott@spiteful.org \
/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