On Fri, Jun 30, 2023 at 12:38:25AM +0200, Andi Shyti wrote: > Hi Michal, > > [...] > > > -static struct at91_twi_pdata *at91_twi_get_driver_data( > > +static const struct at91_twi_pdata *at91_twi_get_driver_data( > > struct platform_device *pdev) > > { > > if (pdev->dev.of_node) { > > @@ -189,9 +189,9 @@ static struct at91_twi_pdata *at91_twi_get_driver_data( > > match = of_match_node(atmel_twi_dt_ids, pdev->dev.of_node); > > if (!match) > > return NULL; > > - return (struct at91_twi_pdata *)match->data; > > + return match->data; > > } > > - return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data; > > + return (const void *) platform_get_device_id(pdev)->driver_data; > > the const's always confuse me... do you get an error here? Is > this cast really needed? platform_device_id.driver_data is an ulong, not a void pointer. So, the cast is needed. It could be just (void *), but I think it's better to document the constness in the code. -- Michał Mirosław