ISDN: eicon: switch to use native bitmaps
Subsystems (2)
PATCH 1/1 ISDN: eicon: switch to use native bitmaps
Two arrays are clearly bit maps, so, make that explicit by converting to bitmap API and remove custom helpers.
Note sig_ind() uses out of boundary bit to (looks like) protect against potential bitmap_empty() checks for the same bitmap.
This patch removes that since:
1) that didn't guarantee atomicity anyway;
2) the first operation inside the for-loop is set bit in the bitmap (which effectively makes it non-empty);
3) group_optimization() doesn't utilize possible emptiness of the bitmap in question.
Thus, if there is a protection needed it should be implemented properly.
--- drivers/isdn/hardware/eicon/divacapi.h | 16 +-- drivers/isdn/hardware/eicon/message.c | 247 ++++++++------------------------- 2 files changed, 58 insertions(+), 205 deletions(-)
drivers/isdn/hardware/eicon/divacapi.h +3 -13
@@ -26,15 +26,7 @@/*#define DEBUG */ - - - - - - - - - +#include <linux/types.h> #define IMPLEMENT_DTMF 1#define IMPLEMENT_LINE_INTERCONNECT2 1
@@ -82,8 +74,6 @@#define CODEC_PERMANENT 0x02#define ADV_VOICE 0x03#define MAX_CIP_TYPES 5/* kind of CIP types for group optimization */ -#define C_IND_MASK_DWORDS ((MAX_APPL + 32) >> 5) -#define FAX_CONNECT_INFO_BUFFER_SIZE 256#define NCPI_BUFFER_SIZE 256
@@ -265,8 +255,8 @@ struct _PLCI {word ncci_ring_list;byte inc_dis_ncci_table[MAX_CHANNELS_PER_PLCI ];t_std_internal_command internal_command_queue[MAX_INTERNAL_COMMAND_LEVELS ]; -dword c_ind_mask_table[C_IND_MASK_DWORDS ]; -dword group_optimization_mask_table[C_IND_MASK_DWORDS ]; +DECLARE_BITMAP (c_ind_mask_table,MAX_APPL ); +DECLARE_BITMAP (group_optimization_mask_table,MAX_APPL );byte RBuffer[200 ];dword msg_in_queue[MSG_IN_QUEUE_SIZE /sizeof (dword)];API_SAVE saved_msg;
drivers/isdn/hardware/eicon/message.c +55 -192
430 lines not on this page · raw message
Signature · 1 line
2.11.0
David Miller
maintainerFrom: Andy Shevchenko <[email protected]>
Date: Tue, 4 Jul 2017 13:34:51 +0300
Quoted 13 lines
Two arrays are clearly bit maps, so, make that explicit by converting to bitmap API and remove custom helpers.
Note
sig_ind()uses out of boundary bit to (looks like) protect against potentialbitmap_empty()checks for the same bitmap.This patch removes that since:
1) that didn't guarantee atomicity anyway;
2) the first operation inside the for-loop is set bit in the bitmap (which effectively makes it non-empty);
3)group_optimization()doesn't utilize possible emptiness of the bitmap in question.
Quoted 3 lines
Thus, if there is a protection needed it should be implemented properly.
Signed-off-by Andy Shevchenko <[email protected]>
net-next is closed, please submit this when net-next opens back up.
Thank you.