laforge has uploaded this change for review.

View Change

[cosmetic]: Fix coding style issues in ccid_common

Change-Id: If1035d558d326f2d1fe58974773a2c91ab6df73f
---
M ccid_common/ccid_device.c
M ccid_common/ccid_slot_fsm.c
M ccid_common/cuart.c
M ccid_common/iso7816_fsm.c
4 files changed, 17 insertions(+), 13 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/90/39790/1
diff --git a/ccid_common/ccid_device.c b/ccid_common/ccid_device.c
index 398a2b4..acee696 100644
--- a/ccid_common/ccid_device.c
+++ b/ccid_common/ccid_device.c
@@ -718,7 +718,7 @@
return ccid_send(ci, resp);
}

- if(!cs->icc_present) {
+ if (!cs->icc_present) {
LOGPCS(cs, LOGL_ERROR, "No icc present, but another cmd received\n");
/* FIXME: ABORT logic as per section 5.3.1 of CCID Spec v1.1 */
resp = gen_err_resp(ch->bMessageType, ch->bSlot, get_icc_status(cs), ch->bSeq,
diff --git a/ccid_common/ccid_slot_fsm.c b/ccid_common/ccid_slot_fsm.c
index eb0c145..0c56275 100644
--- a/ccid_common/ccid_slot_fsm.c
+++ b/ccid_common/ccid_slot_fsm.c
@@ -91,7 +91,7 @@
static void iso_fsm_slot_icc_set_insertion_status(struct ccid_slot *cs, bool present) {
struct iso_fsm_slot *ss = ccid_slot2iso_fsm_slot(cs);

- if(present == cs->icc_present)
+ if (present == cs->icc_present)
return;

cs->icc_present = present;
@@ -116,13 +116,20 @@
LOGPCS(cs, LOGL_DEBUG, "scheduling power-up\n");

switch (pwrsel) {
- case CCID_PWRSEL_5V0: cctl = CUART_CTL_POWER_5V0; break;
- case CCID_PWRSEL_3V0: cctl = CUART_CTL_POWER_3V0; break;
- case CCID_PWRSEL_1V8: cctl = CUART_CTL_POWER_1V8; break;
- default: cctl = CUART_CTL_POWER_5V0;
+ case CCID_PWRSEL_5V0:
+ cctl = CUART_CTL_POWER_5V0;
+ break;
+ case CCID_PWRSEL_3V0:
+ cctl = CUART_CTL_POWER_3V0;
+ break;
+ case CCID_PWRSEL_1V8:
+ cctl = CUART_CTL_POWER_1V8;
+ break;
+ default:
+ cctl = CUART_CTL_POWER_5V0;
}

- if (! cs->icc_powered) {
+ if (!cs->icc_powered) {
/* FIXME: do this via a FSM? */
card_uart_ctrl(ss->cuart, CUART_CTL_RST, true);
osmo_fsm_inst_dispatch(ss->fi, ISO7816_E_RESET_ACT_IND, NULL);
@@ -198,7 +205,7 @@
volatile uint32_t event = cs->event;
volatile void * volatile data = cs->event_data;

- if(!event)
+ if (!event)
return 0;
// if(event && !data)
// return 0;
@@ -208,13 +215,11 @@
tpdu = data;
LOGPCS(cs, LOGL_DEBUG, "%s(event=%d, data=0)\n", __func__, event);

-
/* perform deactivation */
card_uart_ctrl(ss->cuart, CUART_CTL_RST, true);
card_uart_ctrl(ss->cuart, CUART_CTL_POWER_5V0, false);
cs->icc_powered = false;

-
resp = ccid_gen_data_block(cs, ss->seq, CCID_CMD_STATUS_FAILED, CCID_ERR_ICC_MUTE, 0, 0);
ccid_slot_send_unbusy(cs, resp);
cs->event = 0;
@@ -223,7 +228,7 @@
tpdu = data;

/* inverse condition, error interrupt is always disabled during atr and reenabled here after atr */
- if(*msgb_data(tpdu) == 0x3f) {
+ if (*msgb_data(tpdu) == 0x3f) {
card_uart_ctrl(ss->cuart, CUART_CTL_ERROR_AND_INV, true);
} else {
card_uart_ctrl(ss->cuart, CUART_CTL_ERROR_AND_INV, false);
diff --git a/ccid_common/cuart.c b/ccid_common/cuart.c
index 9c96891..d228c13 100644
--- a/ccid_common/cuart.c
+++ b/ccid_common/cuart.c
@@ -68,7 +68,7 @@
{
int secs, usecs;

- if(!cuart->current_wtime_byte)
+ if (!cuart->current_wtime_byte)
return;

int etu_in_us = get_etu_in_us(cuart) + 1;
diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c
index d82380b..f6d2185 100644
--- a/ccid_common/iso7816_fsm.c
+++ b/ccid_common/iso7816_fsm.c
@@ -1635,7 +1635,6 @@
struct pps_fsm_priv *ppsp;
struct tpdu_fsm_priv *tpdup;

-
fi = osmo_fsm_inst_alloc(&iso7816_3_fsm, ctx, NULL, log_level, id);
ip = talloc_zero(fi, struct iso7816_3_priv);
if (!ip)

To view, visit change 39790. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: If1035d558d326f2d1fe58974773a2c91ab6df73f
Gerrit-Change-Number: 39790
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>