Re: [2.6 patch] drivers/char/sonypi.c: make 3 structs static

From: Stelian Pop
Date: Mon Jan 31 2005 - 16:52:55 EST


On Mon, Jan 31, 2005 at 06:35:08PM +0100, Adrian Bunk wrote:

> This patch makes three needlessly global structs static.
>
> Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>
>
> ---
>
> drivers/char/sonypi.c | 76 +++++++++++++++++++++++++++++++++++++++++-
> drivers/char/sonypi.h | 74 ----------------------------------------
> 2 files changed, 75 insertions(+), 75 deletions(-)

sonypi.h is a "local" header file used only by sonypi.c.

I would like to keep those tables in sonypi.h rather than putting
all into sonypi.c (or we could as well remove sonypi.h and put all the
contents into the .c).

What about:

sonypi.c | 2 +-
sonypi.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

Index: drivers/char/sonypi.h
===================================================================
--- a/drivers/char/sonypi.h (revision 26543)
+++ b/drivers/char/sonypi.h (working copy)
@@ -304,7 +304,7 @@ static struct sonypi_event sonypi_batter
{ 0, 0 }
};

-struct sonypi_eventtypes {
+static struct sonypi_eventtypes {
int model;
u8 data;
unsigned long mask;
@@ -347,7 +347,7 @@ struct sonypi_eventtypes {
#define SONYPI_KEY_INPUTNAME "Sony Vaio Keys"

/* Correspondance table between sonypi events and input layer events */
-struct {
+static struct {
int sonypiev;
int inputev;
} sonypi_inputkeys[] = {
Index: drivers/char/sonypi.c
===================================================================
--- a/drivers/char/sonypi.c (revision 26543)
+++ b/drivers/char/sonypi.c (working copy)
@@ -645,7 +645,7 @@ static struct file_operations sonypi_mis
.ioctl = sonypi_misc_ioctl,
};

-struct miscdevice sonypi_misc_device = {
+static struct miscdevice sonypi_misc_device = {
.minor = -1,
.name = "sonypi",
.fops = &sonypi_misc_fops,
>

--
Stelian Pop <stelian@xxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/