Re: [PATCH v2 4/5] drm/solomon: Move device info from ssd130x-i2c to the core driver

Javier Martinez Canillas
2022-04-12T09:31:01Z

On 4/12/22 09:23, Geert Uytterhoeven wrote:
> Hi Javier,
>
> Thanks for your patch!
>
> On Mon, Apr 11, 2022 at 11:12 PM Javier Martinez Canillas
> <javierm@redhat.com> wrote:
>> These are declared in the ssd130x-i2c transport driver but the information
>> is not I2C specific, and could be used by other SSD130x transport drivers.
>>
>> Move them to the ssd130x core driver and just set the OF device entries to
>> an ID that could be used to lookup the correct device info from an array.
>>
>> While being there, also move the SSD130X_DATA and SSD130X_COMMAND control
>> bytes. Since even though are used by the I2C interface, it could also be
>
> though they are ... they could
>

Right, will fix it.

>> useful for other transport protocols such as SPI.
>>
>> Suggested-by: Chen-Yu Tsai <wens@kernel.org>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
>
>> --- a/drivers/gpu/drm/solomon/ssd130x.c
>> +++ b/drivers/gpu/drm/solomon/ssd130x.c
>
>> @@ -860,7 +890,14 @@ struct ssd130x_device *ssd130x_probe(struct device *dev, struct regmap *regmap)
>>
>> ssd130x->dev = dev;
>> ssd130x->regmap = regmap;
>> - ssd130x->device_info = device_get_match_data(dev);
>> +
>> + variant = (enum ssd130x_variants)device_get_match_data(dev);
>
> (uintptr_t), to avoid a cast from pointer to integer of different
> size warning.
>

Indeed. The kernel test robot reported the same.

>> +
>
> Please drop the blank line.
>

Ok.

>> + if (variant >= NR_SSD130X_VARIANTS)
>> + return ERR_PTR(dev_err_probe(dev, -EINVAL,
>> + "Invalid SSD130x variant\n"));
>> +
>> + ssd130x->device_info = &ssd130x_variants[variant];
>>
>> if (ssd130x->device_info->page_mode_only)
>> ssd130x->page_address_mode = 1;
>
> With the above fixed:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>

Thanks!

--
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat