return NULL;
}
-static void mdev_release_parent(struct kref *kref)
+void mdev_release_parent(struct kref *kref)
{
struct mdev_parent *parent = container_of(kref, struct mdev_parent,
ref);
put_device(dev);
}
-static struct mdev_parent *mdev_get_parent(struct mdev_parent *parent)
-{
- if (parent)
- kref_get(&parent->ref);
-
- return parent;
-}
-
-static void mdev_put_parent(struct mdev_parent *parent)
-{
- if (parent)
- kref_put(&parent->ref, mdev_release_parent);
-}
-
/* Caller must hold parent unreg_sem read or write lock */
static void mdev_device_remove_common(struct mdev_device *mdev)
{
{
int ret;
struct mdev_device *mdev, *tmp;
- struct mdev_parent *parent;
-
- parent = mdev_get_parent(type->parent);
- if (!parent)
- return -EINVAL;
+ struct mdev_parent *parent = type->parent;
+ mdev_get_parent(parent);
mutex_lock(&mdev_list_lock);
/* Check for duplicate */
int mdev_device_create(struct mdev_type *kobj, const guid_t *uuid);
int mdev_device_remove(struct mdev_device *dev);
+void mdev_release_parent(struct kref *kref);
+
+static inline void mdev_get_parent(struct mdev_parent *parent)
+{
+ kref_get(&parent->ref);
+}
+
+static inline void mdev_put_parent(struct mdev_parent *parent)
+{
+ kref_put(&parent->ref, mdev_release_parent);
+}
+
#endif /* MDEV_PRIVATE_H */