From: Ahmad Fatoum <a.fat...@barebox.org>

The function is already used from two places and long enough that we
probably don't want to duplicate it more than once in the final binary.

Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>
---
 fs/devfs-core.c  | 16 ++++++++++++++++
 include/driver.h | 17 ++---------------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 2617eeea0706..f67c86b2267e 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -126,6 +126,22 @@ struct cdev *cdev_by_diskuuid(const char *diskuuid)
        return NULL;
 }
 
+struct cdev *
+cdev_find_child_by_gpt_typeuuid(struct cdev *cdev, guid_t *typeuuid)
+{
+       struct cdev *partcdev;
+
+       if (!cdev_is_gpt_partitioned(cdev))
+               return ERR_PTR(-EINVAL);
+
+       for_each_cdev_partition(partcdev, cdev) {
+               if (guid_equal(&partcdev->typeuuid, typeuuid))
+                       return partcdev;
+       }
+
+       return ERR_PTR(-ENOENT);
+}
+
 /**
  * device_find_partition - find a partition belonging to a physical device
  *
diff --git a/include/driver.h b/include/driver.h
index 094347d4577e..d01d026b687b 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -608,21 +608,8 @@ static inline bool cdev_is_gpt_partitioned(const struct 
cdev *master)
        return master && (master->flags & DEVFS_IS_GPT_PARTITIONED);
 }
 
-static inline struct cdev *
-cdev_find_child_by_gpt_typeuuid(struct cdev *cdev, guid_t *typeuuid)
-{
-       struct cdev *partcdev;
-
-       if (!cdev_is_gpt_partitioned(cdev))
-               return ERR_PTR(-EINVAL);
-
-       for_each_cdev_partition(partcdev, cdev) {
-               if (guid_equal(&partcdev->typeuuid, typeuuid))
-                       return partcdev;
-       }
-
-       return ERR_PTR(-ENOENT);
-}
+struct cdev *
+cdev_find_child_by_gpt_typeuuid(struct cdev *cdev, guid_t *typeuuid);
 
 #ifdef CONFIG_FS_AUTOMOUNT
 void cdev_create_default_automount(struct cdev *cdev);
-- 
2.39.5


Reply via email to