diff options
Diffstat (limited to 'drivers/rapidio')
-rw-r--r-- | drivers/rapidio/rio.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index cc2a3b74d0f0..d520dbaede80 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
@@ -68,9 +68,13 @@ int rio_request_inb_mbox(struct rio_mport *mport, | |||
68 | void (*minb) (struct rio_mport * mport, void *dev_id, int mbox, | 68 | void (*minb) (struct rio_mport * mport, void *dev_id, int mbox, |
69 | int slot)) | 69 | int slot)) |
70 | { | 70 | { |
71 | int rc = 0; | 71 | int rc = -ENOSYS; |
72 | struct resource *res; | ||
72 | 73 | ||
73 | struct resource *res = kmalloc(sizeof(struct resource), GFP_KERNEL); | 74 | if (mport->ops->open_inb_mbox == NULL) |
75 | goto out; | ||
76 | |||
77 | res = kmalloc(sizeof(struct resource), GFP_KERNEL); | ||
74 | 78 | ||
75 | if (res) { | 79 | if (res) { |
76 | rio_init_mbox_res(res, mbox, mbox); | 80 | rio_init_mbox_res(res, mbox, mbox); |
@@ -88,7 +92,7 @@ int rio_request_inb_mbox(struct rio_mport *mport, | |||
88 | /* Hook the inbound message callback */ | 92 | /* Hook the inbound message callback */ |
89 | mport->inb_msg[mbox].mcback = minb; | 93 | mport->inb_msg[mbox].mcback = minb; |
90 | 94 | ||
91 | rc = rio_open_inb_mbox(mport, dev_id, mbox, entries); | 95 | rc = mport->ops->open_inb_mbox(mport, dev_id, mbox, entries); |
92 | } else | 96 | } else |
93 | rc = -ENOMEM; | 97 | rc = -ENOMEM; |
94 | 98 | ||
@@ -106,10 +110,13 @@ int rio_request_inb_mbox(struct rio_mport *mport, | |||
106 | */ | 110 | */ |
107 | int rio_release_inb_mbox(struct rio_mport *mport, int mbox) | 111 | int rio_release_inb_mbox(struct rio_mport *mport, int mbox) |
108 | { | 112 | { |
109 | rio_close_inb_mbox(mport, mbox); | 113 | if (mport->ops->close_inb_mbox) { |
114 | mport->ops->close_inb_mbox(mport, mbox); | ||
110 | 115 | ||
111 | /* Release the mailbox resource */ | 116 | /* Release the mailbox resource */ |
112 | return release_resource(mport->inb_msg[mbox].res); | 117 | return release_resource(mport->inb_msg[mbox].res); |
118 | } else | ||
119 | return -ENOSYS; | ||
113 | } | 120 | } |
114 | 121 | ||
115 | /** | 122 | /** |
@@ -129,9 +136,13 @@ int rio_request_outb_mbox(struct rio_mport *mport, | |||
129 | int entries, | 136 | int entries, |
130 | void (*moutb) (struct rio_mport * mport, void *dev_id, int mbox, int slot)) | 137 | void (*moutb) (struct rio_mport * mport, void *dev_id, int mbox, int slot)) |
131 | { | 138 | { |
132 | int rc = 0; | 139 | int rc = -ENOSYS; |
140 | struct resource *res; | ||
133 | 141 | ||
134 | struct resource *res = kmalloc(sizeof(struct resource), GFP_KERNEL); | 142 | if (mport->ops->open_outb_mbox == NULL) |
143 | goto out; | ||
144 | |||
145 | res = kmalloc(sizeof(struct resource), GFP_KERNEL); | ||
135 | 146 | ||
136 | if (res) { | 147 | if (res) { |
137 | rio_init_mbox_res(res, mbox, mbox); | 148 | rio_init_mbox_res(res, mbox, mbox); |
@@ -149,7 +160,7 @@ int rio_request_outb_mbox(struct rio_mport *mport, | |||
149 | /* Hook the inbound message callback */ | 160 | /* Hook the inbound message callback */ |
150 | mport->outb_msg[mbox].mcback = moutb; | 161 | mport->outb_msg[mbox].mcback = moutb; |
151 | 162 | ||
152 | rc = rio_open_outb_mbox(mport, dev_id, mbox, entries); | 163 | rc = mport->ops->open_outb_mbox(mport, dev_id, mbox, entries); |
153 | } else | 164 | } else |
154 | rc = -ENOMEM; | 165 | rc = -ENOMEM; |
155 | 166 | ||
@@ -167,10 +178,13 @@ int rio_request_outb_mbox(struct rio_mport *mport, | |||
167 | */ | 178 | */ |
168 | int rio_release_outb_mbox(struct rio_mport *mport, int mbox) | 179 | int rio_release_outb_mbox(struct rio_mport *mport, int mbox) |
169 | { | 180 | { |
170 | rio_close_outb_mbox(mport, mbox); | 181 | if (mport->ops->close_outb_mbox) { |
182 | mport->ops->close_outb_mbox(mport, mbox); | ||
171 | 183 | ||
172 | /* Release the mailbox resource */ | 184 | /* Release the mailbox resource */ |
173 | return release_resource(mport->outb_msg[mbox].res); | 185 | return release_resource(mport->outb_msg[mbox].res); |
186 | } else | ||
187 | return -ENOSYS; | ||
174 | } | 188 | } |
175 | 189 | ||
176 | /** | 190 | /** |