Skip to content

Commit

Permalink
ide: remove ide_driver_t typedef
Browse files Browse the repository at this point in the history
While at it:
- s/struct ide_driver_s/struct ide_driver/
- use to_ide_driver() macro in ide-proc.c

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
  • Loading branch information
bzolnier committed Jan 6, 2009
1 parent 9892ec5 commit 7f3c868
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ static void ide_cd_release(struct kref *kref)

static int ide_cd_probe(ide_drive_t *);

static ide_driver_t ide_cdrom_driver = {
static struct ide_driver ide_cdrom_driver = {
.gen_driver = {
.owner = THIS_MODULE,
.name = "ide-cdrom",
Expand Down
8 changes: 4 additions & 4 deletions drivers/ide/ide-cd.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ struct atapi_toc {

/* Extra per-device info for cdrom drives. */
struct cdrom_info {
ide_drive_t *drive;
ide_driver_t *driver;
struct gendisk *disk;
struct kref kref;
ide_drive_t *drive;
struct ide_driver *driver;
struct gendisk *disk;
struct kref kref;

/* Buffer for table of contents. NULL if we haven't allocated
a TOC buffer for this device yet. */
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/ide-gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static int ide_gd_end_request(ide_drive_t *drive, int uptodate, int nrsecs)
return drive->disk_ops->end_request(drive, uptodate, nrsecs);
}

static ide_driver_t ide_gd_driver = {
static struct ide_driver ide_gd_driver = {
.gen_driver = {
.owner = THIS_MODULE,
.name = "ide-gd",
Expand Down
10 changes: 5 additions & 5 deletions drivers/ide/ide-gd.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#endif

struct ide_disk_obj {
ide_drive_t *drive;
ide_driver_t *driver;
struct gendisk *disk;
struct kref kref;
unsigned int openers; /* protected by BKL for now */
ide_drive_t *drive;
struct ide_driver *driver;
struct gendisk *disk;
struct kref kref;
unsigned int openers; /* protected by BKL for now */

/* Last failed packet command */
struct ide_atapi_pc *failed_pc;
Expand Down
12 changes: 6 additions & 6 deletions drivers/ide/ide-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ EXPORT_SYMBOL(ide_end_drive_cmd);
static void ide_kill_rq(ide_drive_t *drive, struct request *rq)
{
if (rq->rq_disk) {
ide_driver_t *drv;
struct ide_driver *drv;

drv = *(ide_driver_t **)rq->rq_disk->private_data;
drv = *(struct ide_driver **)rq->rq_disk->private_data;
drv->end_request(drive, 0, 0);
} else
ide_end_request(drive, 0, 0);
Expand Down Expand Up @@ -333,9 +333,9 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, u8 stat)
}

if (rq->rq_disk) {
ide_driver_t *drv;
struct ide_driver *drv;

drv = *(ide_driver_t **)rq->rq_disk->private_data;
drv = *(struct ide_driver **)rq->rq_disk->private_data;
return drv->error(drive, rq, stat, err);
} else
return __ide_error(drive, rq, stat, err);
Expand Down Expand Up @@ -606,7 +606,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
return startstop;
}
if (!drive->special.all) {
ide_driver_t *drv;
struct ide_driver *drv;

/*
* We reset the drive so we need to issue a SETFEATURES.
Expand Down Expand Up @@ -639,7 +639,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
*/
return ide_special_rq(drive, rq);

drv = *(ide_driver_t **)rq->rq_disk->private_data;
drv = *(struct ide_driver **)rq->rq_disk->private_data;

return drv->do_request(drive, rq, rq->sector);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/ide-pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int generic_ide_resume(struct device *dev)
blk_put_request(rq);

if (err == 0 && dev->driver) {
ide_driver_t *drv = to_ide_driver(dev->driver);
struct ide_driver *drv = to_ide_driver(dev->driver);

if (drv->resume)
drv->resume(drive);
Expand Down
16 changes: 8 additions & 8 deletions drivers/ide/ide-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,13 @@ static int proc_ide_read_dmodel
static int proc_ide_read_driver
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
ide_drive_t *drive = (ide_drive_t *) data;
struct device *dev = &drive->gendev;
ide_driver_t *ide_drv;
int len;
ide_drive_t *drive = (ide_drive_t *)data;
struct device *dev = &drive->gendev;
struct ide_driver *ide_drv;
int len;

if (dev->driver) {
ide_drv = container_of(dev->driver, ide_driver_t, gen_driver);
ide_drv = to_ide_driver(dev->driver);
len = sprintf(page, "%s version %s\n",
dev->driver->name, ide_drv->version);
} else
Expand Down Expand Up @@ -555,7 +555,7 @@ static void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t
}
}

void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver)
void ide_proc_register_driver(ide_drive_t *drive, struct ide_driver *driver)
{
mutex_lock(&ide_setting_mtx);
drive->settings = driver->proc_devsets(drive);
Expand All @@ -577,7 +577,7 @@ EXPORT_SYMBOL(ide_proc_register_driver);
* Takes ide_setting_mtx.
*/

void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver)
void ide_proc_unregister_driver(ide_drive_t *drive, struct ide_driver *driver)
{
ide_remove_proc_entries(drive->proc, driver->proc_entries(drive));

Expand Down Expand Up @@ -653,7 +653,7 @@ void ide_proc_unregister_port(ide_hwif_t *hwif)

static int proc_print_driver(struct device_driver *drv, void *data)
{
ide_driver_t *ide_drv = container_of(drv, ide_driver_t, gen_driver);
struct ide_driver *ide_drv = to_ide_driver(drv);
struct seq_file *s = data;

seq_printf(s, "%s version %s\n", drv->name, ide_drv->version);
Expand Down
10 changes: 5 additions & 5 deletions drivers/ide/ide-tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ struct idetape_bh {
* to an interrupt or a timer event is stored in the struct defined below.
*/
typedef struct ide_tape_obj {
ide_drive_t *drive;
ide_driver_t *driver;
struct gendisk *disk;
struct kref kref;
ide_drive_t *drive;
struct ide_driver *driver;
struct gendisk *disk;
struct kref kref;

/*
* failed_pc points to the last failed packet command, or contains
Expand Down Expand Up @@ -2313,7 +2313,7 @@ static const struct ide_proc_devset *ide_tape_proc_devsets(ide_drive_t *drive)

static int ide_tape_probe(ide_drive_t *);

static ide_driver_t idetape_driver = {
static struct ide_driver idetape_driver = {
.gen_driver = {
.owner = THIS_MODULE,
.name = "ide-tape",
Expand Down
8 changes: 4 additions & 4 deletions drivers/ide/ide-taskfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
}

if (sectors > 0) {
ide_driver_t *drv;
struct ide_driver *drv;

drv = *(ide_driver_t **)rq->rq_disk->private_data;
drv = *(struct ide_driver **)rq->rq_disk->private_data;
drv->end_request(drive, 1, sectors);
}
}
Expand All @@ -328,9 +328,9 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
}

if (rq->rq_disk) {
ide_driver_t *drv;
struct ide_driver *drv;

drv = *(ide_driver_t **)rq->rq_disk->private_data;;
drv = *(struct ide_driver **)rq->rq_disk->private_data;;
drv->end_request(drive, 1, rq->nr_sectors);
} else
ide_end_request(drive, 1, rq->nr_sectors);
Expand Down
6 changes: 3 additions & 3 deletions drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ static int ide_uevent(struct device *dev, struct kobj_uevent_env *env)
static int generic_ide_probe(struct device *dev)
{
ide_drive_t *drive = to_ide_device(dev);
ide_driver_t *drv = to_ide_driver(dev->driver);
struct ide_driver *drv = to_ide_driver(dev->driver);

return drv->probe ? drv->probe(drive) : -ENODEV;
}

static int generic_ide_remove(struct device *dev)
{
ide_drive_t *drive = to_ide_device(dev);
ide_driver_t *drv = to_ide_driver(dev->driver);
struct ide_driver *drv = to_ide_driver(dev->driver);

if (drv->remove)
drv->remove(drive);
Expand All @@ -300,7 +300,7 @@ static int generic_ide_remove(struct device *dev)
static void generic_ide_shutdown(struct device *dev)
{
ide_drive_t *drive = to_ide_device(dev);
ide_driver_t *drv = to_ide_driver(dev->driver);
struct ide_driver *drv = to_ide_driver(dev->driver);

if (dev->driver && drv->shutdown)
drv->shutdown(drive);
Expand Down
18 changes: 9 additions & 9 deletions include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ struct ide_atapi_pc {
};

struct ide_devset;
struct ide_driver_s;
struct ide_driver;

#ifdef CONFIG_BLK_DEV_IDEACPI
struct ide_acpi_drive_link;
Expand Down Expand Up @@ -884,8 +884,6 @@ typedef int (ide_expiry_t)(ide_drive_t *);
/* used by ide-cd, ide-floppy, etc. */
typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned);

typedef struct ide_driver_s ide_driver_t;

extern struct mutex ide_setting_mtx;

/*
Expand Down Expand Up @@ -1011,8 +1009,8 @@ void ide_proc_register_port(ide_hwif_t *);
void ide_proc_port_register_devices(ide_hwif_t *);
void ide_proc_unregister_device(ide_drive_t *);
void ide_proc_unregister_port(ide_hwif_t *);
void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
void ide_proc_register_driver(ide_drive_t *, struct ide_driver *);
void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *);

read_proc_t proc_ide_read_capacity;
read_proc_t proc_ide_read_geometry;
Expand All @@ -1039,8 +1037,10 @@ static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
static inline void ide_proc_register_driver(ide_drive_t *drive,
struct ide_driver *driver) { ; }
static inline void ide_proc_unregister_driver(ide_drive_t *drive,
struct ide_driver *driver) { ; }
#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
#endif

Expand Down Expand Up @@ -1109,7 +1109,7 @@ void ide_check_pm_state(ide_drive_t *, struct request *);
* The gendriver.owner field should be set to the module owner of this driver.
* The gendriver.name field should be set to the name of this driver
*/
struct ide_driver_s {
struct ide_driver {
const char *version;
ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
int (*end_request)(ide_drive_t *, int, int);
Expand All @@ -1125,7 +1125,7 @@ struct ide_driver_s {
#endif
};

#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
#define to_ide_driver(drv) container_of(drv, struct ide_driver, gen_driver)

int ide_device_get(ide_drive_t *);
void ide_device_put(ide_drive_t *);
Expand Down

0 comments on commit 7f3c868

Please sign in to comment.