[PATCH v2 5/7] card-restore: Save and restore "preferred profile" of port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2015-10-27 at 16:09 +0100, David Henningsson wrote:
> diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c
> index 3725d30..b30fa36 100644
> --- a/src/modules/module-card-restore.c
> +++ b/src/modules/module-card-restore.c
> @@ -375,8 +385,30 @@ finish:
>      return PA_HOOK_OK;
>  }
>  
> +static void update_profile_for_port(struct entry *entry, pa_card *card, pa_device_port *p) {
> +    struct port_info *p_info;
> +
> +    if (p == NULL)
> +        return;
> +
> +    if (!(p_info = pa_hashmap_get(entry->ports, p->name))) {
> +        p_info = port_info_new(p);
> +        pa_assert_se(pa_hashmap_put(entry->ports, p_info->name, p_info) >= 0);
> +    }
> +
> +    if (!pa_safe_streq(p_info->profile, p->preferred_profile)) {
> +        pa_xfree(p_info->profile);
> +        p_info->profile = pa_xstrdup(p->preferred_profile);
> +        entry->version = ENTRY_VERSION;

I mentioned in IRC that this is perhaps not the best place to set
entry->version, and that a better place would be where we read or
create the entry structs. If the entry version is updated immediately
after reading the entry, we won't need to add any more version
assignments every time a new field is added to the entry.

-- 
Tanu


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux