dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Glisse <j.glisse@gmail.com>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Jerome Glisse <jglisse@redhat.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH libdrm 04/24] radeon: annotate bof_incref, bof_string functions as static
Date: Wed, 1 Apr 2015 13:32:08 -0400	[thread overview]
Message-ID: <20150401173207.GD5061@gmail.com> (raw)
In-Reply-To: <1427904935-14387-5-git-send-email-emil.l.velikov@gmail.com>

On Wed, Apr 01, 2015 at 05:15:15PM +0100, Emil Velikov wrote:
> Used locally in bof.c.
> 
> Cc: Jerome Glisse <jglisse@redhat.com>
> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>


NAK

I use all this in tools to debug lockup. Best course of action is to
exclude bof.h from being distributed. My tools static link and i just
point them to libdrm git tree.

Cheers,
Jérôme

> ---
>  radeon/bof.c | 96 ++++++++++++++++++++++++++++++------------------------------
>  radeon/bof.h |  3 --
>  2 files changed, 48 insertions(+), 51 deletions(-)
> 
> diff --git a/radeon/bof.c b/radeon/bof.c
> index 6f3760a..20901a0 100644
> --- a/radeon/bof.c
> +++ b/radeon/bof.c
> @@ -45,6 +45,54 @@ static int bof_entry_grow(bof_t *bof)
>  	return 0;
>  }
>  
> +static void bof_incref(bof_t *bof)
> +{
> +	bof->refcount++;
> +}
> +
> +void bof_decref(bof_t *bof)
> +{
> +	unsigned i;
> +
> +	if (bof == NULL)
> +		return;
> +	if (--bof->refcount > 0)
> +		return;
> +	for (i = 0; i < bof->array_size; i++) {
> +		bof_decref(bof->array[i]);
> +		bof->array[i] = NULL;
> +	}
> +	bof->array_size = 0;
> +	if (bof->file) {
> +		fclose(bof->file);
> +		bof->file = NULL;
> +	}
> +	free(bof->array);
> +	free(bof->value);
> +	free(bof);
> +}
> +
> +/*
> + * string
> + */
> +static bof_t *bof_string(const char *value)
> +{
> +	bof_t *string = bof_object();
> +
> +	if (string == NULL)
> +		return NULL;
> +	string->type = BOF_TYPE_STRING;
> +	string->size = strlen(value) + 1;
> +	string->value = calloc(1, string->size);
> +	if (string->value == NULL) {
> +		bof_decref(string);
> +		return NULL;
> +	}
> +	strcpy(string->value, value);
> +	string->size += 12;
> +	return string;
> +}
> +
>  /*
>   * object 
>   */
> @@ -160,27 +208,6 @@ void *bof_blob_value(bof_t *bof)
>  }
>  
>  /*
> - * string
> - */
> -bof_t *bof_string(const char *value)
> -{
> -	bof_t *string = bof_object();
> -
> -	if (string == NULL)
> -		return NULL;
> -	string->type = BOF_TYPE_STRING;
> -	string->size = strlen(value) + 1;
> -	string->value = calloc(1, string->size);
> -	if (string->value == NULL) {
> -		bof_decref(string);
> -		return NULL;
> -	}
> -	strcpy(string->value, value);
> -	string->size += 12;
> -	return string;
> -}
> -
> -/*
>   *  int32
>   */
>  bof_t *bof_int32(int32_t value)
> @@ -316,33 +343,6 @@ out_err:
>  	return -EINVAL;
>  }
>  
> -void bof_incref(bof_t *bof)
> -{
> -	bof->refcount++;
> -}
> -
> -void bof_decref(bof_t *bof)
> -{
> -	unsigned i;
> -
> -	if (bof == NULL)
> -		return;
> -	if (--bof->refcount > 0)
> -		return;
> -	for (i = 0; i < bof->array_size; i++) {
> -		bof_decref(bof->array[i]);
> -		bof->array[i] = NULL;
> -	}
> -	bof->array_size = 0;
> -	if (bof->file) {
> -		fclose(bof->file);
> -		bof->file = NULL;
> -	}
> -	free(bof->array);
> -	free(bof->value);
> -	free(bof);
> -}
> -
>  static int bof_file_write(bof_t *bof, FILE *file)
>  {
>  	unsigned i;
> diff --git a/radeon/bof.h b/radeon/bof.h
> index 8e952c1..4dae923 100644
> --- a/radeon/bof.h
> +++ b/radeon/bof.h
> @@ -63,14 +63,11 @@ extern unsigned bof_array_size(bof_t *bof);
>  extern bof_t *bof_blob(unsigned size, void *value);
>  extern unsigned bof_blob_size(bof_t *bof);
>  extern void *bof_blob_value(bof_t *bof);
> -/* string */
> -extern bof_t *bof_string(const char *value);
>  /* int32 */
>  extern bof_t *bof_int32(int32_t value);
>  extern int32_t bof_int32_value(bof_t *bof);
>  /* common functions */
>  extern void bof_decref(bof_t *bof);
> -extern void bof_incref(bof_t *bof);
>  extern int bof_dump_file(bof_t *bof, const char *filename);
>  
>  static inline int bof_is_object(bof_t *bof){return (bof->type == BOF_TYPE_OBJECT);}
> -- 
> 2.3.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-04-01 17:32 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 16:15 [PATCH libdrm 00/24] Annotate private symbols, drop drm_public macro Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 01/24] configure.ac: split -fvisibility and __attribute__((visibility)) checks Emil Velikov
2015-04-08  0:18   ` Alan Coopersmith
2015-04-01 16:15 ` [PATCH libdrm 02/24] radeon: remove empty function declarations Emil Velikov
2015-04-01 17:30   ` Jerome Glisse
2015-04-01 20:34     ` Emil Velikov
2015-04-01 20:57       ` Emil Velikov
2015-04-01 21:26         ` Jerome Glisse
2015-04-01 22:04           ` Emil Velikov
2015-04-02  3:51             ` Jerome Glisse
2015-04-01 21:24       ` Jerome Glisse
2015-04-01 16:15 ` [PATCH libdrm 03/24] radeon: remove unused functions Emil Velikov
2015-04-01 17:31   ` Jerome Glisse
2015-04-01 16:15 ` [PATCH libdrm 04/24] radeon: annotate bof_incref, bof_string functions as static Emil Velikov
2015-04-01 17:31   ` Jerome Glisse
2015-04-01 17:32   ` Jerome Glisse [this message]
2015-04-01 16:15 ` [PATCH libdrm 05/24] radeon: remove more unused functions Emil Velikov
2015-04-01 17:32   ` Jerome Glisse
2015-04-01 16:15 ` [PATCH libdrm 06/24] radeon: remove no-longer used static functions Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 07/24] radeon: annotate the private symbols Emil Velikov
2015-04-02  2:48   ` Michel Dänzer
2015-04-02  3:57     ` Jerome Glisse
2015-04-02 23:10       ` Emil Velikov
2015-04-05 15:29         ` [PATCH libdrm v2 02/19] radeon: move bof.[ch] out of libdrm_radeon Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 08/24] radeon: add symbols test Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 09/24] freedreno: annotate the private symbols Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 10/24] freedreno: add symbols test Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 11/24] intel: remove the drm_mm* symbol workarounds Emil Velikov
2015-04-09 14:56   ` Emil Velikov
2015-04-10  6:05     ` Eric Anholt
2015-04-10 17:40       ` Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 12/24] intel: remove unused mmFindBlock Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 13/24] intel: annotate the private symbols Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 14/24] intel: add symbols test Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 15/24] nouveau: annotate the private symbols Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 16/24] nouveau: add symbols test Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 17/24] libkms: annotate private symbols Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 18/24] libkms: add symbols test Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 19/24] exynos: " Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 20/24] omap: " Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 21/24] tegra: " Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 22/24] drm: rename libdrm{,_macros}.h Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 23/24] drm: remove no longer needed VISIBILITY_CFLAGS Emil Velikov
2015-04-01 16:15 ` [PATCH libdrm 24/24] drm: remove drm_public macro Emil Velikov
2015-04-21 15:41 ` [PATCH libdrm 00/24] Annotate private symbols, drop " Emil Velikov

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=20150401173207.GD5061@gmail.com \
    --to=j.glisse@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=jglisse@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox