Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17678
b: refs/heads/master
c: fe97107
h: refs/heads/master
v: v3
  • Loading branch information
Tobias Klauser authored and Linus Torvalds committed Jan 10, 2006
1 parent 6481c41 commit 5aa97dc
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 52 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c6bee1d4037a5c569f30d40bd852a57ba250912
refs/heads/master: fe971071a89c5c5184fc9f3482c7a8e997cf0520
2 changes: 1 addition & 1 deletion trunk/drivers/char/amiserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout);

static struct serial_state rs_table[1];

#define NR_PORTS (sizeof(rs_table)/sizeof(struct serial_state))
#define NR_PORTS ARRAY_SIZE(rs_table)

/*
* tmp_buf is used as a temporary buffer by serial_write. We need to
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/cyclades.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ static unsigned int cy_isa_addresses[] = {
0xDE000,
0,0,0,0,0,0,0,0
};
#define NR_ISA_ADDRS (sizeof(cy_isa_addresses)/sizeof(unsigned char*))
#define NR_ISA_ADDRS ARRAY_SIZE(cy_isa_addresses)

#ifdef MODULE
static long maddr[NR_CARDS] = { 0, };
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/hvsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static inline void print_state(struct hvsi_struct *hp)
};
const char *name = state_names[hp->state];

if (hp->state > (sizeof(state_names)/sizeof(char*)))
if (hp->state > ARRAY_SIZE(state_names))
name = "UNKNOWN";

pr_debug("hvsi%i: state = %s\n", hp->index, name);
Expand Down
19 changes: 8 additions & 11 deletions trunk/drivers/char/istallion.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static stlconf_t stli_brdconf[] = {
/*{ BRD_ECP, 0x2a0, 0, 0xcc000, 0, 0 },*/
};

static int stli_nrbrds = sizeof(stli_brdconf) / sizeof(stlconf_t);
static int stli_nrbrds = ARRAY_SIZE(stli_brdconf);

/*
* There is some experimental EISA board detection code in this driver.
Expand Down Expand Up @@ -406,7 +406,7 @@ static unsigned long stli_eisamemprobeaddrs[] = {
0xff000000, 0xff010000, 0xff020000, 0xff030000,
};

static int stli_eisamempsize = sizeof(stli_eisamemprobeaddrs) / sizeof(unsigned long);
static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs);

/*
* Define the Stallion PCI vendor and device IDs.
Expand Down Expand Up @@ -899,15 +899,13 @@ static void stli_argbrds(void)
{
stlconf_t conf;
stlibrd_t *brdp;
int nrargs, i;
int i;

#ifdef DEBUG
printk("stli_argbrds()\n");
#endif

nrargs = sizeof(stli_brdsp) / sizeof(char **);

for (i = stli_nrbrds; (i < nrargs); i++) {
for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) {
memset(&conf, 0, sizeof(conf));
if (stli_parsebrd(&conf, stli_brdsp[i]) == 0)
continue;
Expand Down Expand Up @@ -967,7 +965,7 @@ static unsigned long stli_atol(char *str)
static int stli_parsebrd(stlconf_t *confp, char **argp)
{
char *sp;
int nrbrdnames, i;
int i;

#ifdef DEBUG
printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp);
Expand All @@ -979,14 +977,13 @@ static int stli_parsebrd(stlconf_t *confp, char **argp)
for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)
*sp = TOLOWER(*sp);

nrbrdnames = sizeof(stli_brdstr) / sizeof(stlibrdtype_t);
for (i = 0; (i < nrbrdnames); i++) {
for (i = 0; i < ARRAY_SIZE(stli_brdstr); i++) {
if (strcmp(stli_brdstr[i].name, argp[0]) == 0)
break;
}
if (i >= nrbrdnames) {
if (i == ARRAY_SIZE(stli_brdstr)) {
printk("STALLION: unknown board name, %s?\n", argp[0]);
return(0);
return 0;
}

confp->brdtype = stli_brdstr[i].type;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/moxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ static int __init moxa_init(void)
#ifdef CONFIG_PCI
{
struct pci_dev *p = NULL;
int n = (sizeof(moxa_pcibrds) / sizeof(moxa_pcibrds[0])) - 1;
int n = ARRAY_SIZE(moxa_pcibrds) - 1;
i = 0;
while (i < n) {
while ((p = pci_get_device(moxa_pcibrds[i].vendor, moxa_pcibrds[i].device, p))!=NULL)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/mxser.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ static int mxser_init(void)

/* start finding PCI board here */
#ifdef CONFIG_PCI
n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1;
n = ARRAY_SIZE(mxser_pcibrds) - 1;
index = 0;
b = 0;
while (b < n) {
Expand Down
12 changes: 5 additions & 7 deletions trunk/drivers/char/nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,13 @@ pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
(nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0);
PRINT_PROC("Floppy 0 type : ");
type = nvram[2] >> 4;
if (type < sizeof (floppy_types) / sizeof (*floppy_types))
if (type < ARRAY_SIZE(floppy_types))
PRINT_PROC("%s\n", floppy_types[type]);
else
PRINT_PROC("%d (unknown)\n", type);
PRINT_PROC("Floppy 1 type : ");
type = nvram[2] & 0x0f;
if (type < sizeof (floppy_types) / sizeof (*floppy_types))
if (type < ARRAY_SIZE(floppy_types))
PRINT_PROC("%s\n", floppy_types[type]);
else
PRINT_PROC("%d (unknown)\n", type);
Expand Down Expand Up @@ -843,8 +843,6 @@ static char *colors[] = {
"2", "4", "16", "256", "65536", "??", "??", "??"
};

#define fieldsize(a) (sizeof(a)/sizeof(*a))

static int
atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
off_t *begin, off_t offset, int size)
Expand All @@ -856,7 +854,7 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not ");

PRINT_PROC("Boot preference : ");
for (i = fieldsize(boot_prefs) - 1; i >= 0; --i) {
for (i = ARRAY_SIZE(boot_prefs) - 1; i >= 0; --i) {
if (nvram[1] == boot_prefs[i].val) {
PRINT_PROC("%s\n", boot_prefs[i].name);
break;
Expand All @@ -878,12 +876,12 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
return 1;

PRINT_PROC("OS language : ");
if (nvram[6] < fieldsize(languages))
if (nvram[6] < ARRAY_SIZE(languages))
PRINT_PROC("%s\n", languages[nvram[6]]);
else
PRINT_PROC("%u (undefined)\n", nvram[6]);
PRINT_PROC("Keyboard language: ");
if (nvram[7] < fieldsize(languages))
if (nvram[7] < ARRAY_SIZE(languages))
PRINT_PROC("%s\n", languages[nvram[7]]);
else
PRINT_PROC("%u (undefined)\n", nvram[7]);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/char/pcmcia/synclink_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4005,7 +4005,7 @@ BOOLEAN register_test(MGSLPC_INFO *info)
{
static unsigned char patterns[] =
{ 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f };
static unsigned int count = sizeof(patterns) / sizeof(patterns[0]);
static unsigned int count = ARRAY_SIZE(patterns);
unsigned int i;
BOOLEAN rc = TRUE;
unsigned long flags;
Expand All @@ -4016,7 +4016,7 @@ BOOLEAN register_test(MGSLPC_INFO *info)
for (i = 0; i < count; i++) {
write_reg(info, XAD1, patterns[i]);
write_reg(info, XAD2, patterns[(i + 1) % count]);
if ((read_reg(info, XAD1) != patterns[i]) ||
if ((read_reg(info, XAD1) != patterns[i]) ||
(read_reg(info, XAD2) != patterns[(i + 1) % count])) {
rc = FALSE;
break;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/rio/rio_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static int rio_poll = 1;
or less.... */
static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000};

#define NR_RIO_ADDRS (sizeof(rio_probe_addrs)/sizeof (int))
#define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs)


/* Set the mask to all-ones. This alas, only supports 32 interrupts.
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/char/riscom8.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ static struct riscom_port rc_port[RC_NBOARD * RC_NPORT];

/* RISCom/8 I/O ports addresses (without address translation) */
static unsigned short rc_ioport[] = {
#if 1
#if 1
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c,
#else
#else
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, 0x10,
0x11, 0x12, 0x18, 0x28, 0x31, 0x32, 0x39, 0x3a, 0x40, 0x41, 0x61, 0x62,
0x63, 0x64, 0x6b, 0x70, 0x71, 0x78, 0x7a, 0x7b, 0x7f, 0x100, 0x101
#endif
#endif
};
#define RC_NIOPORT (sizeof(rc_ioport) / sizeof(rc_ioport[0]))
#define RC_NIOPORT ARRAY_SIZE(rc_ioport)


static inline int rc_paranoia_check(struct riscom_port const * port,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/serial167.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct cyclades_port cy_port[] = {
{-1 }, /* ttyS2 */
{-1 }, /* ttyS3 */
};
#define NR_PORTS (sizeof(cy_port)/sizeof(struct cyclades_port))
#define NR_PORTS ARRAY_SIZE(cy_port)

/*
* tmp_buf is used as a temporary buffer by serial_write. We need to
Expand Down
15 changes: 7 additions & 8 deletions trunk/drivers/char/stallion.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static stlconf_t stl_brdconf[] = {
/*{ BRD_EASYIO, 0x2a0, 0, 0, 10, 0 },*/
};

static int stl_nrbrds = sizeof(stl_brdconf) / sizeof(stlconf_t);
static int stl_nrbrds = ARRAY_SIZE(stl_brdconf);

/*****************************************************************************/

Expand Down Expand Up @@ -424,7 +424,7 @@ static stlpcibrd_t stl_pcibrds[] = {
{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, BRD_ECHPCI },
};

static int stl_nrpcibrds = sizeof(stl_pcibrds) / sizeof(stlpcibrd_t);
static int stl_nrpcibrds = ARRAY_SIZE(stl_pcibrds);

#endif

Expand Down Expand Up @@ -704,7 +704,7 @@ static unsigned int sc26198_baudtable[] = {
230400, 460800, 921600
};

#define SC26198_NRBAUDS (sizeof(sc26198_baudtable) / sizeof(unsigned int))
#define SC26198_NRBAUDS ARRAY_SIZE(sc26198_baudtable)

/*****************************************************************************/

Expand Down Expand Up @@ -901,7 +901,7 @@ static unsigned long stl_atol(char *str)
static int stl_parsebrd(stlconf_t *confp, char **argp)
{
char *sp;
int nrbrdnames, i;
int i;

#ifdef DEBUG
printk("stl_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp);
Expand All @@ -913,14 +913,13 @@ static int stl_parsebrd(stlconf_t *confp, char **argp)
for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)
*sp = TOLOWER(*sp);

nrbrdnames = sizeof(stl_brdstr) / sizeof(stlbrdtype_t);
for (i = 0; (i < nrbrdnames); i++) {
for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++) {
if (strcmp(stl_brdstr[i].name, argp[0]) == 0)
break;
}
if (i >= nrbrdnames) {
if (i == ARRAY_SIZE(stl_brdstr)) {
printk("STALLION: unknown board name, %s?\n", argp[0]);
return(0);
return 0;
}

confp->brdtype = stl_brdstr[i].type;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/char/sx.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ static int si_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000,
0xc8000, 0xd8000, 0xe8000, 0xa0000};
static int si1_probe_addrs[]= { 0xd0000};

#define NR_SX_ADDRS (sizeof(sx_probe_addrs)/sizeof (int))
#define NR_SI_ADDRS (sizeof(si_probe_addrs)/sizeof (int))
#define NR_SI1_ADDRS (sizeof(si1_probe_addrs)/sizeof (int))
#define NR_SX_ADDRS ARRAY_SIZE(sx_probe_addrs)
#define NR_SI_ADDRS ARRAY_SIZE(si_probe_addrs)
#define NR_SI1_ADDRS ARRAY_SIZE(si1_probe_addrs)


/* Set the mask to all-ones. This alas, only supports 32 interrupts.
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/char/synclink.c
Original file line number Diff line number Diff line change
Expand Up @@ -7058,7 +7058,7 @@ static BOOLEAN mgsl_register_test( struct mgsl_struct *info )
{
static unsigned short BitPatterns[] =
{ 0x0000, 0xffff, 0xaaaa, 0x5555, 0x1234, 0x6969, 0x9696, 0x0f0f };
static unsigned int Patterncount = sizeof(BitPatterns)/sizeof(unsigned short);
static unsigned int Patterncount = ARRAY_SIZE(BitPatterns);
unsigned int i;
BOOLEAN rc = TRUE;
unsigned long flags;
Expand Down Expand Up @@ -7501,9 +7501,9 @@ static int mgsl_adapter_test( struct mgsl_struct *info )
*/
static BOOLEAN mgsl_memory_test( struct mgsl_struct *info )
{
static unsigned long BitPatterns[] = { 0x0, 0x55555555, 0xaaaaaaaa,
0x66666666, 0x99999999, 0xffffffff, 0x12345678 };
unsigned long Patterncount = sizeof(BitPatterns)/sizeof(unsigned long);
static unsigned long BitPatterns[] =
{ 0x0, 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999, 0xffffffff, 0x12345678 };
unsigned long Patterncount = ARRAY_SIZE(BitPatterns);
unsigned long i;
unsigned long TestLimit = SHARED_MEM_ADDRESS_SIZE/sizeof(unsigned long);
unsigned long * TestAddr;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/char/synclinkmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5104,7 +5104,7 @@ void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count)
int register_test(SLMP_INFO *info)
{
static unsigned char testval[] = {0x00, 0xff, 0xaa, 0x55, 0x69, 0x96};
static unsigned int count = sizeof(testval)/sizeof(unsigned char);
static unsigned int count = ARRAY_SIZE(testval);
unsigned int i;
int rc = TRUE;
unsigned long flags;
Expand Down Expand Up @@ -5422,7 +5422,7 @@ int memory_test(SLMP_INFO *info)
{
static unsigned long testval[] = { 0x0, 0x55555555, 0xaaaaaaaa,
0x66666666, 0x99999999, 0xffffffff, 0x12345678 };
unsigned long count = sizeof(testval)/sizeof(unsigned long);
unsigned long count = ARRAY_SIZE(testval);
unsigned long i;
unsigned long limit = SCA_MEM_SIZE/sizeof(unsigned long);
unsigned long * addr = (unsigned long *)info->memory_base;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/char/vme_scc.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,13 +875,13 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
local_irq_save(flags);
#if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC)
if (MACH_IS_MVME147 || MACH_IS_MVME16x) {
for (i=0; i<sizeof(mvme_init_tab)/sizeof(*mvme_init_tab); ++i)
for (i = 0; i < ARRAY_SIZE(mvme_init_tab); ++i)
SCCwrite(mvme_init_tab[i].reg, mvme_init_tab[i].val);
}
#endif
#if defined(CONFIG_BVME6000_SCC)
if (MACH_IS_BVME6000) {
for (i=0; i<sizeof(bvme_init_tab)/sizeof(*bvme_init_tab); ++i)
for (i = 0; i < ARRAY_SIZE(bvme_init_tab); ++i)
SCCwrite(bvme_init_tab[i].reg, bvme_init_tab[i].val);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/vr41xx_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct resource rtc_resource[2] = {
.flags = IORESOURCE_MEM, },
};

#define RTC_NUM_RESOURCES sizeof(rtc_resource) / sizeof(struct resource)
#define RTC_NUM_RESOURCES ARRAY_SIZE(rtc_resource)

static inline unsigned long read_elapsed_second(void)
{
Expand Down

0 comments on commit 5aa97dc

Please sign in to comment.