diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:56 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:56 -0400 |
commit | 374e042c3e767ac2e5a40b78529220e0b3de793c (patch) | |
tree | 433d258f6da9783f0cb34234af9c359353f531fe /drivers/ide/legacy | |
parent | d6276b5f5cc7508124de291f3ed59c6945c17ae7 (diff) |
ide: add struct ide_tp_ops (take 2)
* Add struct ide_tp_ops for transport methods.
* Add 'const struct ide_tp_ops *tp_ops' to struct ide_port_info
and ide_hwif_t.
* Set the default hwif->tp_ops in ide_init_port_data().
* Set host driver specific hwif->tp_ops in ide_init_port().
* Export ide_exec_command(), ide_read_status(), ide_read_altstatus(),
ide_read_sff_dma_status(), ide_set_irq(), ide_tf_{load,read}()
and ata_{in,out}put_data().
* Convert host drivers and core code to use struct ide_tp_ops.
* Remove no longer needed default_hwif_transport().
* Cleanup ide_hwif_t from methods that are now in struct ide_tp_ops.
While at it:
* Use struct ide_port_info in falconide.c and q40ide.c.
* Rename ata_{in,out}put_data() to ide_{in,out}put_data().
v2:
* Fix missing convertion in ns87415.c.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r-- | drivers/ide/legacy/falconide.c | 27 | ||||
-rw-r--r-- | drivers/ide/legacy/q40ide.c | 27 |
2 files changed, 44 insertions, 10 deletions
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index 1bb2aa72cc7f..3e2c6125f031 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c | |||
@@ -66,6 +66,27 @@ static void falconide_output_data(ide_drive_t *drive, struct request *rq, | |||
66 | outsw_swapw(data_addr, buf, (len + 1) / 2); | 66 | outsw_swapw(data_addr, buf, (len + 1) / 2); |
67 | } | 67 | } |
68 | 68 | ||
69 | /* Atari has a byte-swapped IDE interface */ | ||
70 | static const struct ide_tp_ops falconide_tp_ops = { | ||
71 | .exec_command = ide_exec_command, | ||
72 | .read_status = ide_read_status, | ||
73 | .read_altstatus = ide_read_altstatus, | ||
74 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
75 | |||
76 | .set_irq = ide_set_irq, | ||
77 | |||
78 | .tf_load = ide_tf_load, | ||
79 | .tf_read = ide_tf_read, | ||
80 | |||
81 | .input_data = falconide_input_data, | ||
82 | .output_data = falconide_output_data, | ||
83 | }; | ||
84 | |||
85 | static const struct ide_port_info falconide_port_info = { | ||
86 | .tp_ops = &falconide_tp_ops, | ||
87 | .host_flags = IDE_HFLAG_NO_DMA, | ||
88 | }; | ||
89 | |||
69 | static void __init falconide_setup_ports(hw_regs_t *hw) | 90 | static void __init falconide_setup_ports(hw_regs_t *hw) |
70 | { | 91 | { |
71 | int i; | 92 | int i; |
@@ -111,12 +132,8 @@ static int __init falconide_init(void) | |||
111 | u8 index = hwif->index; | 132 | u8 index = hwif->index; |
112 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | 133 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; |
113 | 134 | ||
114 | /* Atari has a byte-swapped IDE interface */ | ||
115 | hwif->input_data = falconide_input_data; | ||
116 | hwif->output_data = falconide_output_data; | ||
117 | |||
118 | ide_get_lock(NULL, NULL); | 135 | ide_get_lock(NULL, NULL); |
119 | ide_device_add(idx, NULL, hws); | 136 | ide_device_add(idx, &falconide_port_info, hws); |
120 | ide_release_lock(); | 137 | ide_release_lock(); |
121 | } | 138 | } |
122 | 139 | ||
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index fcb04b8b0238..2dc306f852a6 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -96,6 +96,27 @@ static void q40ide_output_data(ide_drive_t *drive, struct request *rq, | |||
96 | outsw_swapw(data_addr, buf, (len + 1) / 2); | 96 | outsw_swapw(data_addr, buf, (len + 1) / 2); |
97 | } | 97 | } |
98 | 98 | ||
99 | /* Q40 has a byte-swapped IDE interface */ | ||
100 | static const struct ide_tp_ops q40ide_tp_ops = { | ||
101 | .exec_command = ide_exec_command, | ||
102 | .read_status = ide_read_status, | ||
103 | .read_altstatus = ide_read_altstatus, | ||
104 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
105 | |||
106 | .set_irq = ide_set_irq, | ||
107 | |||
108 | .tf_load = ide_tf_load, | ||
109 | .tf_read = ide_tf_read, | ||
110 | |||
111 | .input_data = q40ide_input_data, | ||
112 | .output_data = q40ide_output_data, | ||
113 | }; | ||
114 | |||
115 | static const struct ide_port_info q40ide_port_info = { | ||
116 | .tp_ops = &q40ide_tp_ops, | ||
117 | .host_flags = IDE_HFLAG_NO_DMA, | ||
118 | }; | ||
119 | |||
99 | /* | 120 | /* |
100 | * the static array is needed to have the name reported in /proc/ioports, | 121 | * the static array is needed to have the name reported in /proc/ioports, |
101 | * hwif->name unfortunately isn't available yet | 122 | * hwif->name unfortunately isn't available yet |
@@ -141,16 +162,12 @@ static int __init q40ide_init(void) | |||
141 | if (hwif) { | 162 | if (hwif) { |
142 | hwif->chipset = ide_generic; | 163 | hwif->chipset = ide_generic; |
143 | 164 | ||
144 | /* Q40 has a byte-swapped IDE interface */ | ||
145 | hwif->input_data = q40ide_input_data; | ||
146 | hwif->output_data = q40ide_output_data; | ||
147 | |||
148 | hws[i] = &hw[i]; | 165 | hws[i] = &hw[i]; |
149 | idx[i] = hwif->index; | 166 | idx[i] = hwif->index; |
150 | } | 167 | } |
151 | } | 168 | } |
152 | 169 | ||
153 | ide_device_add(idx, NULL, hws); | 170 | ide_device_add(idx, &q40ide_port_info, hws); |
154 | 171 | ||
155 | return 0; | 172 | return 0; |
156 | } | 173 | } |