Skip to contentSkip to conversation

ISDN: eicon: switch to use native bitmaps

PATCH RESEND Applied Andy Shevchenko 2 participants 2 messages Jul 18, 2017 – Jul 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 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.

---
- resend after v4.13-rc1 is out

 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
index a315a2914d70..c4868a0d82f4 100644
@@ -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
maintainer Applied
#1 lore raw

From: Andy Shevchenko <[email protected]>
Date: Tue, 18 Jul 2017 18:49:26 +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 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.

Quoted 3 lines

Thus, if there is a protection needed it should be implemented properly.

Applied, thanks.