Skip to contentSkip to conversation

Staging: dt3155: make local variables static

PATCH Superseded H Hartley Sweeten 2 participants 3 messages Jul 23, 2010 – Jul 26, 2010 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: dt3155: make local variables static

The symbols dt3155_dev_open, unique_tag, and allocatorAddr are only used in the file dt3155_drv.c and should be static. Also, as pointed out by Joe Perches, static variables do not need initialization so remove them. While here, also move the definition for allocatorAddr so that all the variables are declared at one place in the code.

Cc Greg Kroah-Hartman <[email protected]>
Cc Scott Smedley <[email protected]>
Cc Joe Perches <[email protected]>

---

drivers/staging/dt3155/dt3155_drv.c +5 -14
index 9e7b880..da02741 100644
@@ -112,20 +112,14 @@ int dt3155_major = 0;
 struct dt3155_status dt3155_status[MAXBOARDS];
 
 /* kernel logical address of the board */
-static void __iomem *dt3155_lbase[MAXBOARDS] = { NULL
-#if MAXBOARDS == 2
-				      , NULL
-#endif
-};
+static void __iomem *dt3155_lbase[MAXBOARDS];
 
-u32  dt3155_dev_open[MAXBOARDS] = {0
-#if MAXBOARDS == 2
-				       , 0
-#endif
-};
+static u32  dt3155_dev_open[MAXBOARDS];
 
 u32  ndevices = 0;
-u32 unique_tag = 0;;
+static u32 unique_tag;
+
+static u32 allocatorAddr;
 
 
 /*
@@ -937,9 +931,6 @@ err:
   return -EIO;
 }
 
-u32 allocatorAddr = 0;
-
-
 int dt3155_init(void)
 {
   struct dt3155_status *dts;
#1 lore raw
Quoted 5 lines · H Hartley Sweeten

The symbols dt3155_dev_open, unique_tag, and allocatorAddr are only used in the file dt3155_drv.c and should be static. Also, as pointed out by Joe Perches, static variables do not need initialization so remove them. While here, also move the definition for allocatorAddr so that all the variables are declared at one place in the code.

This doesn't apply after applying your previous patch to this file :(

thanks,

greg k-h

#2 lore raw
Quoted 8 lines · Greg KH
Quoted 5 lines · H Hartley Sweeten

The symbols dt3155_dev_open, unique_tag, and allocatorAddr are only used in the file dt3155_drv.c and should be static. Also, as pointed out by Joe Perches, static variables do not need initialization so remove them. While here, also move the definition for allocatorAddr so that all the variables are declared at one place in the code.

This doesn't apply after applying your previous patch to this file :(

Oops.. I'll fix it up and repost.

Regards,
Hartley