drm/nouveau/i2c: switch to subdev printk macros
authorBen Skeggs <bskeggs@redhat.com>
Thu, 20 Aug 2015 04:54:12 +0000 (14:54 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:40:22 +0000 (12:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h

index d17dd1cf3c34ef145eac68785d961ee8203aca7e..7b195393d15c5f26f8c7b68c231d3b1da20c81a8 100644 (file)
@@ -32,11 +32,13 @@ struct anx9805_i2c_port {
 static int
 anx9805_train(struct nvkm_i2c_port *port, int link_nr, int link_bw, bool enh)
 {
+       struct nvkm_i2c *i2c = nvkm_i2c(port);
+       struct nvkm_subdev *subdev = &i2c->subdev;
        struct anx9805_i2c_port *chan = (void *)port;
        struct nvkm_i2c_port *mast = (void *)nv_object(chan)->parent;
        u8 tmp, i;
 
-       DBG("ANX9805 train %d 0x%02x %d\n", link_nr, link_bw, enh);
+       DBG("ANX9805 train %d %02x %d\n", link_nr, link_bw, enh);
 
        nv_wri2cr(mast, chan->addr, 0xa0, link_bw);
        nv_wri2cr(mast, chan->addr, 0xa1, link_nr | (enh ? 0x80 : 0x00));
@@ -47,13 +49,13 @@ anx9805_train(struct nvkm_i2c_port *port, int link_nr, int link_bw, bool enh)
        while ((tmp = nv_rdi2cr(mast, chan->addr, 0xa8)) & 0x01) {
                mdelay(5);
                if (i++ == 100) {
-                       nv_error(port, "link training timed out\n");
+                       nvkm_error(subdev, "link training timed out\n");
                        return -ETIMEDOUT;
                }
        }
 
        if (tmp & 0x70) {
-               nv_error(port, "link training failed: 0x%02x\n", tmp);
+               nvkm_error(subdev, "link training failed: %02x\n", tmp);
                return -EIO;
        }
 
index 187af1183f2d3f26de4ae081e36644303bc309d0..3496dfd93264c9fad2f74453dc2a3b120c3c3ed1 100644 (file)
@@ -282,31 +282,34 @@ nvkm_i2c_identify(struct nvkm_i2c *i2c, int index, const char *what,
                  bool (*match)(struct nvkm_i2c_port *,
                                struct i2c_board_info *, void *), void *data)
 {
+       struct nvkm_subdev *subdev = &i2c->subdev;
        struct nvkm_i2c_port *port = nvkm_i2c_find(i2c, index);
        int i;
 
        if (!port) {
-               nv_debug(i2c, "no bus when probing %s on %d\n", what, index);
+               nvkm_debug(subdev, "no bus when probing %s on %d\n",
+                          what, index);
                return -ENODEV;
        }
 
-       nv_debug(i2c, "probing %ss on bus: %d\n", what, port->index);
+       nvkm_debug(subdev, "probing %ss on bus: %d\n", what, port->index);
        for (i = 0; info[i].dev.addr; i++) {
                u8 orig_udelay = 0;
 
                if ((port->adapter.algo == &i2c_bit_algo) &&
                    (info[i].udelay != 0)) {
                        struct i2c_algo_bit_data *algo = port->adapter.algo_data;
-                       nv_debug(i2c, "using custom udelay %d instead of %d\n",
-                                info[i].udelay, algo->udelay);
+                       nvkm_debug(subdev,
+                                  "using custom udelay %d instead of %d\n",
+                                  info[i].udelay, algo->udelay);
                        orig_udelay = algo->udelay;
                        algo->udelay = info[i].udelay;
                }
 
                if (nv_probe_i2c(port, info[i].dev.addr) &&
                    (!match || match(port, &info[i].dev, data))) {
-                       nv_info(i2c, "detected %s: %s\n", what,
-                               info[i].dev.type);
+                       nvkm_info(subdev, "detected %s: %s\n", what,
+                                 info[i].dev.type);
                        return i;
                }
 
@@ -316,7 +319,7 @@ nvkm_i2c_identify(struct nvkm_i2c *i2c, int index, const char *what,
                }
        }
 
-       nv_debug(i2c, "no devices found.\n");
+       nvkm_debug(subdev, "no devices found.\n");
        return -ENODEV;
 }
 
index 17cb172a4a0a34d7a6194c4c898b4ee36d6ca47f..acbfbe0a7ea918256ece857bd5f79830315d58bf 100644 (file)
@@ -55,8 +55,10 @@ g94_aux_mask(struct nvkm_i2c *i2c, u32 type, u32 mask, u32 data)
        nvkm_wr32(device, 0x00e068, temp);
 }
 
-#define AUX_DBG(fmt, args...) nv_debug(i2c, "AUXCH(%d): " fmt, ch, ##args)
-#define AUX_ERR(fmt, args...) nv_error(i2c, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_DBG(fmt, args...)                                                  \
+       nvkm_debug(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_ERR(fmt, args...)                                                  \
+       nvkm_error(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
 
 static void
 auxch_fini(struct nvkm_i2c *i2c, int ch)
@@ -80,7 +82,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
                ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
                udelay(1);
                if (!timeout--) {
-                       AUX_ERR("begin idle timeout 0x%08x\n", ctrl);
+                       AUX_ERR("begin idle timeout %08x\n", ctrl);
                        return -EBUSY;
                }
        } while (ctrl & 0x03010000);
@@ -92,7 +94,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
                ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
                udelay(1);
                if (!timeout--) {
-                       AUX_ERR("magic wait 0x%08x\n", ctrl);
+                       AUX_ERR("magic wait %08x\n", ctrl);
                        auxch_fini(i2c, ch);
                        return -EBUSY;
                }
@@ -113,7 +115,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
        int ch = port->addr;
        int ret, i;
 
-       AUX_DBG("%d: 0x%08x %d\n", type, addr, size);
+       AUX_DBG("%d: %08x %d\n", type, addr, size);
 
        ret = auxch_init(i2c, ch);
        if (ret < 0)
@@ -129,7 +131,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
        if (!(type & 1)) {
                memcpy(xbuf, data, size);
                for (i = 0; i < 16; i += 4) {
-                       AUX_DBG("wr 0x%08x\n", xbuf[i / 4]);
+                       AUX_DBG("wr %08x\n", xbuf[i / 4]);
                        nvkm_wr32(device, 0x00e4c0 + (ch * 0x50) + i, xbuf[i / 4]);
                }
        }
@@ -156,7 +158,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
                        ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
                        udelay(1);
                        if (!timeout--) {
-                               AUX_ERR("tx req timeout 0x%08x\n", ctrl);
+                               AUX_ERR("tx req timeout %08x\n", ctrl);
                                ret = -EIO;
                                goto out;
                        }
@@ -173,13 +175,13 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
                if ((stat & 0x00000e00))
                        ret = -EIO;
 
-               AUX_DBG("%02d 0x%08x 0x%08x\n", retries, ctrl, stat);
+               AUX_DBG("%02d %08x %08x\n", retries, ctrl, stat);
        }
 
        if (type & 1) {
                for (i = 0; i < 16; i += 4) {
                        xbuf[i / 4] = nvkm_rd32(device, 0x00e4d0 + (ch * 0x50) + i);
-                       AUX_DBG("rd 0x%08x\n", xbuf[i / 4]);
+                       AUX_DBG("rd %08x\n", xbuf[i / 4]);
                }
                memcpy(data, xbuf, size);
        }
index 61c760534ab83e11dc99d6856d509d5cb826cd12..f027aedb7361a442e75bfeee5af68f81b48b0463 100644 (file)
  */
 #include "nv50.h"
 
-#define AUX_DBG(fmt, args...) nv_debug(i2c, "AUXCH(%d): " fmt, ch, ##args)
-#define AUX_ERR(fmt, args...) nv_error(i2c, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_DBG(fmt, args...)                                                  \
+       nvkm_debug(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_ERR(fmt, args...)                                                  \
+       nvkm_error(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
 
 static void
 auxch_fini(struct nvkm_i2c *i2c, int ch)
@@ -48,7 +50,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
                ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
                udelay(1);
                if (!timeout--) {
-                       AUX_ERR("begin idle timeout 0x%08x\n", ctrl);
+                       AUX_ERR("begin idle timeout %08x\n", ctrl);
                        return -EBUSY;
                }
        } while (ctrl & 0x03010000);
@@ -60,7 +62,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
                ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
                udelay(1);
                if (!timeout--) {
-                       AUX_ERR("magic wait 0x%08x\n", ctrl);
+                       AUX_ERR("magic wait %08x\n", ctrl);
                        auxch_fini(i2c, ch);
                        return -EBUSY;
                }
@@ -81,7 +83,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
        int ch = port->addr;
        int ret, i;
 
-       AUX_DBG("%d: 0x%08x %d\n", type, addr, size);
+       AUX_DBG("%d: %08x %d\n", type, addr, size);
 
        ret = auxch_init(i2c, ch);
        if (ret < 0)
@@ -97,7 +99,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
        if (!(type & 1)) {
                memcpy(xbuf, data, size);
                for (i = 0; i < 16; i += 4) {
-                       AUX_DBG("wr 0x%08x\n", xbuf[i / 4]);
+                       AUX_DBG("wr %08x\n", xbuf[i / 4]);
                        nvkm_wr32(device, 0x00d930 + (ch * 0x50) + i, xbuf[i / 4]);
                }
        }
@@ -124,7 +126,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
                        ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
                        udelay(1);
                        if (!timeout--) {
-                               AUX_ERR("tx req timeout 0x%08x\n", ctrl);
+                               AUX_ERR("tx req timeout %08x\n", ctrl);
                                ret = -EIO;
                                goto out;
                        }
@@ -141,13 +143,13 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
                if ((stat & 0x00000e00))
                        ret = -EIO;
 
-               AUX_DBG("%02d 0x%08x 0x%08x\n", retries, ctrl, stat);
+               AUX_DBG("%02d %08x %08x\n", retries, ctrl, stat);
        }
 
        if (type & 1) {
                for (i = 0; i < 16; i += 4) {
                        xbuf[i / 4] = nvkm_rd32(device, 0x00d940 + (ch * 0x50) + i);
-                       AUX_DBG("rd 0x%08x\n", xbuf[i / 4]);
+                       AUX_DBG("rd %08x\n", xbuf[i / 4]);
                }
                memcpy(data, xbuf, size);
        }
index f3422cc6f8db01c101aeefbe3bf0e18d2ee7fb51..577b18ecf5c67f4300f8e3cd909b3e0f609b697d 100644 (file)
@@ -46,9 +46,11 @@ int _nvkm_i2c_pad_fini(struct nvkm_object *, bool);
 #ifndef MSG
 #define MSG(l,f,a...) do {                                                     \
        struct nvkm_i2c_pad *_pad = (void *)pad;                               \
-       nv_##l(_pad, "PAD:%c:%02x: "f,                                         \
-              _pad->index >= 0x100 ? 'X' : 'S',                               \
-              _pad->index >= 0x100 ? _pad->index - 0x100 : _pad->index, ##a); \
+       struct nvkm_i2c *_i2c = nvkm_i2c(_pad);                                \
+       nvkm_##l(&_i2c->subdev, "PAD:%c:%02x: "f,                              \
+                _pad->index >= 0x100 ? 'X' : 'S',                             \
+                _pad->index >= 0x100 ?                                        \
+                _pad->index - 0x100 : _pad->index, ##a);                      \
 } while(0)
 #define DBG(f,a...) MSG(debug, f, ##a)
 #define ERR(f,a...) MSG(error, f, ##a)
index 586f53dad813e9225ba2b5e921dae857c430641b..ac6be72633478be469dc26c6a97538f39106abb3 100644 (file)
@@ -4,8 +4,9 @@
 
 #ifndef MSG
 #define MSG(l,f,a...) do {                                                     \
-       struct nvkm_i2c_port *_port = (void *)port;                         \
-       nv_##l(_port, "PORT:%02x: "f, _port->index, ##a);                      \
+       struct nvkm_i2c_port *_port = (void *)port;                            \
+       struct nvkm_i2c *_i2c = nvkm_i2c(_port);                               \
+       nvkm_##l(&_i2c->subdev, "PORT:%02x: "f, _port->index, ##a);            \
 } while(0)
 #define DBG(f,a...) MSG(debug, f, ##a)
 #define ERR(f,a...) MSG(error, f, ##a)