lkml.org 
[lkml]   [2018]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] pinctrl: generic: Avoid several implicit enum conversions
    On Tue, Sep 25, 2018 at 8:19 AM Nathan Chancellor
    <natechancellor@gmail.com> wrote:

    > Clang warns when one enumerated type is implicitly converted to another,
    > which happens several times in the pinctrl drivers for a few reasons:
    >
    > * The PCONFDUMP macro, which sets the param member in pin_config_item.
    > * The pinconf_generic_params structure, which is used by drivers to
    > configure their bindings, which has a param member like pin_config_item.
    > * The pinconf_to_config_packed, which takes either the generic enum
    > pin_config_param or a specialized one.
    >
    > Drivers are allowed to extend this enumerated type because of the gap
    > betweem PIN_CONFIG_END and PIN_CONFIG_MAX. Make it clear to Clang that
    > this is allowed by changing param's type in all of these instances to
    > int so no conversion needs to happen.
    >
    > Link: https://github.com/ClangBuiltLinux/linux/issues/138
    > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

    I'm not superhappy about this because that enum is great for readability,
    even if the static syntax checker is unhappy.

    If we can't have an enum here I would argue that we can just as well
    remove the enum altogether and just use #define for the config
    parameters, would you agree?

    Yours,
    Linus Walleij

    \
     
     \ /
      Last update: 2018-09-25 12:59    [W:2.805 / U:0.652 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site