All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de,
	ffado-devel@lists.sf.net
Subject: Re: [PATCH 06/10] ctl: deprecate APIs to add an element set with a single element
Date: Mon, 13 Jun 2016 14:51:13 +0200	[thread overview]
Message-ID: <s5heg815k1q.wl-tiwai@suse.de> (raw)
In-Reply-To: <1465719371-27721-7-git-send-email-o-takashi@sakamocchi.jp>

On Sun, 12 Jun 2016 10:16:07 +0200,
Takashi Sakamoto wrote:
> 
> When comparing old APIs (to add a single element) with new APIs (to add
> an element set), the latter has an benefit to get full identical
> information for a first element in the element set. Furthermore, in
> previous commit, the old APIs become simple wrappers to the new APIs.
> Therefore, there's few intentions to use the old APIs.
>
> This commit deprecates the old APIs to encourage the usage of new APIs.

In general, it's a bad idea to deprecate an API that has been actually
used, and even a worse idea to give a link warning.  We've done
deprecation for some API functions in the past, and it wasn't a really
smart move.  But it was still justified that they were really unused
API functions.  In this case, however, it's commonly used API.  That's
a big difference.

I know several system libraries like Gtk+ often deprecating API
functions.  But it's more annoying than useful for developers and
users.  Unless you are masochistic, the likely first reaction after
seeing such a warning is: "upstream sucks again".


thanks,

Takashi

> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> ---
>  include/control.h     | 17 ++++++++++++-----
>  src/control/control.c | 20 ++++++++++++++++++++
>  2 files changed, 32 insertions(+), 5 deletions(-)
> 
> diff --git a/include/control.h b/include/control.h
> index d6069ff..e21a58a 100644
> --- a/include/control.h
> +++ b/include/control.h
> @@ -443,14 +443,21 @@ int snd_ctl_elem_add_enumerated_set(snd_ctl_t *ctl, snd_ctl_elem_id_t *id,
>  int snd_ctl_elem_add_bytes_set(snd_ctl_t *ctl, snd_ctl_elem_id_t *id,
>  			       unsigned int element_count,
>  			       unsigned int member_count);
> -
> -int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long imin, long imax, long istep);
> -int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long long imin, long long imax, long long istep);
> -int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count);
> -int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, unsigned int items, const char *const names[]);
>  int snd_ctl_elem_add_iec958(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id);
>  int snd_ctl_elem_remove(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
>  
> +int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
> +		unsigned int count, long imin, long imax,
> +		long istep) __attribute__((deprecated));
> +int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
> +		unsigned int count, long long imin, long long imax,
> +		long long istep) __attribute__((deprecated));
> +int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
> +		unsigned int count) __attribute__((deprecated));
> +int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
> +		unsigned int count, unsigned int items,
> +		const char *const names[]) __attribute__((deprecated));
> +
>  size_t snd_ctl_elem_value_sizeof(void);
>  /** \hideinitializer
>   * \brief allocate an invalid #snd_ctl_elem_value_t using standard alloca
> diff --git a/src/control/control.c b/src/control/control.c
> index fbc5e18..6893012 100644
> --- a/src/control/control.c
> +++ b/src/control/control.c
> @@ -677,6 +677,8 @@ int snd_ctl_elem_add_bytes_set(snd_ctl_t *ctl, snd_ctl_elem_id_t *id,
>   *
>   * This function is a wrapper function to snd_ctl_elem_add_integer_set() for
>   * single control element.
> + *
> + * \deprecated Since 1.1.2. Use snd_ctl_elem_add_integer_set(), instead.
>   */
>  int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  			     unsigned int member_count,
> @@ -690,12 +692,17 @@ int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  	return snd_ctl_elem_add_integer_set(ctl, local_id, 1, member_count,
>  					    min, max, step);
>  }
> +link_warning(snd_ctl_elem_add_integer,
> +	     "Warning: snd_ctl_elem_add_integer is deprecated, "
> +	     "Use snd_ctl_elem_add_integer_set, instead.");
>  
>  /**
>   * \brief Create and add an user-defined control element of integer64 type.
>   *
>   * This function is a wrapper function to snd_ctl_elem_add_integer64_set() for
>   * single control element.
> + *
> + * \deprecated Since 1.1.2. Use snd_ctl_elem_add_integer64_set(), instead.
>   */
>  int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  			       unsigned int member_count,
> @@ -709,12 +716,17 @@ int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  	return snd_ctl_elem_add_integer64_set(ctl, local_id, 1, member_count,
>  					      min, max, step);
>  }
> +link_warning(snd_ctl_elem_add_integer64,
> +	     "Warning: snd_ctl_elem_add_integer64 is deprecated, "
> +	     "Use snd_ctl_elem_add_integer64_set, instead.");
>  
>  /**
>   * \brief Create and add an user-defined control element of boolean type.
>   *
>   * This function is a wrapper function to snd_ctl_elem_add_boolean_set() for
>   * single control element.
> + *
> + * \deprecated Since 1.1.2. Use snd_ctl_elem_add_boolean_set(), instead.
>   */
>  int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  			     unsigned int member_count)
> @@ -726,6 +738,9 @@ int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  
>  	return snd_ctl_elem_add_boolean_set(ctl, local_id, 1, member_count);
>  }
> +link_warning(snd_ctl_elem_add_boolean,
> +	     "Warning: snd_ctl_elem_add_boolean is deprecated, "
> +	     "Use snd_ctl_elem_add_boolean_set, instead.");
>  
>  /**
>   * \brief Create and add a user-defined control element of enumerated type.
> @@ -734,6 +749,8 @@ int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>   * single control element.
>   *
>   * This function is added in version 1.0.25.
> + *
> + * \deprecated Since 1.1.2. Use snd_ctl_elem_add_enumerated_set(), instead.
>   */
>  int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  				unsigned int member_count, unsigned int items,
> @@ -747,6 +764,9 @@ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  	return snd_ctl_elem_add_enumerated_set(ctl, local_id, 1, member_count,
>  					       items, labels);
>  }
> +link_warning(snd_ctl_elem_add_enumerated,
> +	     "Warning: snd_ctl_elem_add_enumerated is deprecated, "
> +	     "Use snd_ctl_elem_add_enumerated_set, instead.");
>  
>  /**
>   * \brief Create and add a user-defined control element of IEC958 type.
> -- 
> 2.7.4
> 

  reply	other threads:[~2016-06-13 12:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12  8:16 [alsa-lib][PATCH 00/10 v2] ctl: add APIs for control element set Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 01/10] ctl: add an overview for design of ALSA control interface Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 02/10] ctl: improve comments for handling element data Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 03/10] ctl: add functions to add an element set Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 04/10] ctl: improve comments for API to add an element of IEC958 type Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 05/10] ctl: change former APIs as wrapper functions of element set APIs Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 06/10] ctl: deprecate APIs to add an element set with a single element Takashi Sakamoto
2016-06-13 12:51   ` Takashi Iwai [this message]
2016-06-14 11:25     ` Takashi Sakamoto
2016-06-14 11:46       ` Takashi Iwai
2016-06-15  6:57         ` Takashi Sakamoto
2016-06-15  6:59           ` Takashi Iwai
2016-06-15  7:23             ` Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 07/10] pcm: use new APIs to add a control element set for softvol plugin Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 08/10] ctl: add explaination about threshold level feature Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 09/10] ctl: improve API documentation for threshold level operations Takashi Sakamoto
2016-06-12  8:16 ` [PATCH 10/10] ctl: add test program for control element set Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5heg815k1q.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=ffado-devel@lists.sf.net \
    --cc=o-takashi@sakamocchi.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.