static int chrdev_rx_done(struct channel_data *channel);
static int chrdev_tx_done(struct channel_data *channel, int size);
static ssize_t cosa_read(struct file *file,
- char *buf, size_t count, loff_t *ppos);
+ char __user *buf, size_t count, loff_t *ppos);
static ssize_t cosa_write(struct file *file,
- const char *buf, size_t count, loff_t *ppos);
+ const char __user *buf, size_t count, loff_t *ppos);
static unsigned int cosa_poll(struct file *file, poll_table *poll);
static int cosa_open(struct inode *inode, struct file *file);
static int cosa_release(struct inode *inode, struct file *file);
/* 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, unsigned long a);
-static int cosa_readmem(struct cosa_data *cosa, unsigned long a);
+static int cosa_download(struct cosa_data *cosa, void __user *a);
+static int cosa_readmem(struct cosa_data *cosa, void __user *a);
/* COSA/SRP ROM monitor */
-static int download(struct cosa_data *cosa, const char *data, int addr, int len);
+static int download(struct cosa_data *cosa, const char __user *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 readmem(struct cosa_data *cosa, char __user *data, int addr, int len);
static int cosa_reset_and_read_id(struct cosa_data *cosa, char *id);
/* Auxilliary functions */
cosa_kick(chan->cosa);
if (chan->tx_skb) {
dev_kfree_skb(chan->tx_skb);
- chan->tx_skb = 0;
+ chan->tx_skb = NULL;
}
netif_wake_queue(dev);
}
spin_lock_irqsave(&chan->cosa->lock, flags);
if (chan->rx_skb) {
kfree_skb(chan->rx_skb);
- chan->rx_skb = 0;
+ chan->rx_skb = NULL;
}
if (chan->tx_skb) {
kfree_skb(chan->tx_skb);
- chan->tx_skb = 0;
+ chan->tx_skb = NULL;
}
chan->usage=0;
chan->cosa->usage--;
chan->stats.rx_packets++;
chan->stats.rx_bytes += chan->cosa->rxsize;
netif_rx(chan->rx_skb);
- chan->rx_skb = 0;
+ chan->rx_skb = NULL;
chan->pppdev.dev->last_rx = jiffies;
return 0;
}
return 1;
}
dev_kfree_skb_irq(chan->tx_skb);
- chan->tx_skb = 0;
+ chan->tx_skb = NULL;
chan->stats.tx_packets++;
chan->stats.tx_bytes += size;
netif_wake_queue(chan->pppdev.dev);
}
static ssize_t cosa_read(struct file *file,
- char *buf, size_t count, loff_t *ppos)
+ char __user *buf, size_t count, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
unsigned long flags;
static ssize_t cosa_write(struct file *file,
- const char *buf, size_t count, loff_t *ppos)
+ const char __user *buf, size_t count, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
struct channel_data *chan = file->private_data;
}
/* High-level function to download data into COSA memory. Calls download() */
-static inline int cosa_download(struct cosa_data *cosa, unsigned long arg)
+static inline int cosa_download(struct cosa_data *cosa, void __user *arg)
{
struct cosa_download d;
int i;
return -EPERM;
}
- if (copy_from_user(&d, (void __user *) arg, sizeof(d)))
+ if (copy_from_user(&d, arg, sizeof(d)))
return -EFAULT;
if (d.addr < 0 || d.addr > COSA_MAX_FIRMWARE_SIZE)
}
/* High-level function to read COSA memory. Calls readmem() */
-static inline int cosa_readmem(struct cosa_data *cosa, unsigned long arg)
+static inline int cosa_readmem(struct cosa_data *cosa, void __user *arg)
{
struct cosa_download d;
int i;
return -EPERM;
}
- if (copy_from_user(&d, (void __user *) arg, sizeof(d)))
+ if (copy_from_user(&d, arg, sizeof(d)))
return -EFAULT;
/* If something fails, force the user to reset the card */
}
/* Buffer of size at least COSA_MAX_ID_STRING is expected */
-static inline int cosa_getidstr(struct cosa_data *cosa, char *string)
+static inline int cosa_getidstr(struct cosa_data *cosa, char __user *string)
{
int l = strlen(cosa->id_string)+1;
if (copy_to_user(string, cosa->id_string, l))
}
/* Buffer of size at least COSA_MAX_ID_STRING is expected */
-static inline int cosa_gettype(struct cosa_data *cosa, char *string)
+static inline int cosa_gettype(struct cosa_data *cosa, char __user *string)
{
int l = strlen(cosa->type)+1;
if (copy_to_user(string, cosa->type, l))
static int cosa_ioctl_common(struct cosa_data *cosa,
struct channel_data *channel, unsigned int cmd, unsigned long arg)
{
+ void __user *argp = (void __user *)arg;
switch(cmd) {
case COSAIORSET: /* Reset the device */
if (!capable(CAP_NET_ADMIN))
if (!capable(CAP_SYS_RAWIO))
return -EACCES;
- return cosa_download(cosa, arg);
+ return cosa_download(cosa, argp);
case COSAIORMEM:
if (!capable(CAP_SYS_RAWIO))
return -EACCES;
- return cosa_readmem(cosa, arg);
+ return cosa_readmem(cosa, argp);
case COSAIORTYPE:
- return cosa_gettype(cosa, (char *)arg);
+ return cosa_gettype(cosa, argp);
case COSAIORIDSTR:
- return cosa_getidstr(cosa, (char *)arg);
+ return cosa_getidstr(cosa, argp);
case COSAIONRCARDS:
return nr_cards;
case COSAIONRCHANS:
* 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, const char *microcode, int length, int address)
+static int download(struct cosa_data *cosa, const char __user *microcode, int length, int address)
{
int i;
* This routine is not needed during the normal operation and serves
* for debugging purposes only.
*/
-static int readmem(struct cosa_data *cosa, char *microcode, int length, int address)
+static int readmem(struct cosa_data *cosa, char __user *microcode, int length, int address)
{
if (put_wait_data(cosa, 'r') == -1) return -1;
if ((get_wait_data(cosa)) != 'r') return -2;