Messages in this thread | | | Date | Tue, 2 Nov 2021 17:11:27 +0100 | Subject | Re: [PATCH v5 10/11] platform/x86: int3472: Pass tps68470_regulator_platform_data to the tps68470-regulator MFD-cell | From | Hans de Goede <> |
| |
Hi,
On 11/2/21 16:52, Andy Shevchenko wrote: > On Tue, Nov 2, 2021 at 4:59 PM Hans de Goede <hdegoede@redhat.com> wrote: >> On 11/2/21 15:34, Andy Shevchenko wrote: >>> On Tue, Nov 2, 2021 at 11:50 AM Hans de Goede <hdegoede@redhat.com> wrote: > > ... > >>>> + board_data = int3472_tps68470_get_board_data(dev_name(&client->dev)); >>>> + if (!board_data) { >>>> + dev_err(&client->dev, "No board-data found for this laptop/tablet model\n"); >>>> + return -ENODEV; >>> >>> It's fine to use dev_err_probe() for known error codes. >>> >>>> + } >>> >>> ... >>> >>>> + cells[1].platform_data = (void *)board_data->tps68470_regulator_pdata; >>> >>> Do we need casting? >> >> Yes, the cast casts away a "const", the const is correct >> since the data only ever gets read by the regulator driver, >> but platform_data pointers are normally not const, so it >> is either the cast, or loose the const on the definition >> of the struct to which board_data->tps68470_regulator_pdata >> points... >> >> So not good choice here really, only chosing between bad >> options and I picked the lets do the cast "least worse" >> option (at least to me). I'm open to changing this. > > Hmm... Okay, I was under the impression that MFD is using const for > that field...
Nope, I just double-checked and it is a plain "void *"
Regards,
Hans
| |