Skip to content

Commit b31e708

Browse files
sidchacarlescufi
authored andcommitted
mgmt/osdp: Rename pd offset as index
CP has an array of PDs and pd->offset was the position of the PD in CP's list. Since offset has many meanings, rename it to pd->idx. Signed-off-by: Siddharth Chandrasekaran <[email protected]>
1 parent 059abd8 commit b31e708

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

subsys/mgmt/osdp/src/osdp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static struct osdp *osdp_build_ctx(struct osdp_channel *channel)
150150

151151
for (i = 0; i < CONFIG_OSDP_NUM_CONNECTED_PD; i++) {
152152
pd = TO_PD(ctx, i);
153-
pd->offset = i;
153+
pd->idx = i;
154154
pd->seq_number = -1;
155155
pd->__parent = ctx;
156156
pd->address = pd_adddres[i];

subsys/mgmt/osdp/src/osdp_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ struct osdp_secure_channel {
415415

416416
struct osdp_pd {
417417
void *__parent;
418-
int offset;
418+
int idx;
419419
uint32_t flags;
420420

421421
/* OSDP specified data */

subsys/mgmt/osdp/src/osdp_cp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
407407
if (cp->notifier.keypress) {
408408
for (i = 0; i < t1; i++) {
409409
t2 = buf[pos + i]; /* key data */
410-
cp->notifier.keypress(pd->offset, t2);
410+
cp->notifier.keypress(pd->idx, t2);
411411
}
412412
}
413413
ret = OSDP_CP_ERR_NONE;
@@ -424,7 +424,7 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
424424
break;
425425
}
426426
if (cp->notifier.cardread) {
427-
cp->notifier.cardread(pd->offset, t1, buf + pos, t2);
427+
cp->notifier.cardread(pd->idx, t1, buf + pos, t2);
428428
}
429429
ret = OSDP_CP_ERR_NONE;
430430
break;
@@ -439,7 +439,7 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
439439
break;
440440
}
441441
if (cp->notifier.cardread) {
442-
cp->notifier.cardread(pd->offset, OSDP_CARD_FMT_ASCII,
442+
cp->notifier.cardread(pd->idx, OSDP_CARD_FMT_ASCII,
443443
buf + pos, t1);
444444
}
445445
ret = OSDP_CP_ERR_NONE;

0 commit comments

Comments
 (0)