diff options
-rw-r--r-- | drivers/ipack/carriers/tpci200.c | 3 | ||||
-rw-r--r-- | drivers/ipack/ipack.c | 4 | ||||
-rw-r--r-- | include/linux/ipack.h | 24 |
3 files changed, 28 insertions, 3 deletions
diff --git a/drivers/ipack/carriers/tpci200.c b/drivers/ipack/carriers/tpci200.c index de5e32151a1e..9b23843dcad4 100644 --- a/drivers/ipack/carriers/tpci200.c +++ b/drivers/ipack/carriers/tpci200.c | |||
@@ -572,7 +572,8 @@ static int tpci200_pci_probe(struct pci_dev *pdev, | |||
572 | /* Register the carrier in the industry pack bus driver */ | 572 | /* Register the carrier in the industry pack bus driver */ |
573 | tpci200->info->ipack_bus = ipack_bus_register(&pdev->dev, | 573 | tpci200->info->ipack_bus = ipack_bus_register(&pdev->dev, |
574 | TPCI200_NB_SLOT, | 574 | TPCI200_NB_SLOT, |
575 | &tpci200_bus_ops); | 575 | &tpci200_bus_ops, |
576 | THIS_MODULE); | ||
576 | if (!tpci200->info->ipack_bus) { | 577 | if (!tpci200->info->ipack_bus) { |
577 | dev_err(&pdev->dev, | 578 | dev_err(&pdev->dev, |
578 | "error registering the carrier on ipack driver\n"); | 579 | "error registering the carrier on ipack driver\n"); |
diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c index d0016ba469ed..c0e7b624ce54 100644 --- a/drivers/ipack/ipack.c +++ b/drivers/ipack/ipack.c | |||
@@ -206,7 +206,8 @@ static struct bus_type ipack_bus_type = { | |||
206 | }; | 206 | }; |
207 | 207 | ||
208 | struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, | 208 | struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, |
209 | const struct ipack_bus_ops *ops) | 209 | const struct ipack_bus_ops *ops, |
210 | struct module *owner) | ||
210 | { | 211 | { |
211 | int bus_nr; | 212 | int bus_nr; |
212 | struct ipack_bus_device *bus; | 213 | struct ipack_bus_device *bus; |
@@ -225,6 +226,7 @@ struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, | |||
225 | bus->parent = parent; | 226 | bus->parent = parent; |
226 | bus->slots = slots; | 227 | bus->slots = slots; |
227 | bus->ops = ops; | 228 | bus->ops = ops; |
229 | bus->owner = owner; | ||
228 | return bus; | 230 | return bus; |
229 | } | 231 | } |
230 | EXPORT_SYMBOL_GPL(ipack_bus_register); | 232 | EXPORT_SYMBOL_GPL(ipack_bus_register); |
diff --git a/include/linux/ipack.h b/include/linux/ipack.h index 1888e06ddf64..8bddc3fbdddf 100644 --- a/include/linux/ipack.h +++ b/include/linux/ipack.h | |||
@@ -172,6 +172,7 @@ struct ipack_bus_ops { | |||
172 | * @ops: bus operations for the mezzanine drivers | 172 | * @ops: bus operations for the mezzanine drivers |
173 | */ | 173 | */ |
174 | struct ipack_bus_device { | 174 | struct ipack_bus_device { |
175 | struct module *owner; | ||
175 | struct device *parent; | 176 | struct device *parent; |
176 | int slots; | 177 | int slots; |
177 | int bus_nr; | 178 | int bus_nr; |
@@ -189,7 +190,8 @@ struct ipack_bus_device { | |||
189 | * available bus device in ipack. | 190 | * available bus device in ipack. |
190 | */ | 191 | */ |
191 | struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, | 192 | struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, |
192 | const struct ipack_bus_ops *ops); | 193 | const struct ipack_bus_ops *ops, |
194 | struct module *owner); | ||
193 | 195 | ||
194 | /** | 196 | /** |
195 | * ipack_bus_unregister -- unregister an ipack bus | 197 | * ipack_bus_unregister -- unregister an ipack bus |
@@ -265,3 +267,23 @@ void ipack_put_device(struct ipack_device *dev); | |||
265 | .format = (_format), \ | 267 | .format = (_format), \ |
266 | .vendor = (vend), \ | 268 | .vendor = (vend), \ |
267 | .device = (dev) | 269 | .device = (dev) |
270 | |||
271 | /** | ||
272 | * ipack_get_carrier - it increase the carrier ref. counter of | ||
273 | * the carrier module | ||
274 | * @dev: mezzanine device which wants to get the carrier | ||
275 | */ | ||
276 | static inline int ipack_get_carrier(struct ipack_device *dev) | ||
277 | { | ||
278 | return try_module_get(dev->bus->owner); | ||
279 | } | ||
280 | |||
281 | /** | ||
282 | * ipack_get_carrier - it decrease the carrier ref. counter of | ||
283 | * the carrier module | ||
284 | * @dev: mezzanine device which wants to get the carrier | ||
285 | */ | ||
286 | static inline void ipack_put_carrier(struct ipack_device *dev) | ||
287 | { | ||
288 | module_put(dev->bus->owner); | ||
289 | } | ||