diff options
author | Matt Porter <mporter@kernel.crashing.org> | 2005-11-07 04:00:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:47 -0500 |
commit | 6978bbc097c2f665c336927a9d56ae39ef75fa56 (patch) | |
tree | 541673cd413025c09b52984c5dc0333133c46a71 /drivers/rapidio | |
parent | 2b0c28d7f8846f80a436093e906f5175d1fa8f55 (diff) |
[PATCH] rapidio: message interface updates
Updates the RIO messaging interface to pass a device instance into the
event registeration and callbacks.
Signed-off-by: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/rapidio')
-rw-r--r-- | drivers/rapidio/rio-sysfs.c | 4 | ||||
-rw-r--r-- | drivers/rapidio/rio.c | 25 |
2 files changed, 18 insertions, 11 deletions
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index 73218a37506d..30a11436e241 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c | |||
@@ -21,7 +21,7 @@ | |||
21 | /* Sysfs support */ | 21 | /* Sysfs support */ |
22 | #define rio_config_attr(field, format_string) \ | 22 | #define rio_config_attr(field, format_string) \ |
23 | static ssize_t \ | 23 | static ssize_t \ |
24 | field##_show(struct device *dev, char *buf) \ | 24 | field##_show(struct device *dev, struct device_attribute *attr, char *buf) \ |
25 | { \ | 25 | { \ |
26 | struct rio_dev *rdev = to_rio_dev(dev); \ | 26 | struct rio_dev *rdev = to_rio_dev(dev); \ |
27 | \ | 27 | \ |
@@ -35,7 +35,7 @@ rio_config_attr(asm_did, "0x%04x\n"); | |||
35 | rio_config_attr(asm_vid, "0x%04x\n"); | 35 | rio_config_attr(asm_vid, "0x%04x\n"); |
36 | rio_config_attr(asm_rev, "0x%04x\n"); | 36 | rio_config_attr(asm_rev, "0x%04x\n"); |
37 | 37 | ||
38 | static ssize_t routes_show(struct device *dev, char *buf) | 38 | static ssize_t routes_show(struct device *dev, struct device_attribute *attr, char *buf) |
39 | { | 39 | { |
40 | struct rio_dev *rdev = to_rio_dev(dev); | 40 | struct rio_dev *rdev = to_rio_dev(dev); |
41 | char *str = buf; | 41 | char *str = buf; |
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index adc299e2b07e..3ca1011ceaac 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
@@ -48,6 +48,7 @@ u16 rio_local_get_device_id(struct rio_mport *port) | |||
48 | /** | 48 | /** |
49 | * rio_request_inb_mbox - request inbound mailbox service | 49 | * rio_request_inb_mbox - request inbound mailbox service |
50 | * @mport: RIO master port from which to allocate the mailbox resource | 50 | * @mport: RIO master port from which to allocate the mailbox resource |
51 | * @dev_id: Device specific pointer to pass on event | ||
51 | * @mbox: Mailbox number to claim | 52 | * @mbox: Mailbox number to claim |
52 | * @entries: Number of entries in inbound mailbox queue | 53 | * @entries: Number of entries in inbound mailbox queue |
53 | * @minb: Callback to execute when inbound message is received | 54 | * @minb: Callback to execute when inbound message is received |
@@ -56,9 +57,10 @@ u16 rio_local_get_device_id(struct rio_mport *port) | |||
56 | * a callback function to the resource. Returns %0 on success. | 57 | * a callback function to the resource. Returns %0 on success. |
57 | */ | 58 | */ |
58 | int rio_request_inb_mbox(struct rio_mport *mport, | 59 | int rio_request_inb_mbox(struct rio_mport *mport, |
60 | void *dev_id, | ||
59 | int mbox, | 61 | int mbox, |
60 | int entries, | 62 | int entries, |
61 | void (*minb) (struct rio_mport * mport, int mbox, | 63 | void (*minb) (struct rio_mport * mport, void *dev_id, int mbox, |
62 | int slot)) | 64 | int slot)) |
63 | { | 65 | { |
64 | int rc = 0; | 66 | int rc = 0; |
@@ -81,7 +83,7 @@ int rio_request_inb_mbox(struct rio_mport *mport, | |||
81 | /* Hook the inbound message callback */ | 83 | /* Hook the inbound message callback */ |
82 | mport->inb_msg[mbox].mcback = minb; | 84 | mport->inb_msg[mbox].mcback = minb; |
83 | 85 | ||
84 | rc = rio_open_inb_mbox(mport, mbox, entries); | 86 | rc = rio_open_inb_mbox(mport, dev_id, mbox, entries); |
85 | } else | 87 | } else |
86 | rc = -ENOMEM; | 88 | rc = -ENOMEM; |
87 | 89 | ||
@@ -108,6 +110,7 @@ int rio_release_inb_mbox(struct rio_mport *mport, int mbox) | |||
108 | /** | 110 | /** |
109 | * rio_request_outb_mbox - request outbound mailbox service | 111 | * rio_request_outb_mbox - request outbound mailbox service |
110 | * @mport: RIO master port from which to allocate the mailbox resource | 112 | * @mport: RIO master port from which to allocate the mailbox resource |
113 | * @dev_id: Device specific pointer to pass on event | ||
111 | * @mbox: Mailbox number to claim | 114 | * @mbox: Mailbox number to claim |
112 | * @entries: Number of entries in outbound mailbox queue | 115 | * @entries: Number of entries in outbound mailbox queue |
113 | * @moutb: Callback to execute when outbound message is sent | 116 | * @moutb: Callback to execute when outbound message is sent |
@@ -116,10 +119,10 @@ int rio_release_inb_mbox(struct rio_mport *mport, int mbox) | |||
116 | * a callback function to the resource. Returns 0 on success. | 119 | * a callback function to the resource. Returns 0 on success. |
117 | */ | 120 | */ |
118 | int rio_request_outb_mbox(struct rio_mport *mport, | 121 | int rio_request_outb_mbox(struct rio_mport *mport, |
122 | void *dev_id, | ||
119 | int mbox, | 123 | int mbox, |
120 | int entries, | 124 | int entries, |
121 | void (*moutb) (struct rio_mport * mport, int mbox, | 125 | void (*moutb) (struct rio_mport * mport, void *dev_id, int mbox, int slot)) |
122 | int slot)) | ||
123 | { | 126 | { |
124 | int rc = 0; | 127 | int rc = 0; |
125 | 128 | ||
@@ -141,7 +144,7 @@ int rio_request_outb_mbox(struct rio_mport *mport, | |||
141 | /* Hook the inbound message callback */ | 144 | /* Hook the inbound message callback */ |
142 | mport->outb_msg[mbox].mcback = moutb; | 145 | mport->outb_msg[mbox].mcback = moutb; |
143 | 146 | ||
144 | rc = rio_open_outb_mbox(mport, mbox, entries); | 147 | rc = rio_open_outb_mbox(mport, dev_id, mbox, entries); |
145 | } else | 148 | } else |
146 | rc = -ENOMEM; | 149 | rc = -ENOMEM; |
147 | 150 | ||
@@ -168,6 +171,7 @@ int rio_release_outb_mbox(struct rio_mport *mport, int mbox) | |||
168 | /** | 171 | /** |
169 | * rio_setup_inb_dbell - bind inbound doorbell callback | 172 | * rio_setup_inb_dbell - bind inbound doorbell callback |
170 | * @mport: RIO master port to bind the doorbell callback | 173 | * @mport: RIO master port to bind the doorbell callback |
174 | * @dev_id: Device specific pointer to pass on event | ||
171 | * @res: Doorbell message resource | 175 | * @res: Doorbell message resource |
172 | * @dinb: Callback to execute when doorbell is received | 176 | * @dinb: Callback to execute when doorbell is received |
173 | * | 177 | * |
@@ -176,8 +180,8 @@ int rio_release_outb_mbox(struct rio_mport *mport, int mbox) | |||
176 | * satisfied. | 180 | * satisfied. |
177 | */ | 181 | */ |
178 | static int | 182 | static int |
179 | rio_setup_inb_dbell(struct rio_mport *mport, struct resource *res, | 183 | rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res, |
180 | void (*dinb) (struct rio_mport * mport, u16 src, u16 dst, | 184 | void (*dinb) (struct rio_mport * mport, void *dev_id, u16 src, u16 dst, |
181 | u16 info)) | 185 | u16 info)) |
182 | { | 186 | { |
183 | int rc = 0; | 187 | int rc = 0; |
@@ -190,6 +194,7 @@ rio_setup_inb_dbell(struct rio_mport *mport, struct resource *res, | |||
190 | 194 | ||
191 | dbell->res = res; | 195 | dbell->res = res; |
192 | dbell->dinb = dinb; | 196 | dbell->dinb = dinb; |
197 | dbell->dev_id = dev_id; | ||
193 | 198 | ||
194 | list_add_tail(&dbell->node, &mport->dbells); | 199 | list_add_tail(&dbell->node, &mport->dbells); |
195 | 200 | ||
@@ -200,6 +205,7 @@ rio_setup_inb_dbell(struct rio_mport *mport, struct resource *res, | |||
200 | /** | 205 | /** |
201 | * rio_request_inb_dbell - request inbound doorbell message service | 206 | * rio_request_inb_dbell - request inbound doorbell message service |
202 | * @mport: RIO master port from which to allocate the doorbell resource | 207 | * @mport: RIO master port from which to allocate the doorbell resource |
208 | * @dev_id: Device specific pointer to pass on event | ||
203 | * @start: Doorbell info range start | 209 | * @start: Doorbell info range start |
204 | * @end: Doorbell info range end | 210 | * @end: Doorbell info range end |
205 | * @dinb: Callback to execute when doorbell is received | 211 | * @dinb: Callback to execute when doorbell is received |
@@ -209,9 +215,10 @@ rio_setup_inb_dbell(struct rio_mport *mport, struct resource *res, | |||
209 | * has been satisfied. | 215 | * has been satisfied. |
210 | */ | 216 | */ |
211 | int rio_request_inb_dbell(struct rio_mport *mport, | 217 | int rio_request_inb_dbell(struct rio_mport *mport, |
218 | void *dev_id, | ||
212 | u16 start, | 219 | u16 start, |
213 | u16 end, | 220 | u16 end, |
214 | void (*dinb) (struct rio_mport * mport, u16 src, | 221 | void (*dinb) (struct rio_mport * mport, void *dev_id, u16 src, |
215 | u16 dst, u16 info)) | 222 | u16 dst, u16 info)) |
216 | { | 223 | { |
217 | int rc = 0; | 224 | int rc = 0; |
@@ -230,7 +237,7 @@ int rio_request_inb_dbell(struct rio_mport *mport, | |||
230 | } | 237 | } |
231 | 238 | ||
232 | /* Hook the doorbell callback */ | 239 | /* Hook the doorbell callback */ |
233 | rc = rio_setup_inb_dbell(mport, res, dinb); | 240 | rc = rio_setup_inb_dbell(mport, dev_id, res, dinb); |
234 | } else | 241 | } else |
235 | rc = -ENOMEM; | 242 | rc = -ENOMEM; |
236 | 243 | ||