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 <sidcha.dev@gmail.com>
This commit is contained in:
Siddharth Chandrasekaran 2022-05-28 15:03:06 +02:00 committed by Carles Cufí
commit b31e708c03
3 changed files with 5 additions and 5 deletions

View file

@ -150,7 +150,7 @@ static struct osdp *osdp_build_ctx(struct osdp_channel *channel)
for (i = 0; i < CONFIG_OSDP_NUM_CONNECTED_PD; i++) {
pd = TO_PD(ctx, i);
pd->offset = i;
pd->idx = i;
pd->seq_number = -1;
pd->__parent = ctx;
pd->address = pd_adddres[i];

View file

@ -415,7 +415,7 @@ struct osdp_secure_channel {
struct osdp_pd {
void *__parent;
int offset;
int idx;
uint32_t flags;
/* OSDP specified data */

View file

@ -407,7 +407,7 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
if (cp->notifier.keypress) {
for (i = 0; i < t1; i++) {
t2 = buf[pos + i]; /* key data */
cp->notifier.keypress(pd->offset, t2);
cp->notifier.keypress(pd->idx, t2);
}
}
ret = OSDP_CP_ERR_NONE;
@ -424,7 +424,7 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
break;
}
if (cp->notifier.cardread) {
cp->notifier.cardread(pd->offset, t1, buf + pos, t2);
cp->notifier.cardread(pd->idx, t1, buf + pos, t2);
}
ret = OSDP_CP_ERR_NONE;
break;
@ -439,7 +439,7 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
break;
}
if (cp->notifier.cardread) {
cp->notifier.cardread(pd->offset, OSDP_CARD_FMT_ASCII,
cp->notifier.cardread(pd->idx, OSDP_CARD_FMT_ASCII,
buf + pos, t1);
}
ret = OSDP_CP_ERR_NONE;