aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ide.h
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:20:49 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:20:49 -0500
commit5b31f855f10d0053e738baa6d91fb6a3fad35119 (patch)
treebdd8125faf6e4b8baf37d86270389b4d6f62f37d /include/linux/ide.h
parentefe0397eef544ac4bcca23d39aa8d5db154952e0 (diff)
ide: use lock bitops for ports serialization (v2)
* Add ->host_busy field to struct ide_host and use it's first bit together with lock bitops to provide new ports serialization method. * Convert core IDE code to use new ide_[un]lock_host() helpers. This removes the need for taking hwgroup->lock if host is already busy on serialized hosts and makes it possible to merge ide_hwgroup_t into ide_hwif_t (done in the later patch). * Remove no longer needed ide_hwgroup_t.busy and ide_[un]lock_hwgroup(). * Update do_ide_request() documentation. v2: * ide_release_lock() should be called inside IDE_HFLAG_SERIALIZE check. * Add ide_hwif_t.busy flag and ide_[un]lock_port() for serializing devices on a port. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h35
1 files changed, 6 insertions, 29 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 8b74ccdd221c..00df155b5a02 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -828,6 +828,7 @@ typedef struct hwif_s {
828 828
829 unsigned present : 1; /* this interface exists */ 829 unsigned present : 1; /* this interface exists */
830 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 830 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
831 unsigned busy : 1; /* serializes devices on a port */
831 832
832 struct device gendev; 833 struct device gendev;
833 struct device *portdev; 834 struct device *portdev;
@@ -851,8 +852,13 @@ struct ide_host {
851 unsigned long host_flags; 852 unsigned long host_flags;
852 void *host_priv; 853 void *host_priv;
853 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 854 ide_hwif_t *cur_port; /* for hosts requiring serialization */
855
856 /* used for hosts requiring serialization */
857 volatile long host_busy;
854}; 858};
855 859
860#define IDE_HOST_BUSY 0
861
856/* 862/*
857 * internal ide interrupt handler type 863 * internal ide interrupt handler type
858 */ 864 */
@@ -866,8 +872,6 @@ typedef struct hwgroup_s {
866 /* irq handler, if active */ 872 /* irq handler, if active */
867 ide_startstop_t (*handler)(ide_drive_t *); 873 ide_startstop_t (*handler)(ide_drive_t *);
868 874
869 /* BOOL: protects all fields below */
870 volatile int busy;
871 /* BOOL: polling active & poll_timeout field valid */ 875 /* BOOL: polling active & poll_timeout field valid */
872 unsigned int polling : 1; 876 unsigned int polling : 1;
873 877
@@ -1271,26 +1275,6 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1271 1275
1272extern void ide_timer_expiry(unsigned long); 1276extern void ide_timer_expiry(unsigned long);
1273extern irqreturn_t ide_intr(int irq, void *dev_id); 1277extern irqreturn_t ide_intr(int irq, void *dev_id);
1274
1275static inline int ide_lock_hwgroup(ide_hwgroup_t *hwgroup, ide_hwif_t *hwif)
1276{
1277 if (hwgroup->busy)
1278 return 1;
1279
1280 hwgroup->busy = 1;
1281 /* for atari only */
1282 ide_get_lock(ide_intr, hwif);
1283
1284 return 0;
1285}
1286
1287static inline void ide_unlock_hwgroup(ide_hwgroup_t *hwgroup)
1288{
1289 /* for atari only */
1290 ide_release_lock();
1291 hwgroup->busy = 0;
1292}
1293
1294extern void do_ide_request(struct request_queue *); 1278extern void do_ide_request(struct request_queue *);
1295 1279
1296void ide_init_disk(struct gendisk *, ide_drive_t *); 1280void ide_init_disk(struct gendisk *, ide_drive_t *);
@@ -1617,13 +1601,6 @@ static inline void ide_set_max_pio(ide_drive_t *drive)
1617 1601
1618extern spinlock_t ide_lock; 1602extern spinlock_t ide_lock;
1619extern struct mutex ide_cfg_mtx; 1603extern struct mutex ide_cfg_mtx;
1620/*
1621 * Structure locking:
1622 *
1623 * ide_hwgroup_t->busy: hwgroup->lock
1624 * ide_hwif_t->{hwgroup,mate}: constant, no locking
1625 * ide_drive_t->hwif: constant, no locking
1626 */
1627 1604
1628#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) 1605#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
1629 1606