diff mbox

drm: fixes when i2c encoder slave mode_fixup is null.

Message ID 1455106118-32145-1-git-send-email-palminha@synopsys.com (mailing list archive)
State New, archived
Headers show

Commit Message

Carlos Palminha Feb. 10, 2016, 12:08 p.m. UTC
Avoid i2c slave encoder drivers to copy/paste code to implement functions that will
only return true.

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
---
 drivers/gpu/drm/drm_encoder_slave.c | 2 ++
 1 file changed, 2 insertions(+)

--
2.5.0

Comments

Daniel Vetter Feb. 10, 2016, 12:25 p.m. UTC | #1
On Wed, Feb 10, 2016 at 12:08:38PM +0000, Carlos Palminha wrote:
> Avoid i2c slave encoder drivers to copy/paste code to implement functions that will
> only return true.
> 
> Signed-off-by: Carlos Palminha <palminha@synopsys.com>

lgtm, applied to drm-misc. sil164_drv.c seems to have a dummy mode_fixup
function that's now uneeded. Can you pls follow up with a patch to remove
that one?

Thanks, Daniel

> ---
>  drivers/gpu/drm/drm_encoder_slave.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
> index e862907..418b94c 100644
> --- a/drivers/gpu/drm/drm_encoder_slave.c
> +++ b/drivers/gpu/drm/drm_encoder_slave.c
> @@ -140,6 +140,8 @@ bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder,
>  		const struct drm_display_mode *mode,
>  		struct drm_display_mode *adjusted_mode)
>  {
> +	if(!get_slave_funcs(encoder)->mode_fixup)
> +		return true;
>  	return get_slave_funcs(encoder)->mode_fixup(encoder, mode, adjusted_mode);
>  }
>  EXPORT_SYMBOL(drm_i2c_encoder_mode_fixup);
> --
> 2.5.0
>
Carlos Palminha Feb. 10, 2016, 12:28 p.m. UTC | #2
thanks daniel.

I'll check all i2c slave encoders and submit a patch set.

On 10-02-2016 12:25, Daniel Vetter wrote:
> On Wed, Feb 10, 2016 at 12:08:38PM +0000, Carlos Palminha wrote:
>> Avoid i2c slave encoder drivers to copy/paste code to implement functions that will
>> only return true.
>>
>> Signed-off-by: Carlos Palminha <palminha@synopsys.com>
>
> lgtm, applied to drm-misc. sil164_drv.c seems to have a dummy mode_fixup
> function that's now uneeded. Can you pls follow up with a patch to remove
> that one?
>
> Thanks, Daniel
>
>> ---
>>   drivers/gpu/drm/drm_encoder_slave.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
>> index e862907..418b94c 100644
>> --- a/drivers/gpu/drm/drm_encoder_slave.c
>> +++ b/drivers/gpu/drm/drm_encoder_slave.c
>> @@ -140,6 +140,8 @@ bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder,
>>   		const struct drm_display_mode *mode,
>>   		struct drm_display_mode *adjusted_mode)
>>   {
>> +	if(!get_slave_funcs(encoder)->mode_fixup)
>> +		return true;
>>   	return get_slave_funcs(encoder)->mode_fixup(encoder, mode, adjusted_mode);
>>   }
>>   EXPORT_SYMBOL(drm_i2c_encoder_mode_fixup);
>> --
>> 2.5.0
>>
>
Jani Nikula Feb. 10, 2016, 2:05 p.m. UTC | #3
On Wed, 10 Feb 2016, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Wed, Feb 10, 2016 at 12:08:38PM +0000, Carlos Palminha wrote:
>> Avoid i2c slave encoder drivers to copy/paste code to implement functions that will
>> only return true.
>> 
>> Signed-off-by: Carlos Palminha <palminha@synopsys.com>
>
> lgtm, applied to drm-misc. sil164_drv.c seems to have a dummy mode_fixup
> function that's now uneeded. Can you pls follow up with a patch to remove
> that one?
>
> Thanks, Daniel
>
>> ---
>>  drivers/gpu/drm/drm_encoder_slave.c | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
>> index e862907..418b94c 100644
>> --- a/drivers/gpu/drm/drm_encoder_slave.c
>> +++ b/drivers/gpu/drm/drm_encoder_slave.c
>> @@ -140,6 +140,8 @@ bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder,
>>  		const struct drm_display_mode *mode,
>>  		struct drm_display_mode *adjusted_mode)
>>  {
>> +	if(!get_slave_funcs(encoder)->mode_fixup)
          ^

Please apply an ocd-space there. ;)

BR,
Jani.



>> +		return true;
>>  	return get_slave_funcs(encoder)->mode_fixup(encoder, mode, adjusted_mode);
>>  }
>>  EXPORT_SYMBOL(drm_i2c_encoder_mode_fixup);
>> --
>> 2.5.0
>>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
index e862907..418b94c 100644
--- a/drivers/gpu/drm/drm_encoder_slave.c
+++ b/drivers/gpu/drm/drm_encoder_slave.c
@@ -140,6 +140,8 @@  bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder,
 		const struct drm_display_mode *mode,
 		struct drm_display_mode *adjusted_mode)
 {
+	if(!get_slave_funcs(encoder)->mode_fixup)
+		return true;
 	return get_slave_funcs(encoder)->mode_fixup(encoder, mode, adjusted_mode);
 }
 EXPORT_SYMBOL(drm_i2c_encoder_mode_fixup);