PROBLEM: Registering radeon display connectors fails due to missing adapter name

Ari Savolainen ari.m.savolainen at gmail.com
Wed Nov 17 12:33:42 PST 2010


Registering radeon display connectors fails due to missing adapter
name. The problem surfaced after this commit to Linus' kernel tree:

commit 2236baa75f704851d3cd3310569058151acb1f06
Author: Jean Delvare <khali at linux-fr.org>
Date:   Mon Nov 15 22:40:38 2010 +0100

    i2c: Sanity checks on adapter registration

    Make sure I2C adapters being registered have the required struct
    fields set. If they don't, problems will happen later.

    Signed-off-by: Jean Delvare <khali at linux-fr.org>

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d231f68..6b4cc56 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -848,6 +848,18 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
                goto out_list;
        }

+       /* Sanity checks */
+       if (unlikely(adap->name[0] == '\0')) {
+               pr_err("i2c-core: Attempt to register an adapter with "
+                      "no name!\n");
+               return -EINVAL;
+       }
+       if (unlikely(!adap->algo)) {
+               pr_err("i2c-core: Attempt to register adapter '%s' with "
+                      "no algo!\n", adap->name);
+               return -EINVAL;
+       }
+
        rt_mutex_init(&adap->bus_lock);
        mutex_init(&adap->userspace_clients_lock);
        INIT_LIST_HEAD(&adap->userspace_clients);



dmesg output that shows the problem:
[    3.870533] i2c-core: Attempt to register an adapter with no name!
[    3.870591] [drm] Failed to register i2c DP-auxch
[    3.870647] i2c-core: Attempt to register an adapter with no name!
[    3.870708] [drm] Failed to register i2c DP-auxch
[    3.870821] [drm] Radeon Display Connectors
[    3.870824] [drm] Connector 0:
[    3.870825] [drm]   DVI-I
[    3.870827] [drm]   HPD1
[    3.870829] [drm]   DDC: 0x7e20 0x7e20 0x7e24 0x7e24 0x7e28 0x7e28
0x7e2c 0x7e2c
[    3.870831] [drm]   Encoders:
[    3.870833] [drm]     CRT2: INTERNAL_KLDSCP_DAC2
[    3.870834] [drm]     DFP1: INTERNAL_UNIPHY

The corresponding output was originally like this:
[    3.781507] [drm] Radeon Display Connectors
[    3.781510] [drm] Connector 0:
[    3.781511] [drm]   DisplayPort
[    3.781513] [drm]   HPD2
[    3.781515] [drm]   DDC: 0x7e50 0x7e50 0x7e54 0x7e54 0x7e58 0x7e58
0x7e5c 0x7e5c
[    3.781517] [drm]   Encoders:
[    3.781518] [drm]     DFP2: INTERNAL_UNIPHY1
[    3.781520] [drm] Connector 1:
[    3.781521] [drm]   DisplayPort
[    3.781522] [drm]   HPD3
[    3.781524] [drm]   DDC: 0x7f10 0x7f10 0x7f14 0x7f14 0x7f18 0x7f18
0x7f1c 0x7f1c
[    3.781526] [drm]   Encoders:
[    3.781528] [drm]     DFP3: INTERNAL_UNIPHY1
[    3.781529] [drm] Connector 2:
[    3.781531] [drm]   DVI-I
[    3.781532] [drm]   HPD1
[    3.781534] [drm]   DDC: 0x7e20 0x7e20 0x7e24 0x7e24 0x7e28 0x7e28
0x7e2c 0x7e2c
[    3.781535] [drm]   Encoders:
[    3.781537] [drm]     CRT2: INTERNAL_KLDSCP_DAC2
[    3.781538] [drm]     DFP1: INTERNAL_UNIPHY

A change like this fixes the problem:

diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c
b/drivers/gpu/drm/radeon/radeon_i2c.c
index 0cfbba0..65d05c0 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -946,6 +946,7 @@ struct radeon_i2c_chan
*radeon_i2c_create_dp(struct drm_device *dev,
        i2c->rec = *rec;
        i2c->adapter.owner = THIS_MODULE;
        i2c->dev = dev;
+       sprintf(i2c->adapter.name, "Radeon i2c bus %s", name);
        i2c_set_adapdata(&i2c->adapter, i2c);
        i2c->adapter.algo_data = &i2c->algo.dp;
        i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch;


More information about the dri-devel mailing list