diff options
| author | Ethan Tidmore <ethantidmore06@gmail.com> | 2026-01-23 22:11:50 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-01-27 17:32:42 +0300 |
| commit | 3a0b68e30194e1a064fde8d7451fa90b4609d3ce (patch) | |
| tree | 2a90dfb553040551e6726ee5c67572ef4c9bfcd8 | |
| parent | d15b4527e87c019b1743c014b2f668e4c7bfd3a5 (diff) | |
| download | linux-3a0b68e30194e1a064fde8d7451fa90b4609d3ce.tar.xz | |
staging: most: dim2: replace macro with static function
Replace unsafe macro with function to avoid side effects.
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/20260123191150.3281-1-ethantidmore06@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/staging/most/dim2/dim2.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c index dad2abe6c0c9..80af965356d0 100644 --- a/drivers/staging/most/dim2/dim2.c +++ b/drivers/staging/most/dim2/dim2.c @@ -113,10 +113,12 @@ static inline struct dim2_hdm *iface_to_hdm(struct most_interface *iface) return container_of(iface, struct dim2_hdm, most_iface); } -/* Macro to identify a network status message */ -#define PACKET_IS_NET_INFO(p) \ - (((p)[1] == 0x18) && ((p)[2] == 0x05) && ((p)[3] == 0x0C) && \ - ((p)[13] == 0x3C) && ((p)[14] == 0x00) && ((p)[15] == 0x0A)) +/* Identify a network status message */ +static bool packet_is_net_info(const u8 *p) +{ + return p[1] == 0x18 && p[2] == 0x05 && p[3] == 0x0C && + p[13] == 0x3C && p[14] == 0x00 && p[15] == 0x0A; +} static ssize_t state_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -304,7 +306,7 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx) if (hdm_ch->data_type == MOST_CH_ASYNC && hdm_ch->direction == MOST_CH_RX && - PACKET_IS_NET_INFO(data)) { + packet_is_net_info(data)) { retrieve_netinfo(dev, mbo); spin_lock_irqsave(&dim_lock, flags); |
