• Arnd Bergmann's avatar
    drbd: fix function cast warnings in state machine · fe0b1e9a
    Arnd Bergmann authored
    There are four state machines in drbd that use a common infrastructure, with
    a cast to an incompatible function type in REMEMBER_STATE_CHANGE that clang-16
    now warns about:
    
    drivers/block/drbd/drbd_state.c:1632:3: error: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_resource_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
     1632 |                 REMEMBER_STATE_CHANGE(notify_resource_state_change,
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1633 |                                       resource_state_change, NOTIFY_CHANGE);
          |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/block/drbd/drbd_state.c:1619:17: note: expanded from macro 'REMEMBER_STATE_CHANGE'
     1619 |            last_func = (typeof(last_func))func; \
          |                        ^~~~~~~~~~~~~~~~~~~~~~~
    drivers/block/drbd/drbd_state.c:1641:4: error: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_connection_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
     1641 |                         REMEMBER_STATE_CHANGE(notify_connection_state_change,
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1642 |                                               connection_state_change, NOTIFY_CHANGE);
          |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Change these all to actually expect a void pointer to be passed, which
    matches the caller.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/r/20240213100354.457128-1-arnd@kernel.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    fe0b1e9a
drbd_state.c 73.6 KB