]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2...
authorDave Airlie <airlied@redhat.com>
Wed, 15 Jan 2014 05:01:11 +0000 (15:01 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 15 Jan 2014 05:01:11 +0000 (15:01 +1000)
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

drivers/gpu/drm/nouveau/core/include/subdev/i2c.h
drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
drivers/gpu/drm/nouveau/core/subdev/therm/ic.c
drivers/gpu/drm/nouveau/dispnv04/dfp.c
drivers/gpu/drm/nouveau/dispnv04/tvnv04.c

index 9fa5da72387192467ba80c9f9f9a7f2a0adbe339..7f50a858b16f68395a3fe0b84c5bd9f275e8849f 100644 (file)
@@ -73,7 +73,7 @@ struct nouveau_i2c {
        int (*identify)(struct nouveau_i2c *, int index,
                        const char *what, struct nouveau_i2c_board_info *,
                        bool (*match)(struct nouveau_i2c_port *,
-                                     struct i2c_board_info *));
+                                     struct i2c_board_info *, void *), void *);
        struct list_head ports;
 };
 
index ec7a54e91a087cdea900dd1f94947adc0f6f395c..4aca33887aaa639e4ad738065bfa775319d75afc 100644 (file)
@@ -50,6 +50,13 @@ struct nouveau_instmem {
 static inline struct nouveau_instmem *
 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];
 }
 
index 041fd5edaebf7de988206ec6440bdf1950edc938..c33c03d2f4af2f695e50e92078ea18c800d07eec 100644 (file)
@@ -197,7 +197,7 @@ static int
 nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what,
                     struct nouveau_i2c_board_info *info,
                     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);
        int i;
@@ -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) &&
-                   (!match || match(port, &info[i].dev))) {
+                   (!match || match(port, &info[i].dev, data))) {
                        nv_info(i2c, "detected %s: %s\n", what,
                                info[i].dev.type);
                        return i;
index e44ed7b93c6d88db3826a6c6dcb13efd5429385a..7610fc5f8fa256de8038e3770ca227a3d0150c64 100644 (file)
@@ -29,9 +29,9 @@
 
 static bool
 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 i2c_client *client;
 
@@ -96,7 +96,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm)
                };
 
                i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
-                                 board, probe_monitoring_device);
+                             board, probe_monitoring_device, therm);
                if (priv->ic)
                        return;
        }
@@ -108,7 +108,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm)
                };
 
                i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
-                                 board, probe_monitoring_device);
+                             board, probe_monitoring_device, therm);
                if (priv->ic)
                        return;
        }
@@ -117,5 +117,5 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm)
           device. Let's try our static list.
         */
        i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
-                     nv_board_infos, probe_monitoring_device);
+                     nv_board_infos, probe_monitoring_device, therm);
 }
index 936a71c5908076814a4aa8ffc5c2a3757e745ea5..7fdc51e2a571bee85b6fcf707890c8e4138ca8d9 100644 (file)
@@ -643,7 +643,7 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder)
            get_tmds_slave(encoder))
                return;
 
-       type = i2c->identify(i2c, 2, "TMDS transmitter", info, NULL);
+       type = i2c->identify(i2c, 2, "TMDS transmitter", info, NULL, NULL);
        if (type < 0)
                return;
 
index cc4b208ce546d50aad1813810981099fe6d81935..244822df8ffc73d1e9f15075c7ee6faa54368a84 100644 (file)
@@ -59,7 +59,7 @@ int nv04_tv_identify(struct drm_device *dev, int i2c_index)
        struct nouveau_i2c *i2c = nouveau_i2c(drm->device);
 
        return i2c->identify(i2c, i2c_index, "TV encoder",
-                            nv04_tv_encoder_info, NULL);
+                            nv04_tv_encoder_info, NULL, NULL);
 }