Re: [RFC PATCH] drm/dp: let drivers specify the name of the I2C-over-AUX adapter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 05, 2014 at 01:50:27PM +0200, Jani Nikula wrote:
[...]
> I am not entirely happy with adding an extra name field, but I also
> didn't like the caller having to set up aux.ddc.name in advance. Ideas
> welcome.

What you propose is a whole lot better than having to modify the
internals of struct i2c_adapter in advance, and I can't think of
a better alternative either. I have two small comments below.

> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 35251af3b14e..17832d048147 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -726,7 +726,8 @@ int drm_dp_aux_register_i2c_bus(struct drm_dp_aux *aux)
>  	aux->ddc.dev.parent = aux->dev;
>  	aux->ddc.dev.of_node = aux->dev->of_node;
>  
> -	strncpy(aux->ddc.name, dev_name(aux->dev), sizeof(aux->ddc.name));
> +	strlcpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev),
> +		sizeof(aux->ddc.name));

I don't see why the change from strncpy() to strlcpy() would be
necessary.

> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
[...]
> @@ -438,6 +438,9 @@ struct drm_dp_aux_msg {
>   * The .dev field should be set to a pointer to the device that implements
>   * the AUX channel.
>   *
> + * The .name field may be used to specify the name of the I2C adapter. If set to
> + * NULL, dev_name() of .dev will be used.
> + *

Nit: That new paragraph sticks out because it's wider than the rest,
even though it still fits into 80 characters.

I don't feel all that strongly about either of the above, so:

Reviewed-by: Thierry Reding <treding@xxxxxxxxxx>

Attachment: pgpSRBR2il5BZ.pgp
Description: PGP signature

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux