Re: [PATCH v1 3/5] fbtft: Drop useless #ifdef CONFIG_OF and dead code

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

 




Den 20.11.2019 15.43, skrev Noralf Trønnes:
> 
> 
> Den 20.11.2019 10.57, skrev Andy Shevchenko:
>> First of all there is no need to guard GPIO request by CONFIG_OF.
>> It works for everybody independently on resource provider. While here,
>> rename the function to reflect the above.
>>
>> Moreover, since we have a global dependency to OF, the rest of
>> conditional compilation is no-op, i.e. it's always be true.
>>
>> Due to above drop useless #ifdef CONFIG_OF and therefore dead code.
>>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>> ---
>>  drivers/staging/fbtft/fbtft-core.c | 19 ++-----------------
>>  1 file changed, 2 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> 
> <snip>
> 
>> @@ -1184,17 +1176,10 @@ static struct fbtft_platform_data *fbtft_probe_dt(struct device *dev)
>>  		pdata->display.backlight = 1;
>>  	if (of_find_property(node, "init", NULL))
>>  		pdata->display.fbtftops.init_display = fbtft_init_display_dt;
>> -	pdata->display.fbtftops.request_gpios = fbtft_request_gpios_dt;
>> +	pdata->display.fbtftops.request_gpios = fbtft_request_gpios;
> 
> You can ditch the .request_gpios callback and call fbtft_request_gpios()
> directly in fbtft_register_framebuffer(). That will make it safe to drop
> the OF dependency, otherwise .request_gpios will be NULL in the non-DT
> case. This is one of the bugs that follwed the gpio refactoring.

Really difficult to read this fbtft code (that I wrote...).
The NULL deref can only happen when dev->platform_data is set. That
can't happen, in mainline at least, now that fbtft_device is gone.

> 
> You can also ditch the .request_gpios_match callback if you want, it
> isn't called anymore (it is set in fb_agm1264k-fl).
> 
> Noralf.
> 
>>  
>>  	return pdata;
>>  }
>> -#else
>> -static struct fbtft_platform_data *fbtft_probe_dt(struct device *dev)
>> -{
>> -	dev_err(dev, "Missing platform data\n");
>> -	return ERR_PTR(-EINVAL);
>> -}
>> -#endif
>>  
>>  /**
>>   * fbtft_probe_common() - Generic device probe() helper function
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://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