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

Geert Uytterhoeven geert at linux-m68k.org
Tue Apr 12 07:23:38 UTC 2022


Hi Javier,

Thanks for your patch!

On Mon, Apr 11, 2022 at 11:12 PM Javier Martinez Canillas
<javierm at 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

> useful for other transport protocols such as SPI.
>
> Suggested-by: Chen-Yu Tsai <wens at kernel.org>
> Signed-off-by: Javier Martinez Canillas <javierm at 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.

> +

Please drop the blank line.

> +       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 at glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


More information about the dri-devel mailing list