From: Stephen Hemminger <shemminger@osdl.org>
To: Eyal Lebedinsky <eyal@eyal.emu.id.au>, Jeff Garzik <jgarzik@pobox.com>
Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: [PATCH] fix build of cosa
Date: Tue, 9 Sep 2003 15:48:33 -0700 [thread overview]
Message-ID: <20030909154833.0797ca6e.shemminger@osdl.org> (raw)
In-Reply-To: <3F5DC247.794DD843@eyal.emu.id.au>
The cosa driver definition of ioctl's either conflicts or was not picked
up in the last round of _IOR redefinition (on 2.6.0-test5).
The following makes it build, have no idea if it still works
on real hardware.
diff -Nru a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
--- a/drivers/net/wan/cosa.c Tue Sep 9 15:45:31 2003
+++ b/drivers/net/wan/cosa.c Tue Sep 9 15:45:31 2003
@@ -326,11 +326,11 @@
/* Ioctls */
static int cosa_start(struct cosa_data *cosa, int address);
static int cosa_reset(struct cosa_data *cosa);
-static int cosa_download(struct cosa_data *cosa, struct cosa_download *d);
-static int cosa_readmem(struct cosa_data *cosa, struct cosa_download *d);
+static int cosa_download(struct cosa_data *cosa, unsigned long a);
+static int cosa_readmem(struct cosa_data *cosa, unsigned long a);
/* COSA/SRP ROM monitor */
-static int download(struct cosa_data *cosa, char *data, int addr, int len);
+static int download(struct cosa_data *cosa, const char *data, int addr, int len);
static int startmicrocode(struct cosa_data *cosa, int address);
static int readmem(struct cosa_data *cosa, char *data, int addr, int len);
static int cosa_reset_and_read_id(struct cosa_data *cosa, char *id);
@@ -1033,11 +1033,10 @@
}
/* High-level function to download data into COSA memory. Calls download() */
-static inline int cosa_download(struct cosa_data *cosa, struct cosa_download *d)
+static inline int cosa_download(struct cosa_data *cosa, unsigned long arg)
{
+ struct cosa_download d;
int i;
- int addr, len;
- char *code;
if (cosa->usage > 1)
printk(KERN_INFO "%s: WARNING: download of microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n",
@@ -1047,38 +1046,36 @@
cosa->name, cosa->firmware_status);
return -EPERM;
}
-
- if (verify_area(VERIFY_READ, d, sizeof(*d)) ||
- __get_user(addr, &(d->addr)) ||
- __get_user(len, &(d->len)) ||
- __get_user(code, &(d->code)))
+
+ if (copy_from_user(&d, (void __user *) arg, sizeof(d)))
return -EFAULT;
- if (addr < 0 || addr > COSA_MAX_FIRMWARE_SIZE)
+ if (d.addr < 0 || d.addr > COSA_MAX_FIRMWARE_SIZE)
return -EINVAL;
- if (len < 0 || len > COSA_MAX_FIRMWARE_SIZE)
+ if (d.len < 0 || d.len > COSA_MAX_FIRMWARE_SIZE)
return -EINVAL;
+
/* If something fails, force the user to reset the card */
cosa->firmware_status &= ~(COSA_FW_RESET|COSA_FW_DOWNLOAD);
- if ((i=download(cosa, code, len, addr)) < 0) {
+ i = download(cosa, d.code, d.len, d.addr);
+ if (i < 0) {
printk(KERN_NOTICE "cosa%d: microcode download failed: %d\n",
cosa->num, i);
return -EIO;
}
printk(KERN_INFO "cosa%d: downloading microcode - 0x%04x bytes at 0x%04x\n",
- cosa->num, len, addr);
+ cosa->num, d.len, d.addr);
cosa->firmware_status |= COSA_FW_RESET|COSA_FW_DOWNLOAD;
return 0;
}
/* High-level function to read COSA memory. Calls readmem() */
-static inline int cosa_readmem(struct cosa_data *cosa, struct cosa_download *d)
+static inline int cosa_readmem(struct cosa_data *cosa, unsigned long arg)
{
+ struct cosa_download d;
int i;
- int addr, len;
- char *code;
if (cosa->usage > 1)
printk(KERN_INFO "cosa%d: WARNING: readmem requested with "
@@ -1090,22 +1087,20 @@
return -EPERM;
}
- if (verify_area(VERIFY_READ, d, sizeof(*d)) ||
- __get_user(addr, &(d->addr)) ||
- __get_user(len, &(d->len)) ||
- __get_user(code, &(d->code)))
+ if (copy_from_user(&d, (void __user *) arg, sizeof(d)))
return -EFAULT;
/* If something fails, force the user to reset the card */
cosa->firmware_status &= ~COSA_FW_RESET;
- if ((i=readmem(cosa, code, len, addr)) < 0) {
+ i = readmem(cosa, d.code, d.len, d.addr);
+ if (i < 0) {
printk(KERN_NOTICE "cosa%d: reading memory failed: %d\n",
cosa->num, i);
return -EIO;
}
printk(KERN_INFO "cosa%d: reading card memory - 0x%04x bytes at 0x%04x\n",
- cosa->num, len, addr);
+ cosa->num, d.len, d.addr);
cosa->firmware_status |= COSA_FW_RESET;
return 0;
}
@@ -1171,11 +1166,12 @@
case COSAIODOWNLD: /* Download the firmware */
if (!capable(CAP_SYS_RAWIO))
return -EACCES;
- return cosa_download(cosa, (struct cosa_download *)arg);
+
+ return cosa_download(cosa, arg);
case COSAIORMEM:
if (!capable(CAP_SYS_RAWIO))
return -EACCES;
- return cosa_readmem(cosa, (struct cosa_download *)arg);
+ return cosa_readmem(cosa, arg);
case COSAIORTYPE:
return cosa_gettype(cosa, (char *)arg);
case COSAIORIDSTR:
@@ -1405,7 +1401,7 @@
* by a single space. Monitor has to reply with a space. Now the download
* begins. After the download monitor replies with "\r\n." (CR LF dot).
*/
-static int download(struct cosa_data *cosa, char *microcode, int length, int address)
+static int download(struct cosa_data *cosa, const char *microcode, int length, int address)
{
int i;
diff -Nru a/drivers/net/wan/cosa.h b/drivers/net/wan/cosa.h
--- a/drivers/net/wan/cosa.h Tue Sep 9 15:45:31 2003
+++ b/drivers/net/wan/cosa.h Tue Sep 9 15:45:31 2003
@@ -73,19 +73,19 @@
#define COSAIORSET _IO('C',0xf0)
/* Start microcode at given address */
-#define COSAIOSTRT _IOW('C',0xf1,sizeof(int))
+#define COSAIOSTRT _IOW('C',0xf1, int)
/* Read the block from the device memory */
-#define COSAIORMEM _IOR('C',0xf2,sizeof(struct cosa_download *))
+#define COSAIORMEM _IOWR('C',0xf2, struct cosa_download)
/* Write the block to the device memory (i.e. download the microcode) */
-#define COSAIODOWNLD _IOW('C',0xf2,sizeof(struct cosa_download *))
+#define COSAIODOWNLD _IOW('C',0xf2, struct cosa_download)
/* Read the device type (one of "srp", "cosa", and "cosa8" for now) */
-#define COSAIORTYPE _IOR('C',0xf3,sizeof(char *))
+#define COSAIORTYPE _IOR('C',0xf3, char *)
/* Read the device identification string */
-#define COSAIORIDSTR _IOR('C',0xf4,sizeof(char *))
+#define COSAIORIDSTR _IOR('C',0xf4, char *)
/* Maximum length of the identification string. */
#define COSA_MAX_ID_STRING 128
@@ -100,7 +100,7 @@
#define COSAIONRCHANS _IO('C',0xf8)
/* Set the driver for the bus-master operations */
-#define COSAIOBMSET _IOW('C', 0xf9, sizeof(unsigned short))
+#define COSAIOBMSET _IOW('C', 0xf9, unsigned short)
#define COSA_BM_OFF 0 /* Bus-mastering off - use ISA DMA (default) */
#define COSA_BM_ON 1 /* Bus-mastering on - faster but untested */
next prev parent reply other threads:[~2003-09-09 22:50 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-08 20:32 Linux 2.6.0-test5 Linus Torvalds
2003-09-08 23:04 ` [PATCH] " Jeff Garzik
2003-09-09 0:32 ` walt
2003-09-09 0:48 ` walt
2003-09-09 10:35 ` Mikael Pettersson
2003-09-09 0:04 ` Linux 2.6.0-test5 (compile stats) John Cherry
2003-09-09 0:13 ` John Cherry
2003-09-09 3:44 ` Jeff Garzik
[not found] ` <1063119969.1512.1.camel@cherrypit.pdx.osdl.net>
[not found] ` <20030909155118.GA18763@gtf.org>
2003-09-16 23:44 ` John Cherry
2003-09-09 11:38 ` [2.6 patch] fix nfs4xdr.c compile warning Adrian Bunk
2003-09-12 2:40 ` Neil Brown
2003-09-12 11:11 ` Adrian Bunk
2003-09-09 11:40 ` Linux 2.6.0-test5: serio config broken? Eyal Lebedinsky
2003-09-10 11:02 ` [patch] " Adrian Bunk
2003-09-10 13:23 ` Sytse Wielinga
2003-09-10 14:01 ` Russell King
2003-09-10 14:17 ` Adrian Bunk
2003-09-10 15:55 ` Tom Rini
2003-09-10 17:06 ` Adrian Bunk
2003-09-10 18:59 ` Tom Rini
2003-09-10 19:10 ` Adrian Bunk
2003-09-10 19:31 ` Tom Rini
2003-09-10 19:55 ` Adrian Bunk
2003-09-10 21:04 ` Tom Rini
2003-09-10 21:51 ` Adrian Bunk
2003-09-10 22:05 ` Tom Rini
2003-09-10 22:17 ` Adrian Bunk
2003-09-10 22:29 ` Tom Rini
2003-09-11 8:38 ` Roman Zippel
2003-09-11 23:04 ` Tom Rini
2003-09-12 11:09 ` Adrian Bunk
2003-09-12 14:52 ` Tom Rini
2003-09-12 15:04 ` Adrian Bunk
2003-09-12 15:09 ` Tom Rini
2003-09-12 16:57 ` Roman Zippel
2003-09-09 11:47 ` Linux 2.6.0-test5: ufs build fails Eyal Lebedinsky
2003-09-09 11:50 ` Linux 2.6.0-test5: ps2esdi (CONFIG_BLK_DEV_PS2) " Eyal Lebedinsky
2003-09-09 12:06 ` Linux 2.6.0-test5: CONFIG_COSA " Eyal Lebedinsky
2003-09-09 22:48 ` Stephen Hemminger [this message]
2003-09-11 19:26 ` [PATCH] fix build of cosa Jeff Garzik
2003-09-09 12:12 ` Linux 2.6.0-test5: CONFIG_PCMCIA_WL3501 build fails Eyal Lebedinsky
2003-09-09 12:28 ` Russell King
2003-09-09 17:13 ` Linus Torvalds
2003-09-09 17:19 ` Arnaldo Carvalho de Melo
2003-09-09 23:38 ` Eyal Lebedinsky
2003-09-09 12:27 ` Linux 2.6.0-test5: CONFIG_ATM_BR2684 " Eyal Lebedinsky
2003-09-09 16:18 ` Mitchell Blank Jr
2003-09-09 19:19 ` [2.6 patch] ATM Ambassador no longer BROKEN_ON_SMP Adrian Bunk
2003-09-10 16:57 ` 2.6.0-test5: ISDN kcapi.c no longer compiles Adrian Bunk
2003-09-14 17:40 ` Karsten Keil
2003-09-15 6:57 ` Karsten Keil
2003-09-15 15:52 ` Adrian Bunk
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=20030909154833.0797ca6e.shemminger@osdl.org \
--to=shemminger@osdl.org \
--cc=eyal@eyal.emu.id.au \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@oss.sgi.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
Powered by JetHome