drm/nouveau/therm: fix various style issues, make more consistent
Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Martin Peres <martin.peres@labri.fr>
This commit is contained in:
parent
bc79202f4c
commit
5f066c32a5
@ -107,10 +107,10 @@ nouveau-y += core/subdev/mxm/nv50.o
|
|||||||
nouveau-y += core/subdev/therm/base.o
|
nouveau-y += core/subdev/therm/base.o
|
||||||
nouveau-y += core/subdev/therm/fan.o
|
nouveau-y += core/subdev/therm/fan.o
|
||||||
nouveau-y += core/subdev/therm/ic.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/nv40.o
|
||||||
nouveau-y += core/subdev/therm/nv50.o
|
nouveau-y += core/subdev/therm/nv50.o
|
||||||
nouveau-y += core/subdev/therm/nvd0.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/base.o
|
||||||
nouveau-y += core/subdev/timer/nv04.o
|
nouveau-y += core/subdev/timer/nv04.o
|
||||||
nouveau-y += core/subdev/vm/base.o
|
nouveau-y += core/subdev/vm/base.o
|
||||||
|
@ -46,11 +46,24 @@ nouveau_therm(void *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define nouveau_therm_create(p,e,o,d) \
|
#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) \
|
#define nouveau_therm_destroy(p) \
|
||||||
nouveau_subdev_destroy(&(p)->base)
|
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
|
#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 nv40_therm_oclass;
|
||||||
extern struct nouveau_oclass nv50_therm_oclass;
|
extern struct nouveau_oclass nv50_therm_oclass;
|
||||||
|
@ -116,7 +116,7 @@ nouveau_therm_attr_set(struct nouveau_therm *therm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_init(struct nouveau_object *object)
|
_nouveau_therm_init(struct nouveau_object *object)
|
||||||
{
|
{
|
||||||
struct nouveau_therm *therm = (void *)object;
|
struct nouveau_therm *therm = (void *)object;
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nouveau_therm_priv *priv = (void *)therm;
|
||||||
@ -133,7 +133,7 @@ nouveau_therm_init(struct nouveau_object *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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 *therm = (void *)object;
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
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);
|
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;
|
||||||
|
}
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
|
struct nv40_therm_priv {
|
||||||
|
struct nouveau_therm_priv base;
|
||||||
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_sensor_setup(struct nouveau_therm *therm)
|
nv40_sensor_setup(struct nouveau_therm *therm)
|
||||||
{
|
{
|
||||||
@ -120,34 +124,21 @@ nv40_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_therm_ctor(struct nouveau_object *parent,
|
nv40_therm_ctor(struct nouveau_object *parent,
|
||||||
struct nouveau_object *engine,
|
struct nouveau_object *engine,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nouveau_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_object **pobject)
|
struct nouveau_object **pobject)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv;
|
struct nv40_therm_priv *priv;
|
||||||
struct nouveau_therm *therm;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
therm = (void *) priv;
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nouveau_therm_ic_ctor(therm);
|
priv->base.fan.pwm_get = nv40_fan_pwm_get;
|
||||||
nouveau_therm_sensor_ctor(therm);
|
priv->base.fan.pwm_set = nv40_fan_pwm_set;
|
||||||
nouveau_therm_fan_ctor(therm);
|
priv->base.base.temp_get = nv40_temp_get;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +148,7 @@ nv40_therm_oclass = {
|
|||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nouveau_ofuncs) {
|
||||||
.ctor = nv40_therm_ctor,
|
.ctor = nv40_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nouveau_therm_dtor,
|
||||||
.init = nouveau_therm_init,
|
.init = _nouveau_therm_init,
|
||||||
.fini = nouveau_therm_fini,
|
.fini = _nouveau_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
|
struct nv50_therm_priv {
|
||||||
|
struct nouveau_therm_priv base;
|
||||||
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pwm_info(struct nouveau_therm *therm, int *line, int *ctrl, int *indx)
|
pwm_info(struct nouveau_therm *therm, int *line, int *ctrl, int *indx)
|
||||||
{
|
{
|
||||||
@ -113,35 +117,22 @@ nv50_temp_get(struct nouveau_therm *therm)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
nv50_therm_ctor(struct nouveau_object *parent,
|
nv50_therm_ctor(struct nouveau_object *parent,
|
||||||
struct nouveau_object *engine,
|
struct nouveau_object *engine,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nouveau_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_object **pobject)
|
struct nouveau_object **pobject)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv;
|
struct nv50_therm_priv *priv;
|
||||||
struct nouveau_therm *therm;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
therm = (void *) priv;
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nouveau_therm_ic_ctor(therm);
|
priv->base.fan.pwm_get = nv50_fan_pwm_get;
|
||||||
nouveau_therm_sensor_ctor(therm);
|
priv->base.fan.pwm_set = nv50_fan_pwm_set;
|
||||||
nouveau_therm_fan_ctor(therm);
|
priv->base.fan.pwm_clock = nv50_fan_pwm_clock;
|
||||||
|
priv->base.base.temp_get = nv50_temp_get;
|
||||||
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;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +142,7 @@ nv50_therm_oclass = {
|
|||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nouveau_ofuncs) {
|
||||||
.ctor = nv50_therm_ctor,
|
.ctor = nv50_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nouveau_therm_dtor,
|
||||||
.init = nouveau_therm_init,
|
.init = _nouveau_therm_init,
|
||||||
.fini = nouveau_therm_fini,
|
.fini = _nouveau_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
|
struct nvd0_therm_priv {
|
||||||
|
struct nouveau_therm_priv base;
|
||||||
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pwm_info(struct nouveau_therm *therm, int line)
|
pwm_info(struct nouveau_therm *therm, int line)
|
||||||
{
|
{
|
||||||
@ -73,34 +77,22 @@ nvd0_fan_pwm_clock(struct nouveau_therm *therm)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
nvd0_therm_ctor(struct nouveau_object *parent,
|
nvd0_therm_ctor(struct nouveau_object *parent,
|
||||||
struct nouveau_object *engine,
|
struct nouveau_object *engine,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nouveau_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_object **pobject)
|
struct nouveau_object **pobject)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv;
|
struct nvd0_therm_priv *priv;
|
||||||
struct nouveau_therm *therm;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
therm = (void *) priv;
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nouveau_therm_ic_ctor(therm);
|
priv->base.fan.pwm_get = nvd0_fan_pwm_get;
|
||||||
nouveau_therm_sensor_ctor(therm);
|
priv->base.fan.pwm_set = nvd0_fan_pwm_set;
|
||||||
nouveau_therm_fan_ctor(therm);
|
priv->base.fan.pwm_clock = nvd0_fan_pwm_clock;
|
||||||
|
priv->base.base.temp_get = nv50_temp_get;
|
||||||
priv->fan.pwm_get = nvd0_fan_pwm_get;
|
|
||||||
priv->fan.pwm_set = nvd0_fan_pwm_set;
|
|
||||||
priv->fan.pwm_clock = nvd0_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;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +102,7 @@ nvd0_therm_oclass = {
|
|||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nouveau_ofuncs) {
|
||||||
.ctor = nvd0_therm_ctor,
|
.ctor = nvd0_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nouveau_therm_dtor,
|
||||||
.init = nouveau_therm_init,
|
.init = _nouveau_therm_init,
|
||||||
.fini = nouveau_therm_fini,
|
.fini = _nouveau_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -53,8 +53,6 @@ struct nouveau_therm_priv {
|
|||||||
struct i2c_client *ic;
|
struct i2c_client *ic;
|
||||||
};
|
};
|
||||||
|
|
||||||
int nouveau_therm_init(struct nouveau_object *object);
|
|
||||||
int nouveau_therm_fini(struct nouveau_object *object, bool suspend);
|
|
||||||
int nouveau_therm_attr_get(struct nouveau_therm *therm,
|
int nouveau_therm_attr_get(struct nouveau_therm *therm,
|
||||||
enum nouveau_therm_attr_type type);
|
enum nouveau_therm_attr_type type);
|
||||||
int nouveau_therm_attr_set(struct nouveau_therm *therm,
|
int nouveau_therm_attr_set(struct nouveau_therm *therm,
|
||||||
|
Loading…
Reference in New Issue
Block a user