Commit 0330aace authored by Adrian Bunk's avatar Adrian Bunk Committed by Linus Torvalds

[PATCH] drivers/block/paride/ cleanups (fwd)

The patch below does the following cleanups in each if the five changed
C files:
- #ifndef MODULE: remove unused setup function
- make a needlessly global struct static
- pf.c: pf_init_units can be static and __init

After this cleanup, setup.h is completely unused and therefore removed.
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5ea6e8e6
...@@ -142,26 +142,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; ...@@ -142,26 +142,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
static spinlock_t pcd_lock; static spinlock_t pcd_lock;
#ifndef MODULE
#include "setup.h"
static STT pcd_stt[6] = {
{"drive0", 6, drive0},
{"drive1", 6, drive1},
{"drive2", 6, drive2},
{"drive3", 6, drive3},
{"disable", 1, &disable},
{"nice", 1, &nice}
};
void pcd_setup(char *str, int *ints)
{
generic_setup(pcd_stt, 6, str);
}
#endif
module_param(verbose, bool, 0644); module_param(verbose, bool, 0644);
module_param(major, int, 0); module_param(major, int, 0);
module_param(name, charp, 0); module_param(name, charp, 0);
...@@ -218,7 +198,7 @@ struct pcd_unit { ...@@ -218,7 +198,7 @@ struct pcd_unit {
struct gendisk *disk; struct gendisk *disk;
}; };
struct pcd_unit pcd[PCD_UNITS]; static struct pcd_unit pcd[PCD_UNITS];
static char pcd_scratch[64]; static char pcd_scratch[64];
static char pcd_buffer[2048]; /* raw block buffer */ static char pcd_buffer[2048]; /* raw block buffer */
......
...@@ -157,27 +157,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV}; ...@@ -157,27 +157,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV};
static DEFINE_SPINLOCK(pd_lock); static DEFINE_SPINLOCK(pd_lock);
#ifndef MODULE
#include "setup.h"
static STT pd_stt[7] = {
{"drive0", 8, drive0},
{"drive1", 8, drive1},
{"drive2", 8, drive2},
{"drive3", 8, drive3},
{"disable", 1, &disable},
{"cluster", 1, &cluster},
{"nice", 1, &nice}
};
void pd_setup(char *str, int *ints)
{
generic_setup(pd_stt, 7, str);
}
#endif
module_param(verbose, bool, 0); module_param(verbose, bool, 0);
module_param(major, int, 0); module_param(major, int, 0);
module_param(name, charp, 0); module_param(name, charp, 0);
...@@ -255,7 +234,7 @@ struct pd_unit { ...@@ -255,7 +234,7 @@ struct pd_unit {
struct gendisk *gd; struct gendisk *gd;
}; };
struct pd_unit pd[PD_UNITS]; static struct pd_unit pd[PD_UNITS];
static char pd_scratch[512]; /* scratch block buffer */ static char pd_scratch[512]; /* scratch block buffer */
......
...@@ -156,27 +156,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_LUN, D_DLY}; ...@@ -156,27 +156,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_LUN, D_DLY};
static spinlock_t pf_spin_lock; static spinlock_t pf_spin_lock;
#ifndef MODULE
#include "setup.h"
static STT pf_stt[7] = {
{"drive0", 7, drive0},
{"drive1", 7, drive1},
{"drive2", 7, drive2},
{"drive3", 7, drive3},
{"disable", 1, &disable},
{"cluster", 1, &cluster},
{"nice", 1, &nice}
};
void pf_setup(char *str, int *ints)
{
generic_setup(pf_stt, 7, str);
}
#endif
module_param(verbose, bool, 0644); module_param(verbose, bool, 0644);
module_param(major, int, 0); module_param(major, int, 0);
module_param(name, charp, 0); module_param(name, charp, 0);
...@@ -256,7 +235,7 @@ struct pf_unit { ...@@ -256,7 +235,7 @@ struct pf_unit {
struct gendisk *disk; struct gendisk *disk;
}; };
struct pf_unit units[PF_UNITS]; static struct pf_unit units[PF_UNITS];
static int pf_identify(struct pf_unit *pf); static int pf_identify(struct pf_unit *pf);
static void pf_lock(struct pf_unit *pf, int func); static void pf_lock(struct pf_unit *pf, int func);
...@@ -290,7 +269,7 @@ static struct block_device_operations pf_fops = { ...@@ -290,7 +269,7 @@ static struct block_device_operations pf_fops = {
.media_changed = pf_check_media, .media_changed = pf_check_media,
}; };
void pf_init_units(void) static void __init pf_init_units(void)
{ {
struct pf_unit *pf; struct pf_unit *pf;
int unit; int unit;
......
...@@ -165,25 +165,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; ...@@ -165,25 +165,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
#include <asm/uaccess.h> #include <asm/uaccess.h>
#ifndef MODULE
#include "setup.h"
static STT pg_stt[5] = {
{"drive0", 6, drive0},
{"drive1", 6, drive1},
{"drive2", 6, drive2},
{"drive3", 6, drive3},
{"disable", 1, &disable}
};
void pg_setup(char *str, int *ints)
{
generic_setup(pg_stt, 5, str);
}
#endif
module_param(verbose, bool, 0644); module_param(verbose, bool, 0644);
module_param(major, int, 0); module_param(major, int, 0);
module_param(name, charp, 0); module_param(name, charp, 0);
...@@ -235,7 +216,7 @@ struct pg { ...@@ -235,7 +216,7 @@ struct pg {
char name[PG_NAMELEN]; /* pg0, pg1, ... */ char name[PG_NAMELEN]; /* pg0, pg1, ... */
}; };
struct pg devices[PG_UNITS]; static struct pg devices[PG_UNITS];
static int pg_identify(struct pg *dev, int log); static int pg_identify(struct pg *dev, int log);
......
...@@ -149,26 +149,6 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3}; ...@@ -149,26 +149,6 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
#include <asm/uaccess.h> #include <asm/uaccess.h>
#ifndef MODULE
#include "setup.h"
static STT pt_stt[5] = {
{"drive0", 6, drive0},
{"drive1", 6, drive1},
{"drive2", 6, drive2},
{"drive3", 6, drive3},
{"disable", 1, &disable}
};
void
pt_setup(char *str, int *ints)
{
generic_setup(pt_stt, 5, str);
}
#endif
module_param(verbose, bool, 0); module_param(verbose, bool, 0);
module_param(major, int, 0); module_param(major, int, 0);
module_param(name, charp, 0); module_param(name, charp, 0);
...@@ -246,7 +226,7 @@ struct pt_unit { ...@@ -246,7 +226,7 @@ struct pt_unit {
static int pt_identify(struct pt_unit *tape); static int pt_identify(struct pt_unit *tape);
struct pt_unit pt[PT_UNITS]; static struct pt_unit pt[PT_UNITS];
static char pt_scratch[512]; /* scratch block buffer */ static char pt_scratch[512]; /* scratch block buffer */
......
/*
setup.h (c) 1997-8 Grant R. Guenther <grant@torque.net>
Under the terms of the GNU General Public License.
This is a table driven setup function for kernel modules
using the module.variable=val,... command line notation.
*/
/* Changes:
1.01 GRG 1998.05.05 Allow negative and defaulted values
*/
#include <linux/ctype.h>
#include <linux/string.h>
struct setup_tab_t {
char *tag; /* variable name */
int size; /* number of elements in array */
int *iv; /* pointer to variable */
};
typedef struct setup_tab_t STT;
/* t is a table that describes the variables that can be set
by gen_setup
n is the number of entries in the table
ss is a string of the form:
<tag>=[<val>,...]<val>
*/
static void generic_setup( STT t[], int n, char *ss )
{ int j,k, sgn;
k = 0;
for (j=0;j<n;j++) {
k = strlen(t[j].tag);
if (strncmp(ss,t[j].tag,k) == 0) break;
}
if (j == n) return;
if (ss[k] == 0) {
t[j].iv[0] = 1;
return;
}
if (ss[k] != '=') return;
ss += (k+1);
k = 0;
while (ss && (k < t[j].size)) {
if (!*ss) break;
sgn = 1;
if (*ss == '-') { ss++; sgn = -1; }
if (!*ss) break;
if (isdigit(*ss))
t[j].iv[k] = sgn * simple_strtoul(ss,NULL,0);
k++;
if ((ss = strchr(ss,',')) != NULL) ss++;
}
}
/* end of setup.h */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment