From fa310bc3f4df74adab48a37e75a611f2ae3bb1e2 Mon Sep 17 00:00:00 2001 From: zrj Date: Fri, 31 Jul 2015 12:47:01 +0300 Subject: [PATCH] drm/i915: experimental adapter->name to sc->name patch --- sys/dev/drm/i915/dvo_ch7017.c | 7 +++++-- sys/dev/drm/i915/dvo_ch7xxx.c | 17 +++++++++++++---- sys/dev/drm/i915/dvo_ivch.c | 10 ++++++++-- sys/dev/drm/i915/dvo_ns2501.c | 17 +++++++++++++---- sys/dev/drm/i915/dvo_sil164.c | 17 +++++++++++++---- sys/dev/drm/i915/dvo_tfp410.c | 17 +++++++++++++---- 6 files changed, 65 insertions(+), 20 deletions(-) diff --git a/sys/dev/drm/i915/dvo_ch7017.c b/sys/dev/drm/i915/dvo_ch7017.c index fe022fe374..11e76807ba 100644 --- a/sys/dev/drm/i915/dvo_ch7017.c +++ b/sys/dev/drm/i915/dvo_ch7017.c @@ -200,10 +200,13 @@ static bool ch7017_write(struct intel_dvo_device *dvo, u8 addr, u8 val) static bool ch7017_init(struct intel_dvo_device *dvo, struct i2c_adapter *adapter) { + struct intel_iic_softc *sc; struct ch7017_priv *priv; const char *str; u8 val; + sc = device_get_softc(adapter); + priv = kzalloc(sizeof(struct ch7017_priv), GFP_KERNEL); if (priv == NULL) return false; @@ -227,12 +230,12 @@ static bool ch7017_init(struct intel_dvo_device *dvo, default: DRM_DEBUG_KMS("ch701x not detected, got %d: from %s " "slave %d.\n", - val, "adapter->name", dvo->slave_addr); + val, sc->name, dvo->slave_addr); goto fail; } DRM_DEBUG_KMS("%s detected on %s, addr %d\n", - str, "adapter->name", dvo->slave_addr); + str, sc->name, dvo->slave_addr); return true; fail: diff --git a/sys/dev/drm/i915/dvo_ch7xxx.c b/sys/dev/drm/i915/dvo_ch7xxx.c index 4ffd822877..da65421024 100644 --- a/sys/dev/drm/i915/dvo_ch7xxx.c +++ b/sys/dev/drm/i915/dvo_ch7xxx.c @@ -134,6 +134,7 @@ static char *ch7xxx_get_did(uint8_t did) /** Reads an 8 bit register */ static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) { + struct intel_iic_softc *sc; struct ch7xxx_priv *ch7xxx = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; u8 out_buf[2]; @@ -157,6 +158,8 @@ static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) out_buf[0] = addr; out_buf[1] = 0; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, msgs, 2) == 0) { *ch = in_buf[0]; return true; @@ -164,7 +167,7 @@ static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) if (!ch7xxx->quiet) { DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; } @@ -172,6 +175,7 @@ static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) /** Writes an 8 bit register */ static bool ch7xxx_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) { + struct intel_iic_softc *sc; struct ch7xxx_priv *ch7xxx = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; uint8_t out_buf[2]; @@ -185,12 +189,14 @@ static bool ch7xxx_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) out_buf[0] = addr; out_buf[1] = ch; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, &msg, 1) == 0) return true; if (!ch7xxx->quiet) { DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d.\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; @@ -199,11 +205,14 @@ static bool ch7xxx_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) static bool ch7xxx_init(struct intel_dvo_device *dvo, struct i2c_adapter *adapter) { + struct intel_iic_softc *sc; /* this will detect the CH7xxx chip on the specified i2c bus */ struct ch7xxx_priv *ch7xxx; uint8_t vendor, device; char *name, *devid; + sc = device_get_softc(adapter); + ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL); if (ch7xxx == NULL) return false; @@ -219,7 +228,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo, if (!name) { DRM_DEBUG_KMS("ch7xxx not detected; got 0x%02x from %s " "slave %d.\n", - vendor, "adapter->name", dvo->slave_addr); + vendor, sc->name, dvo->slave_addr); goto out; } @@ -231,7 +240,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo, if (!devid) { DRM_DEBUG_KMS("ch7xxx not detected; got 0x%02x from %s " "slave %d.\n", - vendor, "adapter->name", dvo->slave_addr); + vendor, sc->name, dvo->slave_addr); goto out; } diff --git a/sys/dev/drm/i915/dvo_ivch.c b/sys/dev/drm/i915/dvo_ivch.c index 9e4830b02b..86c7408871 100644 --- a/sys/dev/drm/i915/dvo_ivch.c +++ b/sys/dev/drm/i915/dvo_ivch.c @@ -165,6 +165,7 @@ static void ivch_dump_regs(struct intel_dvo_device *dvo); */ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data) { + struct intel_iic_softc *sc; struct ivch_priv *priv = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; u8 out_buf[1]; @@ -192,6 +193,8 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data) out_buf[0] = addr; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, msgs, 3) == 0) { *data = (in_buf[1] << 8) | in_buf[0]; return true; @@ -200,7 +203,7 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data) if (!priv->quiet) { DRM_DEBUG_KMS("Unable to read register 0x%02x from " "%s:%02x.\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; } @@ -208,6 +211,7 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data) /** Writes a 16-bit register on the ivch */ static bool ivch_write(struct intel_dvo_device *dvo, int addr, uint16_t data) { + struct intel_iic_softc *sc; struct ivch_priv *priv = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; u8 out_buf[3]; @@ -222,12 +226,14 @@ static bool ivch_write(struct intel_dvo_device *dvo, int addr, uint16_t data) out_buf[1] = data & 0xff; out_buf[2] = data >> 8; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, &msg, 1) == 0) return true; if (!priv->quiet) { DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d.\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; diff --git a/sys/dev/drm/i915/dvo_ns2501.c b/sys/dev/drm/i915/dvo_ns2501.c index b5e5ffd218..f7e202485f 100644 --- a/sys/dev/drm/i915/dvo_ns2501.c +++ b/sys/dev/drm/i915/dvo_ns2501.c @@ -95,6 +95,7 @@ struct ns2501_priv { */ static bool ns2501_readb(struct intel_dvo_device *dvo, int addr, uint8_t * ch) { + struct intel_iic_softc *sc; struct ns2501_priv *ns = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; u8 out_buf[2]; @@ -118,6 +119,8 @@ static bool ns2501_readb(struct intel_dvo_device *dvo, int addr, uint8_t * ch) out_buf[0] = addr; out_buf[1] = 0; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, msgs, 2) == 0) { *ch = in_buf[0]; return true; @@ -126,7 +129,7 @@ static bool ns2501_readb(struct intel_dvo_device *dvo, int addr, uint8_t * ch) if (!ns->quiet) { DRM_DEBUG_KMS ("Unable to read register 0x%02x from %s:0x%02x.\n", addr, - "adapter->name", dvo->slave_addr); + sc->name, dvo->slave_addr); } return false; @@ -140,6 +143,7 @@ static bool ns2501_readb(struct intel_dvo_device *dvo, int addr, uint8_t * ch) */ static bool ns2501_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) { + struct intel_iic_softc *sc; struct ns2501_priv *ns = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; uint8_t out_buf[2]; @@ -154,13 +158,15 @@ static bool ns2501_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) out_buf[0] = addr; out_buf[1] = ch; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, &msg, 1) == 0) { return true; } if (!ns->quiet) { DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; @@ -175,10 +181,13 @@ static bool ns2501_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) static bool ns2501_init(struct intel_dvo_device *dvo, struct i2c_adapter *adapter) { + struct intel_iic_softc *sc; /* this will detect the NS2501 chip on the specified i2c bus */ struct ns2501_priv *ns; unsigned char ch; + sc = device_get_softc(adapter); + ns = kzalloc(sizeof(struct ns2501_priv), GFP_KERNEL); if (ns == NULL) return false; @@ -192,7 +201,7 @@ static bool ns2501_init(struct intel_dvo_device *dvo, if (ch != (NS2501_VID & 0xff)) { DRM_DEBUG_KMS("ns2501 not detected got %d: from %s Slave %d.\n", - ch, "adapter->name", dvo->slave_addr); + ch, sc->name, dvo->slave_addr); goto out; } @@ -201,7 +210,7 @@ static bool ns2501_init(struct intel_dvo_device *dvo, if (ch != (NS2501_DID & 0xff)) { DRM_DEBUG_KMS("ns2501 not detected got %d: from %s Slave %d.\n", - ch, "adapter->name", dvo->slave_addr); + ch, sc->name, dvo->slave_addr); goto out; } ns->quiet = false; diff --git a/sys/dev/drm/i915/dvo_sil164.c b/sys/dev/drm/i915/dvo_sil164.c index 98bcdf9790..f807b2e183 100644 --- a/sys/dev/drm/i915/dvo_sil164.c +++ b/sys/dev/drm/i915/dvo_sil164.c @@ -67,6 +67,7 @@ struct sil164_priv { static bool sil164_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) { + struct intel_iic_softc *sc; struct sil164_priv *sil = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; u8 out_buf[2]; @@ -90,6 +91,8 @@ static bool sil164_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) out_buf[0] = addr; out_buf[1] = 0; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, msgs, 2) == 0) { *ch = in_buf[0]; return true; @@ -97,13 +100,14 @@ static bool sil164_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) if (!sil->quiet) { DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; } static bool sil164_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) { + struct intel_iic_softc *sc; struct sil164_priv *sil = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; uint8_t out_buf[2]; @@ -117,12 +121,14 @@ static bool sil164_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) out_buf[0] = addr; out_buf[1] = ch; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, &msg, 1) == 0) return true; if (!sil->quiet) { DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d.\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; @@ -132,10 +138,13 @@ static bool sil164_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) static bool sil164_init(struct intel_dvo_device *dvo, struct i2c_adapter *adapter) { + struct intel_iic_softc *sc; /* this will detect the SIL164 chip on the specified i2c bus */ struct sil164_priv *sil; unsigned char ch; + sc = device_get_softc(adapter); + sil = kzalloc(sizeof(struct sil164_priv), GFP_KERNEL); if (sil == NULL) return false; @@ -149,7 +158,7 @@ static bool sil164_init(struct intel_dvo_device *dvo, if (ch != (SIL164_VID & 0xff)) { DRM_DEBUG_KMS("sil164 not detected got %d: from %s Slave %d.\n", - ch, "adapter->name", dvo->slave_addr); + ch, sc->name, dvo->slave_addr); goto out; } @@ -158,7 +167,7 @@ static bool sil164_init(struct intel_dvo_device *dvo, if (ch != (SIL164_DID & 0xff)) { DRM_DEBUG_KMS("sil164 not detected got %d: from %s Slave %d.\n", - ch, "adapter->name", dvo->slave_addr); + ch, sc->name, dvo->slave_addr); goto out; } sil->quiet = false; diff --git a/sys/dev/drm/i915/dvo_tfp410.c b/sys/dev/drm/i915/dvo_tfp410.c index 5c7a5ea4cd..60cc184b5a 100644 --- a/sys/dev/drm/i915/dvo_tfp410.c +++ b/sys/dev/drm/i915/dvo_tfp410.c @@ -92,6 +92,7 @@ struct tfp410_priv { static bool tfp410_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) { + struct intel_iic_softc *sc; struct tfp410_priv *tfp = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; u8 out_buf[2]; @@ -115,6 +116,8 @@ static bool tfp410_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) out_buf[0] = addr; out_buf[1] = 0; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, msgs, 2) == 0) { *ch = in_buf[0]; return true; @@ -122,13 +125,14 @@ static bool tfp410_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) if (!tfp->quiet) { DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; } static bool tfp410_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) { + struct intel_iic_softc *sc; struct tfp410_priv *tfp = dvo->dev_priv; struct i2c_adapter *adapter = dvo->i2c_bus; uint8_t out_buf[2]; @@ -142,12 +146,14 @@ static bool tfp410_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch) out_buf[0] = addr; out_buf[1] = ch; + sc = device_get_softc(adapter); + if (iicbus_transfer(adapter, &msg, 1) == 0) return true; if (!tfp->quiet) { DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d.\n", - addr, "adapter->name", dvo->slave_addr); + addr, sc->name, dvo->slave_addr); } return false; @@ -168,10 +174,13 @@ static int tfp410_getid(struct intel_dvo_device *dvo, int addr) static bool tfp410_init(struct intel_dvo_device *dvo, struct i2c_adapter *adapter) { + struct intel_iic_softc *sc; /* this will detect the tfp410 chip on the specified i2c bus */ struct tfp410_priv *tfp; int id; + sc = device_get_softc(adapter); + tfp = kzalloc(sizeof(struct tfp410_priv), GFP_KERNEL); if (tfp == NULL) return false; @@ -183,14 +192,14 @@ static bool tfp410_init(struct intel_dvo_device *dvo, if ((id = tfp410_getid(dvo, TFP410_VID_LO)) != TFP410_VID) { DRM_DEBUG_KMS("tfp410 not detected got VID %X: from %s " "Slave %d.\n", - id, "adapter->name", dvo->slave_addr); + id, sc->name, dvo->slave_addr); goto out; } if ((id = tfp410_getid(dvo, TFP410_DID_LO)) != TFP410_DID) { DRM_DEBUG_KMS("tfp410 not detected got DID %X: from %s " "Slave %d.\n", - id, "adapter->name", dvo->slave_addr); + id, sc->name, dvo->slave_addr); goto out; } tfp->quiet = false; -- 2.11.4.GIT