From ac5bdbb7cf6c7520a3a425aa37ff18dcc7bef51b Mon Sep 17 00:00:00 2001 From: Martin Dalecki Date: Thu, 23 May 2002 21:16:28 -0700 Subject: [PATCH] 2.5.17 IDE 70 - Apply host chip driver cleanups by Bartomiej Zonierkiewicz. - Take the draft device type driver implementation from Adam Richter and make it actually work with some of the drivers we have at hand. Quite a lot of it was fixed by me as well to have the desired effects. We have added a attach method for the sub device type drivers to make it possible dor sub device type drivers to attach devices to the overall infrastructure. UNIX has something like this SCSI code is implementing something like this, just for some unknown reasons Linux block device operations don't have it... - ide_drive_t is finally gone. Please use struct ata_device instead. Hint the ide.h specific byte type should go over time as well, sine there is no need to invent something already handled by the kernel. Please use the unambigious u8 type instead where possible. - Add a bit of documentation about cabling issues. ide.txt needs a lot of improvement at some time still. --- include/linux/ide.h | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 16b7c97aff33..2c4e83b48b07 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -317,7 +317,6 @@ typedef union { /* * ATA/ATAPI device structure : */ -typedef struct ata_device { struct ata_channel * channel; char name[6]; /* device name */ @@ -409,7 +408,7 @@ struct ata_device { unsigned long immed_comp; int max_last_depth; int max_depth; -} ide_drive_t; +}; /* * Status returned by various functions. @@ -590,6 +589,7 @@ static inline int ata_can_queue(struct ata_device *drive) struct ata_operations { struct module *owner; + void (*attach) (struct ata_device *); int (*cleanup)(struct ata_device *); int (*standby)(struct ata_device *); ide_startstop_t (*do_request)(struct ata_device *, struct request *, sector_t); @@ -602,6 +602,9 @@ struct ata_operations { void (*revalidate)(struct ata_device *); sector_t (*capacity)(struct ata_device *); + + /* linked list of rgistered device type drivers */ + struct ata_operations *next; }; /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ @@ -618,11 +621,20 @@ do { \ extern sector_t ata_capacity(struct ata_device *drive); -/* FIXME: Actually implement and use them as soon as possible! to make the - * ide_scan_devices() go away! */ - -extern int unregister_ata_driver(unsigned int type, struct ata_operations *driver); -extern int register_ata_driver(unsigned int type, struct ata_operations *driver); +extern void unregister_ata_driver(struct ata_operations *driver); +extern int register_ata_driver(struct ata_operations *driver); +static inline int ata_driver_module(struct ata_operations *driver) +{ +#ifdef MODULE + if (register_ata_driver(driver) <= 0) { + unregister_ata_driver(driver); + return -ENODEV; + } +#else + register_ata_driver(driver); +#endif + return 0; +} #define ata_ops(drive) ((drive)->driver) @@ -797,9 +809,9 @@ extern int idefloppy_init (void); extern int idescsi_init (void); #endif -extern struct ata_device *ide_scan_devices(byte, const char *, struct ata_operations *, int); extern int ide_register_subdriver(struct ata_device *, struct ata_operations *); extern int ide_unregister_subdriver(struct ata_device *drive); +extern int ide_revalidate_disk(kdev_t i_rdev); #ifdef CONFIG_PCI # define ON_BOARD 0 @@ -890,6 +902,5 @@ extern spinlock_t ide_lock; #define DRIVE_LOCK(drive) ((drive)->queue.queue_lock) extern int drive_is_ready(struct ata_device *drive); -extern void revalidate_drives(void); #endif -- cgit v1.2.3