Re: [PATCH 31/32] ide-tape: remove idetape_config_t typedef

Bartlomiej Zolnierkiewicz
2008-01-27T19:36:46Z

On Sunday 27 January 2008, Borislav Petkov wrote:
> From: Borislav Petkov <bbpetkov@yahoo.de>
>
> Since this is used only in idetape_blkdev_ioctl(), remove the typedef and make
> the struct function-local.
>
> Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>

applied

> ---
> drivers/ide/ide-tape.c | 23 +++++++++++------------
> 1 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
> index c22d7f6..424879d 100644
> --- a/drivers/ide/ide-tape.c
> +++ b/drivers/ide/ide-tape.c
> @@ -540,15 +540,6 @@ struct idetape_id_gcw {
> #define IDETAPE_CAPABILITIES_PAGE 0x2a
>
> /*
> - * Run time configurable parameters.
> - */
> -typedef struct {
> - int dsc_rw_frequency;
> - int dsc_media_access_frequency;
> - int nr_stages;
> -} idetape_config_t;
> -
> -/*
> * The variables below are used for the character device interface.
> * Additional state variables are defined in our ide_drive_t structure.
> */
> @@ -2742,14 +2733,21 @@ static int idetape_rewind_tape (ide_drive_t *drive)
> static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned long arg)
> {
> idetape_tape_t *tape = drive->driver_data;
> - idetape_config_t config;
> +
> + struct idetape_config {
> + int dsc_rw_frequency;
> + int dsc_media_access_frequency;
> + int nr_stages;
> + } config;
> +
> void __user *argp = (void __user *)arg;
>
> debug_log(DBG_PROCS, "Enter %s\n", __func__);
>
> switch (cmd) {
> case 0x0340:
> - if (copy_from_user(&config, argp, sizeof (idetape_config_t)))
> + if (copy_from_user(&config, argp,
> + sizeof(struct idetape_config)))

s/sizeof(struct idetape_config)/sizeof(config)/ so it fits nicely in one line

> return -EFAULT;
> tape->best_dsc_rw_freq = config.dsc_rw_frequency;
> tape->max_stages = config.nr_stages;
> @@ -2757,7 +2755,8 @@ static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned l
> case 0x0350:
> config.dsc_rw_frequency = (int) tape->best_dsc_rw_freq;
> config.nr_stages = tape->max_stages;
> - if (copy_to_user(argp, &config, sizeof (idetape_config_t)))
> + if (copy_to_user(argp, &config,
> + sizeof(struct idetape_config)))

ditto