[POWERPC] 83xx: Add support for MPC8349E-mITX-GP
[powerpc.git] / drivers / pcmcia / pcmcia_ioctl.c
index 9ad18e6..27523c5 100644 (file)
@@ -59,7 +59,6 @@ typedef struct user_info_t {
 
 #ifdef DEBUG
 extern int ds_pc_debug;
-#define cs_socket_name(skt)    ((skt)->dev.class_id)
 
 #define ds_dbg(lvl, fmt, arg...) do {          \
        if (ds_pc_debug >= lvl)                         \
@@ -128,9 +127,12 @@ static int proc_read_drivers(char *buf, char **start, off_t pos,
                             int count, int *eof, void *data)
 {
        char *p = buf;
+       int rc;
 
-       bus_for_each_drv(&pcmcia_bus_type, NULL,
-                        (void *) &p, proc_read_drivers_callback);
+       rc = bus_for_each_drv(&pcmcia_bus_type, NULL,
+                             (void *) &p, proc_read_drivers_callback);
+       if (rc < 0)
+               return rc;
 
        return (p - buf);
 }
@@ -269,8 +271,10 @@ rescan:
         * Prevent this racing with a card insertion.
         */
        mutex_lock(&s->skt_mutex);
-       bus_rescan_devices(&pcmcia_bus_type);
+       ret = bus_rescan_devices(&pcmcia_bus_type);
        mutex_unlock(&s->skt_mutex);
+       if (ret)
+               goto err_put_module;
 
        /* check whether the driver indeed matched. I don't care if this
         * is racy or not, because it can only happen on cardmgr access
@@ -481,7 +485,7 @@ static ssize_t ds_read(struct file *file, char __user *buf,
     user_info_t *user;
     int ret;
 
-    ds_dbg(2, "ds_read(socket %d)\n", iminor(file->f_dentry->d_inode));
+    ds_dbg(2, "ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode));
 
     if (count < 4)
        return -EINVAL;
@@ -506,7 +510,7 @@ static ssize_t ds_read(struct file *file, char __user *buf,
 static ssize_t ds_write(struct file *file, const char __user *buf,
                        size_t count, loff_t *ppos)
 {
-    ds_dbg(2, "ds_write(socket %d)\n", iminor(file->f_dentry->d_inode));
+    ds_dbg(2, "ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode));
 
     if (count != 4)
        return -EINVAL;
@@ -524,7 +528,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)
     struct pcmcia_socket *s;
     user_info_t *user;
 
-    ds_dbg(2, "ds_poll(socket %d)\n", iminor(file->f_dentry->d_inode));
+    ds_dbg(2, "ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode));
 
     user = file->private_data;
     if (CHECK_USER(user))
@@ -589,7 +593,12 @@ static int ds_ioctl(struct inode * inode, struct file * file,
 
     err = ret = 0;
 
-    if (cmd & IOC_IN) __copy_from_user((char *)buf, uarg, size);
+    if (cmd & IOC_IN) {
+       if (__copy_from_user((char *)buf, uarg, size)) {
+           err = -EFAULT;
+           goto free_out;
+       }
+    }
 
     switch (cmd) {
     case DS_ADJUST_RESOURCE_INFO:
@@ -756,7 +765,7 @@ free_out:
 
 /*====================================================================*/
 
-static struct file_operations ds_fops = {
+static const struct file_operations ds_fops = {
        .owner          = THIS_MODULE,
        .open           = ds_open,
        .release        = ds_release,