From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: emxx_udc: Fix incorrectly defined global
Date: Sun, 7 Feb 2021 17:34:41 +1100 [thread overview]
Message-ID: <20210207173441.2902acac@canb.auug.org.au> (raw)
In-Reply-To: <20210207000030.256592-1-memxor@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2264 bytes --]
Hi Kumar,
On Sun, 7 Feb 2021 05:30:31 +0530 Kumar Kartikeya Dwivedi <memxor@gmail.com> wrote:
>
> The global gpio_desc pointer and int were defined in the header,
> instead put the definitions in the translation unit and add an extern
> declaration for consumers of the header (currently only one, which is
> perhaps why the linker didn't complain about symbol collisions).
>
> This fixes sparse related warnings for this driver:
> drivers/staging/emxx_udc/emxx_udc.c: note: in included file:
> drivers/staging/emxx_udc/emxx_udc.h:23:18: warning: symbol 'vbus_gpio' was not declared. Should it be static?
> drivers/staging/emxx_udc/emxx_udc.h:24:5: warning: symbol 'vbus_irq' was not declared. Should it be static?
>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Given that drivers/staging/emxx_udc/emxx_udc.h is only included by
drivers/staging/emxx_udc/emxx_udc.c, shouldn't these variables just be
declared static in emxx_udc.c and removed from emxx_udc.h?
> ---
> drivers/staging/emxx_udc/emxx_udc.c | 3 +++
> drivers/staging/emxx_udc/emxx_udc.h | 4 ++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
> index a30b4f5b1..6983c3e31 100644
> --- a/drivers/staging/emxx_udc/emxx_udc.c
> +++ b/drivers/staging/emxx_udc/emxx_udc.c
> @@ -34,6 +34,9 @@
> #define DRIVER_DESC "EMXX UDC driver"
> #define DMA_ADDR_INVALID (~(dma_addr_t)0)
>
> +struct gpio_desc *vbus_gpio;
> +int vbus_irq;
> +
> static const char driver_name[] = "emxx_udc";
> static const char driver_desc[] = DRIVER_DESC;
>
> diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h
> index bca614d69..b3c4ccbe5 100644
> --- a/drivers/staging/emxx_udc/emxx_udc.h
> +++ b/drivers/staging/emxx_udc/emxx_udc.h
> @@ -20,8 +20,8 @@
> /* below hacked up for staging integration */
> #define GPIO_VBUS 0 /* GPIO_P153 on KZM9D */
> #define INT_VBUS 0 /* IRQ for GPIO_P153 */
> -struct gpio_desc *vbus_gpio;
> -int vbus_irq;
> +extern struct gpio_desc *vbus_gpio;
> +extern int vbus_irq;
>
> /*------------ Board dependence(Wait) */
>
> --
> 2.29.2
>
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-02-07 6:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-07 0:00 Kumar Kartikeya Dwivedi
2021-02-07 6:34 ` Stephen Rothwell [this message]
2021-02-07 7:38 ` Kumar Kartikeya Dwivedi
2021-02-07 8:33 ` Greg KH
2021-02-07 8:46 ` [PATCH v2] staging: emxx_udc: Make incorrectly defined global static Kumar Kartikeya Dwivedi
2021-02-07 8:51 ` Greg KH
2021-02-07 8:59 ` [PATCH v3] " Kumar Kartikeya Dwivedi
2021-02-07 9:18 ` Greg KH
2021-02-08 10:18 ` [PATCH] staging: emxx_udc: Fix incorrectly defined global Geert Uytterhoeven
2021-02-07 8:31 ` Greg KH
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=20210207173441.2902acac@canb.auug.org.au \
--to=sfr@canb.auug.org.au \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=memxor@gmail.com \
/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
all inboxes | Powered by JetHome®