cpu/esp32/periph_can: use container_of()

This silences false positives of -Wcast-align
This commit is contained in:
Marian Buschsieweke 2021-11-07 09:00:21 +01:00
parent 7a6a7015cd
commit d59d9c27d7
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -149,7 +149,7 @@ static const struct can_bittiming_const bittiming_const = {
static void _esp_can_isr(candev_t *candev) static void _esp_can_isr(candev_t *candev)
{ {
can_t *dev = (can_t *)candev; can_t *dev = container_of(candev, can_t, candev);
DEBUG("%s candev=%p\n", __func__, candev); DEBUG("%s candev=%p\n", __func__, candev);
@ -217,7 +217,7 @@ static void _esp_can_isr(candev_t *candev)
static int _esp_can_init(candev_t *candev) static int _esp_can_init(candev_t *candev)
{ {
can_t *dev = (can_t *)candev; can_t *dev = container_of(candev, can_t, candev);
DEBUG("%s candev=%p\n", __func__, candev); DEBUG("%s candev=%p\n", __func__, candev);
@ -234,7 +234,7 @@ static int _esp_can_init(candev_t *candev)
static int _esp_can_send(candev_t *candev, const struct can_frame *frame) static int _esp_can_send(candev_t *candev, const struct can_frame *frame)
{ {
can_t *dev = (can_t *)candev; can_t *dev = container_of(candev, can_t, candev);
DEBUG("%s candev=%p frame=%p\n", __func__, candev, frame); DEBUG("%s candev=%p frame=%p\n", __func__, candev, frame);
@ -301,7 +301,7 @@ static int _esp_can_send(candev_t *candev, const struct can_frame *frame)
static int _esp_can_set(candev_t *candev, canopt_t opt, void *value, size_t value_len) static int _esp_can_set(candev_t *candev, canopt_t opt, void *value, size_t value_len)
{ {
can_t *dev = (can_t *)candev; can_t *dev = container_of(candev, can_t, candev);
assert(dev); assert(dev);
assert(value); assert(value);
@ -354,7 +354,7 @@ static int _esp_can_set(candev_t *candev, canopt_t opt, void *value, size_t valu
static int _esp_can_get(candev_t *candev, canopt_t opt, void *value, size_t max_len) static int _esp_can_get(candev_t *candev, canopt_t opt, void *value, size_t max_len)
{ {
can_t *dev = (can_t *)candev; can_t *dev = container_of(candev, can_t, candev);
DEBUG("%s\n", __func__); DEBUG("%s\n", __func__);
@ -447,7 +447,7 @@ static int _esp_can_get(candev_t *candev, canopt_t opt, void *value, size_t max_
static int _esp_can_abort(candev_t *candev, const struct can_frame *frame) static int _esp_can_abort(candev_t *candev, const struct can_frame *frame)
{ {
can_t *dev = (can_t *)candev; can_t *dev = container_of(candev, can_t, candev);
DEBUG("%s candev=%p frame=%p\n", __func__, candev, frame); DEBUG("%s candev=%p frame=%p\n", __func__, candev, frame);
@ -465,7 +465,7 @@ static int _esp_can_abort(candev_t *candev, const struct can_frame *frame)
static int _esp_can_set_filter(candev_t *candev, const struct can_filter *filter) static int _esp_can_set_filter(candev_t *candev, const struct can_filter *filter)
{ {
can_t *dev = (can_t *)candev; can_t *dev = container_of(candev, can_t, candev);
DEBUG("%s candev=%p filter=%p\n", __func__, candev, filter); DEBUG("%s candev=%p filter=%p\n", __func__, candev, filter);
@ -502,7 +502,7 @@ static int _esp_can_set_filter(candev_t *candev, const struct can_filter *filter
static int _esp_can_remove_filter(candev_t *candev, const struct can_filter *filter) static int _esp_can_remove_filter(candev_t *candev, const struct can_filter *filter)
{ {
can_t *dev = (can_t *)candev; can_t *dev = container_of(candev, can_t, candev);
DEBUG("%s candev=%p filter=%p\n", __func__, candev, filter); DEBUG("%s candev=%p filter=%p\n", __func__, candev, filter);