Merge tag 'fscache-fixes-20141013' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / include / linux / ipack.h
index 1888e06ddf64d6f08824c9c4f842f9c884e1e1a4..8bddc3fbdddfb164cb4b8dc671311b92441b7460 100644 (file)
@@ -172,6 +172,7 @@ struct ipack_bus_ops {
  *     @ops: bus operations for the mezzanine drivers
  */
 struct ipack_bus_device {
+       struct module *owner;
        struct device *parent;
        int slots;
        int bus_nr;
@@ -189,7 +190,8 @@ struct ipack_bus_device {
  * available bus device in ipack.
  */
 struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots,
-                                           const struct ipack_bus_ops *ops);
+                                           const struct ipack_bus_ops *ops,
+                                           struct module *owner);
 
 /**
  *     ipack_bus_unregister -- unregister an ipack bus
@@ -265,3 +267,23 @@ void ipack_put_device(struct ipack_device *dev);
         .format = (_format), \
         .vendor = (vend), \
         .device = (dev)
+
+/**
+ * ipack_get_carrier - it increase the carrier ref. counter of
+ *                     the carrier module
+ * @dev: mezzanine device which wants to get the carrier
+ */
+static inline int ipack_get_carrier(struct ipack_device *dev)
+{
+       return try_module_get(dev->bus->owner);
+}
+
+/**
+ * ipack_get_carrier - it decrease the carrier ref. counter of
+ *                     the carrier module
+ * @dev: mezzanine device which wants to get the carrier
+ */
+static inline void ipack_put_carrier(struct ipack_device *dev)
+{
+       module_put(dev->bus->owner);
+}