]> Pileus Git - ~andy/linux/blobdiff - drivers/block/floppy.c
ACPICA: Update version to 20100331.
[~andy/linux] / drivers / block / floppy.c
index 1fe5225a38291256bb291177b90a65ab92da9cf1..90c4038702da3606e796bc3dea012ee37eb7bcc4 100644 (file)
@@ -2143,7 +2143,6 @@ static void format_interrupt(void)
        cont->redo();
 }
 
-#define CODE2SIZE (ssize = ((1 << SIZECODE) + 3) >> 2)
 #define FM_MODE(x, y) ((y) & ~(((x)->rate & 0x80) >> 1))
 #define CT(x) ((x) | 0xc0)
 
@@ -2347,7 +2346,7 @@ static void rw_interrupt(void)
                DRS->first_read_date = jiffies;
 
        nr_sectors = 0;
-       CODE2SIZE;
+       ssize = DIV_ROUND_UP(1 << SIZECODE, 4);
 
        if (ST1 & ST1_EOC)
                eoc = 1;
@@ -2647,7 +2646,7 @@ static int make_raw_rw_request(void)
        raw_cmd->track = TRACK << STRETCH(_floppy);
        DR_SELECT = UNIT(current_drive) + PH_HEAD(_floppy, HEAD);
        GAP = _floppy->gap;
-       CODE2SIZE;
+       ssize = DIV_ROUND_UP(1 << SIZECODE, 4);
        SECT_PER_TRACK = _floppy->sect << 2 >> SIZECODE;
        SECTOR = ((fsector_t % _floppy->sect) << 2 >> SIZECODE) +
            FD_SECTBASE(_floppy);
@@ -3421,8 +3420,6 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
                    unsigned long param)
 {
-#define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE|FMODE_WRITE_IOCTL))
-
        int drive = (long)bdev->bd_disk->private_data;
        int type = ITYPE(UDRS->fd_device);
        int i;
@@ -3434,7 +3431,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
                struct floppy_max_errors max_errors;
                struct floppy_drive_params dp;
        } inparam;              /* parameters coming from user space */
-       const char *outparam;   /* parameters passed back to user space */
+       const void *outparam;   /* parameters passed back to user space */
 
        /* convert compatibility eject ioctls into floppy eject ioctl.
         * We do this in order to provide a means to eject floppy disks before
@@ -3455,7 +3452,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
                return ret;
 
        /* permission checks */
-       if (((cmd & 0x40) && !FD_IOCTL_ALLOWED) ||
+       if (((cmd & 0x40) && !(mode & (FMODE_WRITE | FMODE_WRITE_IOCTL))) ||
            ((cmd & 0x80) && !capable(CAP_SYS_ADMIN)))
                return -EPERM;
 
@@ -3498,8 +3495,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
                return set_geometry(cmd, &inparam.g, drive, type, bdev);
        case FDGETPRM:
                ret = get_floppy_geometry(drive, type,
-                                         (struct floppy_struct **)
-                                         &outparam);
+                                         (struct floppy_struct **)&outparam);
                if (ret)
                        return ret;
                break;
@@ -3534,20 +3530,20 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
                UDP->max_errors.reporting = (unsigned short)(param & 0x0f);
                return 0;
        case FDGETMAXERRS:
-               outparam = (const char *)&UDP->max_errors;
+               outparam = &UDP->max_errors;
                break;
        case FDSETMAXERRS:
                UDP->max_errors = inparam.max_errors;
                break;
        case FDGETDRVTYP:
                outparam = drive_name(type, drive);
-               SUPBOUND(size, strlen(outparam) + 1);
+               SUPBOUND(size, strlen((const char *)outparam) + 1);
                break;
        case FDSETDRVPRM:
                *UDP = inparam.dp;
                break;
        case FDGETDRVPRM:
-               outparam = (const char *)UDP;
+               outparam = UDP;
                break;
        case FDPOLLDRVSTAT:
                if (lock_fdc(drive, true))
@@ -3557,18 +3553,18 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
                process_fd_request();
                /* fall through */
        case FDGETDRVSTAT:
-               outparam = (const char *)UDRS;
+               outparam = UDRS;
                break;
        case FDRESET:
                return user_reset_fdc(drive, (int)param, true);
        case FDGETFDCSTAT:
-               outparam = (const char *)UFDCS;
+               outparam = UFDCS;
                break;
        case FDWERRORCLR:
                memset(UDRWE, 0, sizeof(*UDRWE));
                return 0;
        case FDWERRORGET:
-               outparam = (const char *)UDRWE;
+               outparam = UDRWE;
                break;
        case FDRAWCMD:
                if (type)