Re: [PATCH v2 6/6] serial: exar: Add support for IOT2040 device
From: Andy Shevchenko
Date: Thu May 18 2017 - 13:42:05 EST
On Thu, May 18, 2017 at 7:39 PM, Jan Kiszka <jan.kiszka@xxxxxxxxxxx> wrote:
> On 2017-05-18 18:33, Andy Shevchenko wrote:
>> On Thu, May 18, 2017 at 5:59 PM, Jan Kiszka <jan.kiszka@xxxxxxxxxxx> wrote:
>>> +static bool is_iot2040;
>>
>> No, please, use driver data of DMI and hide this in corresponding structure.
>> Or even assign port->port.rs485_config in the callback function.
>>
>> Moreover, can't you use port->port.rs485_config != NULL instead?
>
> There are two cases to be handled on IOT2040: the setting of the
> rs485_config and the different setup of the GPIOs, but the latter at a
> specific point in the initialization only. So I don't see yet how
> driver_data could come into play and help.
struct exar_iot2040_setup {
...rs485_config();
...setup_gpio();
};
struct exar_iot2040_setup iot2040_setup = {
...
};
DMI:
.driver_data = (void *)&iot2040_setup;
Above is just unfinished proposal, since I have noticed your new mail.
So, it seems we are on the same page.
One thing, I still would consider to use device properties instead of
platform data (with consideration of MFD framework usage).
--
With Best Regards,
Andy Shevchenko