lkml.org 
[lkml]   [2023]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/1] i2c: at91: constify at91_twi_pdata
From
On 30/06/2023 00:38, 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?

I think this change is not necessary and actually should not matter. See
for example drivers/tty/serial/samsung_tty.c after my refactorings in
commit 3aec40096550 ("tty: serial: samsung: reduce number of casts").

Best regards,
Krzysztof

\
 
 \ /
  Last update: 2023-07-03 20:24    [W:0.045 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site