Commit 703a8c2d authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes

Single regression fix for nouveau

* 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2.6:
  drm/nouveau: fix null ptr dereferences on some boards
parents abce1ec9 fdd239ac
...@@ -73,7 +73,7 @@ struct nouveau_i2c { ...@@ -73,7 +73,7 @@ struct nouveau_i2c {
int (*identify)(struct nouveau_i2c *, int index, int (*identify)(struct nouveau_i2c *, int index,
const char *what, struct nouveau_i2c_board_info *, const char *what, struct nouveau_i2c_board_info *,
bool (*match)(struct nouveau_i2c_port *, bool (*match)(struct nouveau_i2c_port *,
struct i2c_board_info *)); struct i2c_board_info *, void *), void *);
struct list_head ports; struct list_head ports;
}; };
......
...@@ -50,6 +50,13 @@ struct nouveau_instmem { ...@@ -50,6 +50,13 @@ struct nouveau_instmem {
static inline struct nouveau_instmem * static inline struct nouveau_instmem *
nouveau_instmem(void *obj) nouveau_instmem(void *obj)
{ {
/* nv04/nv40 impls need to create objects in their constructor,
* which is before the subdev pointer is valid
*/
if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM)
return obj;
return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_INSTMEM]; return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_INSTMEM];
} }
......
...@@ -197,7 +197,7 @@ static int ...@@ -197,7 +197,7 @@ static int
nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what, nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what,
struct nouveau_i2c_board_info *info, struct nouveau_i2c_board_info *info,
bool (*match)(struct nouveau_i2c_port *, bool (*match)(struct nouveau_i2c_port *,
struct i2c_board_info *)) struct i2c_board_info *, void *), void *data)
{ {
struct nouveau_i2c_port *port = nouveau_i2c_find(i2c, index); struct nouveau_i2c_port *port = nouveau_i2c_find(i2c, index);
int i; int i;
...@@ -221,7 +221,7 @@ nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what, ...@@ -221,7 +221,7 @@ nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what,
} }
if (nv_probe_i2c(port, info[i].dev.addr) && if (nv_probe_i2c(port, info[i].dev.addr) &&
(!match || match(port, &info[i].dev))) { (!match || match(port, &info[i].dev, data))) {
nv_info(i2c, "detected %s: %s\n", what, nv_info(i2c, "detected %s: %s\n", what,
info[i].dev.type); info[i].dev.type);
return i; return i;
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
static bool static bool
probe_monitoring_device(struct nouveau_i2c_port *i2c, probe_monitoring_device(struct nouveau_i2c_port *i2c,
struct i2c_board_info *info) struct i2c_board_info *info, void *data)
{ {
struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c); struct nouveau_therm_priv *priv = data;
struct nvbios_therm_sensor *sensor = &priv->bios_sensor; struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
struct i2c_client *client; struct i2c_client *client;
...@@ -96,7 +96,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm) ...@@ -96,7 +96,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm)
}; };
i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device", i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
board, probe_monitoring_device); board, probe_monitoring_device, therm);
if (priv->ic) if (priv->ic)
return; return;
} }
...@@ -108,7 +108,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm) ...@@ -108,7 +108,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm)
}; };
i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device", i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
board, probe_monitoring_device); board, probe_monitoring_device, therm);
if (priv->ic) if (priv->ic)
return; return;
} }
...@@ -117,5 +117,5 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm) ...@@ -117,5 +117,5 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm)
device. Let's try our static list. device. Let's try our static list.
*/ */
i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device", i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
nv_board_infos, probe_monitoring_device); nv_board_infos, probe_monitoring_device, therm);
} }
...@@ -643,7 +643,7 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder) ...@@ -643,7 +643,7 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder)
get_tmds_slave(encoder)) get_tmds_slave(encoder))
return; return;
type = i2c->identify(i2c, 2, "TMDS transmitter", info, NULL); type = i2c->identify(i2c, 2, "TMDS transmitter", info, NULL, NULL);
if (type < 0) if (type < 0)
return; return;
......
...@@ -59,7 +59,7 @@ int nv04_tv_identify(struct drm_device *dev, int i2c_index) ...@@ -59,7 +59,7 @@ int nv04_tv_identify(struct drm_device *dev, int i2c_index)
struct nouveau_i2c *i2c = nouveau_i2c(drm->device); struct nouveau_i2c *i2c = nouveau_i2c(drm->device);
return i2c->identify(i2c, i2c_index, "TV encoder", return i2c->identify(i2c, i2c_index, "TV encoder",
nv04_tv_encoder_info, NULL); nv04_tv_encoder_info, NULL, NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment