All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Martin Peres <martin.peres-GANU6spQydw@public.gmane.org>,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH 1/3] subdev: add a pfuse subdev
Date: Mon, 25 Aug 2014 00:35:03 +0100	[thread overview]
Message-ID: <53FA76A7.4090803@gmail.com> (raw)
In-Reply-To: <1408914911-5022-1-git-send-email-martin.peres-GANU6spQydw@public.gmane.org>

On 24/08/14 22:15, Martin Peres wrote:
> We will use this subdev to disable temperature reading on cards that did not
> get a sensor calibration in the factory.
> 
> Signed-off-by: Martin Peres <martin.peres-GANU6spQydw@public.gmane.org>
> ---
>  configure.ac                   |  1 +
>  drm/Kbuild                     |  4 ++
>  drm/core/include/subdev/fuse.h |  1 +
>  drm/core/subdev/fuse/base.c    |  1 +
>  drm/core/subdev/fuse/g80.c     |  1 +
>  drm/core/subdev/fuse/gf100.c   |  1 +
>  drm/core/subdev/fuse/gm107.c   |  1 +
>  drm/core/subdev/fuse/priv.h    |  1 +
>  nvkm/engine/device/gm100.c     |  2 +
>  nvkm/engine/device/nv50.c      | 15 ++++++++
>  nvkm/engine/device/nvc0.c      | 10 +++++
>  nvkm/engine/device/nve0.c      |  8 ++++
>  nvkm/include/core/device.h     |  1 +
>  nvkm/include/subdev/fuse.h     | 30 +++++++++++++++
>  nvkm/subdev/Makefile.am        |  3 +-
>  nvkm/subdev/fuse/Makefile.am   |  8 ++++
>  nvkm/subdev/fuse/base.c        | 62 +++++++++++++++++++++++++++++++
>  nvkm/subdev/fuse/g80.c         | 81 +++++++++++++++++++++++++++++++++++++++++
>  nvkm/subdev/fuse/gf100.c       | 83 ++++++++++++++++++++++++++++++++++++++++++
>  nvkm/subdev/fuse/gm107.c       | 66 +++++++++++++++++++++++++++++++++
>  nvkm/subdev/fuse/priv.h        |  9 +++++
>  21 files changed, 388 insertions(+), 1 deletion(-)
>  create mode 120000 drm/core/include/subdev/fuse.h
>  create mode 120000 drm/core/subdev/fuse/base.c
>  create mode 120000 drm/core/subdev/fuse/g80.c
>  create mode 120000 drm/core/subdev/fuse/gf100.c
>  create mode 120000 drm/core/subdev/fuse/gm107.c
>  create mode 120000 drm/core/subdev/fuse/priv.h
>  create mode 100644 nvkm/include/subdev/fuse.h
>  create mode 100644 nvkm/subdev/fuse/Makefile.am
>  create mode 100644 nvkm/subdev/fuse/base.c
>  create mode 100644 nvkm/subdev/fuse/g80.c
>  create mode 100644 nvkm/subdev/fuse/gf100.c
>  create mode 100644 nvkm/subdev/fuse/gm107.c
>  create mode 100644 nvkm/subdev/fuse/priv.h
> 
[snip]
> diff --git a/nvkm/subdev/fuse/base.c b/nvkm/subdev/fuse/base.c
> new file mode 100644
> index 0000000..d249f2b
> --- /dev/null
> +++ b/nvkm/subdev/fuse/base.c
> @@ -0,0 +1,62 @@
> +/*
> + * Copyright 2014 Martin Peres
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + *
> + * Authors: Martin Peres
> + */
> +
> +#include <subdev/fuse.h>
> +
> +int
> +_nouveau_fuse_init(struct nouveau_object *object)
> +{
> +	struct nouveau_fuse *fuse = (void *)object;
> +	int ret;
> +
> +	ret = nouveau_subdev_init(&fuse->base);
> +	if (ret)
> +		return ret;
> +
If you want you can drop the check the extra variable.

> +	return 0;
> +}
> +
> +void
> +_nouveau_fuse_dtor(struct nouveau_object *object)
> +{
> +	struct nouveau_fuse *fuse = (void *)object;
> +	nouveau_subdev_destroy(&fuse->base);
> +}
> +
> +int
> +nouveau_fuse_create_(struct nouveau_object *parent,
> +		     struct nouveau_object *engine,
> +		     struct nouveau_oclass *oclass, int length, void **pobject)
> +{
> +	struct nouveau_fuse *fuse;
> +	int ret;
> +
> +	ret = nouveau_subdev_create_(parent, engine, oclass, 0, "FUSE",
> +				     "fuse", length, pobject);
                                                     ^^^^^^^
I think you want to use &fuse                        here ?

> +	fuse = *pobject;
Swap the assignment order and move it past the conditional ?

> +	if (ret)
> +		return ret;
> +

+ *pobject = fuse;

And perhaps return 0, to make it obvious and consistent with the second case
below.

> +	return ret;
> +}
[snip]
> diff --git a/nvkm/subdev/fuse/gm107.c b/nvkm/subdev/fuse/gm107.c
> new file mode 100644
> index 0000000..4ade700
> --- /dev/null
> +++ b/nvkm/subdev/fuse/gm107.c
> @@ -0,0 +1,66 @@
[snip]
> +static int
> +gm107_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
> +	       struct nouveau_oclass *oclass, void *data, u32 size,
> +	       struct nouveau_object **pobject)
> +{
> +	struct gm107_fuse_priv *priv;
> +	int ret;
> +
> +	ret = nouveau_fuse_create(parent, engine, oclass, &priv);
> +	*pobject = nv_object(priv);
Believe the above assignment should go after the check ?

Nice job :)
-Emil

> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}
> +

  parent reply	other threads:[~2014-08-24 23:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-24 21:15 [PATCH 1/3] subdev: add a pfuse subdev Martin Peres
     [not found] ` <1408914911-5022-1-git-send-email-martin.peres-GANU6spQydw@public.gmane.org>
2014-08-24 21:15   ` [PATCH 2/3] therm: make sure the temperature settings are sane on nv84+ Martin Peres
2014-08-24 21:15   ` [PATCH 3/3] therm/nv84+: do not expose non-calibrated internal temp sensor Martin Peres
     [not found]     ` <1408914911-5022-3-git-send-email-martin.peres-GANU6spQydw@public.gmane.org>
2014-08-27 22:53       ` Ben Skeggs
2014-08-24 22:27   ` [PATCH 1/3] subdev: add a pfuse subdev Christian Costa
     [not found]     ` <53FA66D3.8000703-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-24 22:29       ` Martin Peres
2014-08-24 23:35   ` Emil Velikov [this message]
     [not found]     ` <53FA76A7.4090803-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-25  0:07       ` Ben Skeggs
2014-08-25 22:26   ` [PATCH] subdev: add a pfuse subdev v2 Martin Peres

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=53FA76A7.4090803@gmail.com \
    --to=emil.l.velikov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=martin.peres-GANU6spQydw@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /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.