ide: add ide_device_{get,put}() helpers

* Add 'struct ide_host *host' field to ide_hwif_t and set it
  in ide_host_alloc_all().

* Add ide_device_{get,put}() helpers loosely based on SCSI's
  scsi_device_{get,put}() ones.

* Convert IDE device drivers to use ide_device_{get,put}().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
Bartlomiej Zolnierkiewicz
2008-07-24 22:53:15 +02:00
parent 6cdf6eb357
commit 08da591e14
8 changed files with 99 additions and 13 deletions

View File

@@ -532,12 +532,16 @@ struct ide_dma_ops {
void (*dma_timeout)(struct ide_drive_s *);
};
struct ide_host;
typedef struct hwif_s {
struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
struct hwif_s *mate; /* other hwif from same PCI chip */
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
struct ide_host *host;
char name[6]; /* name of interface, eg. "ide0" */
struct ide_io_ports io_ports;
@@ -876,6 +880,9 @@ struct ide_driver_s {
#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
int ide_device_get(ide_drive_t *);
void ide_device_put(ide_drive_t *);
int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
extern int ide_vlb_clk;