Re: [PATCH v4 1/4] drm: Add helper for DP++ adaptors

Ville Syrjälä
2016-05-06T13:12:04Z

On Fri, May 06, 2016 at 12:37:51PM +0000, Zanoni, Paulo R wrote:
> Em Ter, 2016-05-03 ï¿½s 20:56 +0300, ville.syrjala@linux.intel.com
> escreveu:
<snip>
> > +
> > +/**
> > + * drm_dp_dual_mode_read - Read from the DP dual mode adaptor
> > register(s)
> > + * @adapter: I2C adapter for the DDC bus
> > + * @offset: register offset
> > + * @buffer: buffer for return data
> > + * @size: sizo of the buffer
> > + *
> > + * Reads @size bytes from the DP dual mode adaptor registers
> > + * starting at @offset.
> > + *
> > + * Returns:
> > + * 0 on success, negative error code on failure
> > + */
> > +ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter,
> > + ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½u8 offset, void *buffer, size_t size)
> > +{
> > + struct i2c_msg msgs[] = {
> > + {
> > + .addr = DP_DUAL_MODE_SLAVE_ADDRESS,
> > + .flags = 0,
> > + .len = 1,
> > + .buf = &offset,
> > + },
> > + {
> > + .addr = DP_DUAL_MODE_SLAVE_ADDRESS,
> > + .flags = I2C_M_RD,
> > + .len = size,
> > + .buf = buffer,
> > + },
> > + };
> > + int ret;
> > +
> > + ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs));
> > + if (ret < 0)
> > + return ret;
> > + if (ret != ARRAY_SIZE(msgs))
> > + return -EPROTO;
> > +
> > + return 0;
> > +}
> EXPORT_SYMBOL(drm_dp_dual_mode_read);
>
> (or make it static and remove from the .h file)

Hmm. My initial idea was that someone might want to use these for debug
and/or accessing some vendor specific register and whatnot. Which is why
I meant to export them (and somehow failed in this case). I guess I
still stand by that reasoning, although right now we have no users
outside this file.

--
Ville Syrjï¿½lï¿½
Intel OTC