diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:22 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:22 -0400 |
commit | e354c1d8033d97a97a38a1b2cffa1bc285b92ad4 (patch) | |
tree | cd520f7cd4a417c1f78d81e3a3b62936697b35f6 | |
parent | d15a613ba01ff2b209ecad7a38ccbb23b3b06c92 (diff) |
ide: remove IDE_ARCH_LOCK (v2)
* Add ->{get,release}_lock methods to struct ide_port_info
and struct ide_host.
* Convert core IDE code, m68k IDE code and falconide support to use
->{get,release}_lock methods instead of ide_{get,release}_lock().
* Remove IDE_ARCH_LOCK.
v2:
* Build fix from Geert updating ide_{get,release}_lock() callers in
falconide.c.
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | arch/m68k/include/asm/ide.h | 36 | ||||
-rw-r--r-- | drivers/ide/falconide.c | 29 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 8 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 2 | ||||
-rw-r--r-- | include/linux/ide.h | 17 |
5 files changed, 42 insertions, 50 deletions
diff --git a/arch/m68k/include/asm/ide.h b/arch/m68k/include/asm/ide.h index 9f95f06eebe2..4e6e77759f88 100644 --- a/arch/m68k/include/asm/ide.h +++ b/arch/m68k/include/asm/ide.h | |||
@@ -36,11 +36,6 @@ | |||
36 | #include <asm/io.h> | 36 | #include <asm/io.h> |
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | 38 | ||
39 | #ifdef CONFIG_ATARI | ||
40 | #include <linux/interrupt.h> | ||
41 | #include <asm/atari_stdma.h> | ||
42 | #endif | ||
43 | |||
44 | #ifdef CONFIG_MAC | 39 | #ifdef CONFIG_MAC |
45 | #include <asm/macints.h> | 40 | #include <asm/macints.h> |
46 | #endif | 41 | #endif |
@@ -92,36 +87,5 @@ | |||
92 | #define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n) | 87 | #define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n) |
93 | #endif | 88 | #endif |
94 | 89 | ||
95 | #ifdef CONFIG_BLK_DEV_FALCON_IDE | ||
96 | #define IDE_ARCH_LOCK | ||
97 | |||
98 | extern int falconide_intr_lock; | ||
99 | |||
100 | static __inline__ void ide_release_lock (void) | ||
101 | { | ||
102 | if (MACH_IS_ATARI) { | ||
103 | if (falconide_intr_lock == 0) { | ||
104 | printk("ide_release_lock: bug\n"); | ||
105 | return; | ||
106 | } | ||
107 | falconide_intr_lock = 0; | ||
108 | stdma_release(); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | static __inline__ void | ||
113 | ide_get_lock(irq_handler_t handler, void *data) | ||
114 | { | ||
115 | if (MACH_IS_ATARI) { | ||
116 | if (falconide_intr_lock == 0) { | ||
117 | if (in_interrupt() > 0) | ||
118 | panic( "Falcon IDE hasn't ST-DMA lock in interrupt" ); | ||
119 | stdma_lock(handler, data); | ||
120 | falconide_intr_lock = 1; | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | #endif /* CONFIG_BLK_DEV_FALCON_IDE */ | ||
125 | |||
126 | #endif /* __KERNEL__ */ | 90 | #endif /* __KERNEL__ */ |
127 | #endif /* _M68K_IDE_H */ | 91 | #endif /* _M68K_IDE_H */ |
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index a638e952d67a..d4d7ff1a3516 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c | |||
@@ -40,8 +40,27 @@ | |||
40 | * which is shared between several drivers. | 40 | * which is shared between several drivers. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | int falconide_intr_lock; | 43 | static int falconide_intr_lock; |
44 | EXPORT_SYMBOL(falconide_intr_lock); | 44 | |
45 | static void falconide_release_lock(void) | ||
46 | { | ||
47 | if (falconide_intr_lock == 0) { | ||
48 | printk(KERN_ERR "%s: bug\n", __func__); | ||
49 | return; | ||
50 | } | ||
51 | falconide_intr_lock = 0; | ||
52 | stdma_release(); | ||
53 | } | ||
54 | |||
55 | static void falconide_get_lock(irq_handler_t handler, void *data) | ||
56 | { | ||
57 | if (falconide_intr_lock == 0) { | ||
58 | if (in_interrupt() > 0) | ||
59 | panic("Falcon IDE hasn't ST-DMA lock in interrupt"); | ||
60 | stdma_lock(handler, data); | ||
61 | falconide_intr_lock = 1; | ||
62 | } | ||
63 | } | ||
45 | 64 | ||
46 | static void falconide_input_data(ide_drive_t *drive, struct request *rq, | 65 | static void falconide_input_data(ide_drive_t *drive, struct request *rq, |
47 | void *buf, unsigned int len) | 66 | void *buf, unsigned int len) |
@@ -81,6 +100,8 @@ static const struct ide_tp_ops falconide_tp_ops = { | |||
81 | }; | 100 | }; |
82 | 101 | ||
83 | static const struct ide_port_info falconide_port_info = { | 102 | static const struct ide_port_info falconide_port_info = { |
103 | .get_lock = falconide_get_lock, | ||
104 | .release_lock = falconide_release_lock, | ||
84 | .tp_ops = &falconide_tp_ops, | 105 | .tp_ops = &falconide_tp_ops, |
85 | .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE, | 106 | .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE, |
86 | }; | 107 | }; |
@@ -132,9 +153,9 @@ static int __init falconide_init(void) | |||
132 | goto err; | 153 | goto err; |
133 | } | 154 | } |
134 | 155 | ||
135 | ide_get_lock(NULL, NULL); | 156 | falconide_get_lock(NULL, NULL); |
136 | rc = ide_host_register(host, &falconide_port_info, hws); | 157 | rc = ide_host_register(host, &falconide_port_info, hws); |
137 | ide_release_lock(); | 158 | falconide_release_lock(); |
138 | 159 | ||
139 | if (rc) | 160 | if (rc) |
140 | goto err_free; | 161 | goto err_free; |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e85060164203..030b0ea1a1e1 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -501,8 +501,8 @@ static inline int ide_lock_host(struct ide_host *host, ide_hwif_t *hwif) | |||
501 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { | 501 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { |
502 | rc = test_and_set_bit_lock(IDE_HOST_BUSY, &host->host_busy); | 502 | rc = test_and_set_bit_lock(IDE_HOST_BUSY, &host->host_busy); |
503 | if (rc == 0) { | 503 | if (rc == 0) { |
504 | /* for atari only */ | 504 | if (host->get_lock) |
505 | ide_get_lock(ide_intr, hwif); | 505 | host->get_lock(ide_intr, hwif); |
506 | } | 506 | } |
507 | } | 507 | } |
508 | return rc; | 508 | return rc; |
@@ -511,8 +511,8 @@ static inline int ide_lock_host(struct ide_host *host, ide_hwif_t *hwif) | |||
511 | static inline void ide_unlock_host(struct ide_host *host) | 511 | static inline void ide_unlock_host(struct ide_host *host) |
512 | { | 512 | { |
513 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { | 513 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { |
514 | /* for atari only */ | 514 | if (host->release_lock) |
515 | ide_release_lock(); | 515 | host->release_lock(); |
516 | clear_bit_unlock(IDE_HOST_BUSY, &host->host_busy); | 516 | clear_bit_unlock(IDE_HOST_BUSY, &host->host_busy); |
517 | } | 517 | } |
518 | } | 518 | } |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index b0510b033d78..a3edbb5d0452 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1325,6 +1325,8 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) | |||
1325 | 1325 | ||
1326 | if (d) { | 1326 | if (d) { |
1327 | host->init_chipset = d->init_chipset; | 1327 | host->init_chipset = d->init_chipset; |
1328 | host->get_lock = d->get_lock; | ||
1329 | host->release_lock = d->release_lock; | ||
1328 | host->host_flags = d->host_flags; | 1330 | host->host_flags = d->host_flags; |
1329 | } | 1331 | } |
1330 | 1332 | ||
diff --git a/include/linux/ide.h b/include/linux/ide.h index cda80b5779a4..b7d95f09cc2e 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -202,12 +202,6 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
202 | 202 | ||
203 | #define MAX_HWIFS 10 | 203 | #define MAX_HWIFS 10 |
204 | 204 | ||
205 | /* Currently only Atari needs it */ | ||
206 | #ifndef IDE_ARCH_LOCK | ||
207 | # define ide_release_lock() do {} while (0) | ||
208 | # define ide_get_lock(hdlr, data) do {} while (0) | ||
209 | #endif /* IDE_ARCH_LOCK */ | ||
210 | |||
211 | /* | 205 | /* |
212 | * Now for the data we need to maintain per-drive: ide_drive_t | 206 | * Now for the data we need to maintain per-drive: ide_drive_t |
213 | */ | 207 | */ |
@@ -845,8 +839,14 @@ struct ide_host { | |||
845 | ide_hwif_t *ports[MAX_HOST_PORTS + 1]; | 839 | ide_hwif_t *ports[MAX_HOST_PORTS + 1]; |
846 | unsigned int n_ports; | 840 | unsigned int n_ports; |
847 | struct device *dev[2]; | 841 | struct device *dev[2]; |
842 | |||
848 | int (*init_chipset)(struct pci_dev *); | 843 | int (*init_chipset)(struct pci_dev *); |
844 | |||
845 | void (*get_lock)(irq_handler_t, void *); | ||
846 | void (*release_lock)(void); | ||
847 | |||
849 | irq_handler_t irq_handler; | 848 | irq_handler_t irq_handler; |
849 | |||
850 | unsigned long host_flags; | 850 | unsigned long host_flags; |
851 | void *host_priv; | 851 | void *host_priv; |
852 | ide_hwif_t *cur_port; /* for hosts requiring serialization */ | 852 | ide_hwif_t *cur_port; /* for hosts requiring serialization */ |
@@ -1358,7 +1358,12 @@ enum { | |||
1358 | 1358 | ||
1359 | struct ide_port_info { | 1359 | struct ide_port_info { |
1360 | char *name; | 1360 | char *name; |
1361 | |||
1361 | int (*init_chipset)(struct pci_dev *); | 1362 | int (*init_chipset)(struct pci_dev *); |
1363 | |||
1364 | void (*get_lock)(irq_handler_t, void *); | ||
1365 | void (*release_lock)(void); | ||
1366 | |||
1362 | void (*init_iops)(ide_hwif_t *); | 1367 | void (*init_iops)(ide_hwif_t *); |
1363 | void (*init_hwif)(ide_hwif_t *); | 1368 | void (*init_hwif)(ide_hwif_t *); |
1364 | int (*init_dma)(ide_hwif_t *, | 1369 | int (*init_dma)(ide_hwif_t *, |