Re: [PATCH 12/21] ide-floppy: factor out ioctl handlers from idefloppy_ioctl()

From: Bartlomiej Zolnierkiewicz
Date: Sat Jan 12 2008 - 15:21:31 EST


On Friday 11 January 2008, Borislav Petkov wrote:
> By passing idefloppy_floppy_t *floppy to the factored out functions, we get
> rid of (almost) all local vars so stack usage should be at minimum here. Also,
> we merge idefloppy_begin_format() into idefloppy_format_start() since it is its
> only user.
>
> Also,
> - remove unneeded scsi ioctl chunk

They are _needed_, despite the name these ioctls are _not_ limited
to SCSI subsystem.

[...]

> + int prevent = (arg) ? 1 : 0;

parentheses are unnecessary

[...]

> +static int idefloppy_format_unit(idefloppy_floppy_t *floppy, unsigned long arg)

__user tag was dropped from 'arg'
(I bet that this would make sparse checking unhappy)

> +{
> + int blocks, length, flags, err = 0;
> + int __user *argp = (int __user *)arg;

wouldn't be needed if the 'arg' was of 'int __user' type and the casting was
done in the caller function

[...]

> + if (idefloppy_queue_pc_tail(floppy->drive, &pc)) {
> + err = -EIO;
> + goto out;

'goto out' is unnecessary

> + }
> +
> +out:
> + if (err)
> + clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags);
> + return err;
> +}

[...]

> - /*
> - * skip SCSI_IOCTL_SEND_COMMAND (deprecated)
> - * and CDROM_SEND_PACKET (legacy) ioctls
> - */
> - if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
> - err = scsi_cmd_ioctl(file, bdev->bd_disk->queue,
> - bdev->bd_disk, cmd, argp);
> - else
> - err = -ENOTTY;
> -
> - if (err == -ENOTTY)
> - err = generic_ide_ioctl(drive, file, bdev, cmd, arg);
> -
> - return err;
> + return generic_ide_ioctl(drive, file, bdev, cmd, arg);

this whole chunk needs to be reverted

Please recast/resubmit.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/