On 09/19/2017 08:26 AM, Andrea Bolognani wrote:
On Tue, 2017-09-19 at 07:27 -0400, John Ferlan wrote:
>> First of all, you're removing a number of checks
>> on unrelated symbols
>> that are still used in the code, and if any of those is not present
>> then we shouldn't compile the relevant bits at all.
>
> I checked - up through 4.8 "most" are available. At 4.8 the *ESWITCH*
> ones were added. Checking for a minimum version for a symbol is
> something we do in other code under the assumption that any symbol that
> is in a counted enum/list for a command or structure before it is
> available. Otherwise, we'd have more symbol and field checking all over
> the place.
Okay, I see what you were aiminig for now, and I don't disagree
with it; however, the rationale was not explained clearly in the
original commit message.
OK - I did have it at one point, but the damn commit message got so long
I just trimmed out that part...
>> Second, we're using
>> DEVLINK_CMD_ESWITCH_GET in the code, but as you
>> explain that version is only available in newer kernels.
>>
>> I think the approach need to be more nuanced:
>>
>> - use
>> DEVLINK_CMD_ESWITCH_GET or DEVLINK_CMD_ESWITCH_MODE_GET,
>> depending on which on is available, with the former one being the
>> preferred option;
>
> That's another option to what I posted a few moments ago to use:
>
> # ifndef...
Sure, that would work too, and look a little bit better than
what I proposed.
So is this methodology preferred over what Jano posts?
John