Commit 5f066c32 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/therm: fix various style issues, make more consistent

parent bc79202f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -107,10 +107,10 @@ nouveau-y += core/subdev/mxm/nv50.o
nouveau-y += core/subdev/therm/base.o
nouveau-y += core/subdev/therm/fan.o
nouveau-y += core/subdev/therm/ic.o
nouveau-y += core/subdev/therm/temp.o
nouveau-y += core/subdev/therm/nv40.o
nouveau-y += core/subdev/therm/nv50.o
nouveau-y += core/subdev/therm/nvd0.o
nouveau-y += core/subdev/therm/temp.o
nouveau-y += core/subdev/timer/base.o
nouveau-y += core/subdev/timer/nv04.o
nouveau-y += core/subdev/vm/base.o
+14 −1
Original line number Diff line number Diff line
@@ -46,11 +46,24 @@ nouveau_therm(void *obj)
}

#define nouveau_therm_create(p,e,o,d)                                          \
	nouveau_subdev_create((p), (e), (o), 0, "THERM", "therm", d)
	nouveau_therm_create_((p), (e), (o), sizeof(**d), (void **)d)
#define nouveau_therm_destroy(p)                                               \
	nouveau_subdev_destroy(&(p)->base)
#define nouveau_therm_init(p) ({                                               \
	struct nouveau_therm *therm = (p);                                     \
        _nouveau_therm_init(nv_object(therm));                                 \
})
#define nouveau_therm_fini(p,s) ({                                             \
	struct nouveau_therm *therm = (p);                                     \
        _nouveau_therm_init(nv_object(therm), (s));                            \
})

int nouveau_therm_create_(struct nouveau_object *, struct nouveau_object *,
			  struct nouveau_oclass *, int, void **);

#define _nouveau_therm_dtor _nouveau_subdev_dtor
int _nouveau_therm_init(struct nouveau_object *);
int _nouveau_therm_fini(struct nouveau_object *, bool);

extern struct nouveau_oclass nv40_therm_oclass;
extern struct nouveau_oclass nv50_therm_oclass;
+29 −2
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ nouveau_therm_attr_set(struct nouveau_therm *therm,
}

int
nouveau_therm_init(struct nouveau_object *object)
_nouveau_therm_init(struct nouveau_object *object)
{
	struct nouveau_therm *therm = (void *)object;
	struct nouveau_therm_priv *priv = (void *)therm;
@@ -133,7 +133,7 @@ nouveau_therm_init(struct nouveau_object *object)
}

int
nouveau_therm_fini(struct nouveau_object *object, bool suspend)
_nouveau_therm_fini(struct nouveau_object *object, bool suspend)
{
	struct nouveau_therm *therm = (void *)object;
	struct nouveau_therm_priv *priv = (void *)therm;
@@ -142,3 +142,30 @@ nouveau_therm_fini(struct nouveau_object *object, bool suspend)

	return nouveau_subdev_fini(&therm->base, suspend);
}

int
nouveau_therm_create_(struct nouveau_object *parent,
		      struct nouveau_object *engine,
		      struct nouveau_oclass *oclass,
		      int length, void **pobject)
{
	struct nouveau_therm_priv *priv;
	int ret;

	ret = nouveau_subdev_create_(parent, engine, oclass, 0, "PTHERM",
				     "therm", length, pobject);
	priv = *pobject;
	if (ret)
		return ret;

	nouveau_therm_ic_ctor(&priv->base);
	nouveau_therm_sensor_ctor(&priv->base);
	nouveau_therm_fan_ctor(&priv->base);

	priv->base.fan_get = nouveau_therm_fan_user_get;
	priv->base.fan_set = nouveau_therm_fan_user_set;
	priv->base.fan_sense = nouveau_therm_fan_sense;
	priv->base.attr_get = nouveau_therm_attr_get;
	priv->base.attr_set = nouveau_therm_attr_set;
	return 0;
}
+14 −23
Original line number Diff line number Diff line
@@ -25,6 +25,10 @@

#include "priv.h"

struct nv40_therm_priv {
	struct nouveau_therm_priv base;
};

static int
nv40_sensor_setup(struct nouveau_therm *therm)
{
@@ -124,30 +128,17 @@ nv40_therm_ctor(struct nouveau_object *parent,
		struct nouveau_oclass *oclass, void *data, u32 size,
		struct nouveau_object **pobject)
{
	struct nouveau_therm_priv *priv;
	struct nouveau_therm *therm;
	struct nv40_therm_priv *priv;
	int ret;

	ret = nouveau_therm_create(parent, engine, oclass, &priv);
	*pobject = nv_object(priv);
	therm = (void *) priv;
	if (ret)
		return ret;

	nouveau_therm_ic_ctor(therm);
	nouveau_therm_sensor_ctor(therm);
	nouveau_therm_fan_ctor(therm);

	priv->fan.pwm_get = nv40_fan_pwm_get;
	priv->fan.pwm_set = nv40_fan_pwm_set;

	therm->temp_get = nv40_temp_get;
	therm->fan_get = nouveau_therm_fan_user_get;
	therm->fan_set = nouveau_therm_fan_user_set;
	therm->fan_sense = nouveau_therm_fan_sense;
	therm->attr_get = nouveau_therm_attr_get;
	therm->attr_set = nouveau_therm_attr_set;

	priv->base.fan.pwm_get = nv40_fan_pwm_get;
	priv->base.fan.pwm_set = nv40_fan_pwm_set;
	priv->base.base.temp_get = nv40_temp_get;
	return 0;
}

@@ -157,7 +148,7 @@ nv40_therm_oclass = {
	.ofuncs = &(struct nouveau_ofuncs) {
		.ctor = nv40_therm_ctor,
		.dtor = _nouveau_therm_dtor,
		.init = nouveau_therm_init,
		.fini = nouveau_therm_fini,
		.init = _nouveau_therm_init,
		.fini = _nouveau_therm_fini,
	},
};
+14 −23
Original line number Diff line number Diff line
@@ -25,6 +25,10 @@

#include "priv.h"

struct nv50_therm_priv {
	struct nouveau_therm_priv base;
};

static int
pwm_info(struct nouveau_therm *therm, int *line, int *ctrl, int *indx)
{
@@ -117,31 +121,18 @@ nv50_therm_ctor(struct nouveau_object *parent,
		struct nouveau_oclass *oclass, void *data, u32 size,
		struct nouveau_object **pobject)
{
	struct nouveau_therm_priv *priv;
	struct nouveau_therm *therm;
	struct nv50_therm_priv *priv;
	int ret;

	ret = nouveau_therm_create(parent, engine, oclass, &priv);
	*pobject = nv_object(priv);
	therm = (void *) priv;
	if (ret)
		return ret;

	nouveau_therm_ic_ctor(therm);
	nouveau_therm_sensor_ctor(therm);
	nouveau_therm_fan_ctor(therm);

	priv->fan.pwm_get = nv50_fan_pwm_get;
	priv->fan.pwm_set = nv50_fan_pwm_set;
	priv->fan.pwm_clock = nv50_fan_pwm_clock;

	therm->temp_get = nv50_temp_get;
	therm->fan_get = nouveau_therm_fan_user_get;
	therm->fan_set = nouveau_therm_fan_user_set;
	therm->fan_sense = nouveau_therm_fan_sense;
	therm->attr_get = nouveau_therm_attr_get;
	therm->attr_set = nouveau_therm_attr_set;

	priv->base.fan.pwm_get = nv50_fan_pwm_get;
	priv->base.fan.pwm_set = nv50_fan_pwm_set;
	priv->base.fan.pwm_clock = nv50_fan_pwm_clock;
	priv->base.base.temp_get = nv50_temp_get;
	return 0;
}

@@ -151,7 +142,7 @@ nv50_therm_oclass = {
	.ofuncs = &(struct nouveau_ofuncs) {
		.ctor = nv50_therm_ctor,
		.dtor = _nouveau_therm_dtor,
		.init = nouveau_therm_init,
		.fini = nouveau_therm_fini,
		.init = _nouveau_therm_init,
		.fini = _nouveau_therm_fini,
	},
};
Loading