hidpp20: move down hidpp20_initialize
@@ -1696,35 +1696,6 @@ hidpp20_onboard_profiles_compute_dict_size(const struct hidpp20_device *device,
return num_offset;
}
-int
-hidpp20_onboard_profiles_initialize(struct hidpp20_device *device,
- struct hidpp20_profiles *profiles)
-{
- unsigned i;
- int rc;
- _cleanup_free_ uint8_t *data = NULL;
-
- assert(profiles);
-
- data = hidpp20_onboard_profiles_allocate_sector(profiles);
-
- rc = hidpp20_onboard_profiles_read_sector(device, 0, profiles->sector_size, data);
- if (rc < 0)
- return rc;
-
- for (i = 0; i < profiles->num_profiles; i++) {
- uint8_t *d = data + 4 * i;
-
- if (d[0] == 0xFF && d[1] == 0xFF)
- break;
-
- profiles->profiles[i].index = d[1];
- profiles->profiles[i].enabled = !!d[2];
- }
-
- return profiles->num_profiles;
-}
-
void
hidpp20_onboard_profiles_destroy(struct hidpp20_profiles *profiles_list)
{
@@ -2022,6 +1993,35 @@ int hidpp20_onboard_profiles_read(struct hidpp20_device *device,
return 0;
}
+int
+hidpp20_onboard_profiles_initialize(struct hidpp20_device *device,
+ struct hidpp20_profiles *profiles)
+{
+ unsigned i;
+ int rc;
+ _cleanup_free_ uint8_t *data = NULL;
+
+ assert(profiles);
+
+ data = hidpp20_onboard_profiles_allocate_sector(profiles);
+
+ rc = hidpp20_onboard_profiles_read_sector(device, 0, profiles->sector_size, data);
+ if (rc < 0)
+ return rc;
+
+ for (i = 0; i < profiles->num_profiles; i++) {
+ uint8_t *d = data + 4 * i;
+
+ if (d[0] == 0xFF && d[1] == 0xFF)
+ break;
+
+ profiles->profiles[i].index = d[1];
+ profiles->profiles[i].enabled = !!d[2];
+ }
+
+ return profiles->num_profiles;
+}
+
static void
hidpp20_onboard_profiles_write_led(struct hidpp20_internal_led *internal_led,
struct hidpp20_led *led)
