[PATCH] drm/radeon/kms: register an i2c adapter name for the dp aux bus

Jean Delvare khali at linux-fr.org
Thu Nov 18 05:08:32 PST 2010


Hi Alex,

On Wed, 17 Nov 2010 17:56:49 -0500, Alex Deucher wrote:
> This causes the connector to not be added since i2c init fails
> for the adapter.  Fixes:
> https://bugs.freedesktop.org/show_bug.cgi?id=31688

Good catch. It may seem to be a little harsh but I'm glad I added the
check to i2c-core. This will avoid future bug reports which we don't
know how to process because we have no idea what the underlying faulty
I2C adapter is.

> Noticed by Ari Savolainen.
> 
> Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
> Cc: Ari Savolainen <ari.m.savolainen at gmail.com>
> Cc: Jean Delvare <khali at linux-fr.org>

> Cc: stable at kernel.org
> ---
>  drivers/gpu/drm/radeon/radeon_i2c.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
> index 0cfbba0..d263bd1 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 aux bus %s", name);

I would much prefer snprintf(), it's safer:

	snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
		 "Radeon aux bus %s", name);

And snprintf() should be used for the other i2c adapter types in the
radeon driver, too.

>  	i2c_set_adapdata(&i2c->adapter, i2c);
>  	i2c->adapter.algo_data = &i2c->algo.dp;
>  	i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch;


-- 
Jean Delvare


More information about the dri-devel mailing list