diff options
author | Tilman Schmidt <tilman@imap.cc> | 2012-04-25 09:02:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-07 22:37:56 -0400 |
commit | 81fa7b82570ec4337d328e6aee45689455508821 (patch) | |
tree | 79cdb018f497a18635ea78a171cd211845e0b605 /drivers/isdn/gigaset/ev-layer.c | |
parent | 7643ffbd02ac46f880f64bed24a85d453b501418 (diff) |
isdn/gigaset: unify function return values
Various functions in the Gigaset driver were using different
conventions for the meaning of their int return values.
Align them to the usual negative error numbers convention.
Inspired-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/gigaset/ev-layer.c')
-rw-r--r-- | drivers/isdn/gigaset/ev-layer.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index 8391e09a698a..2e6963dc740e 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -658,7 +658,7 @@ static inline struct at_state_t *get_free_channel(struct cardstate *cs, | |||
658 | struct at_state_t *ret; | 658 | struct at_state_t *ret; |
659 | 659 | ||
660 | for (i = 0; i < cs->channels; ++i) | 660 | for (i = 0; i < cs->channels; ++i) |
661 | if (gigaset_get_channel(cs->bcs + i)) { | 661 | if (gigaset_get_channel(cs->bcs + i) >= 0) { |
662 | ret = &cs->bcs[i].at_state; | 662 | ret = &cs->bcs[i].at_state; |
663 | ret->cid = cid; | 663 | ret->cid = cid; |
664 | return ret; | 664 | return ret; |
@@ -923,18 +923,18 @@ static void do_stop(struct cardstate *cs) | |||
923 | * channel >= 0: getting cid for the channel failed | 923 | * channel >= 0: getting cid for the channel failed |
924 | * channel < 0: entering cid mode failed | 924 | * channel < 0: entering cid mode failed |
925 | * | 925 | * |
926 | * returns 0 on failure | 926 | * returns 0 on success, <0 on failure |
927 | */ | 927 | */ |
928 | static int reinit_and_retry(struct cardstate *cs, int channel) | 928 | static int reinit_and_retry(struct cardstate *cs, int channel) |
929 | { | 929 | { |
930 | int i; | 930 | int i; |
931 | 931 | ||
932 | if (--cs->retry_count <= 0) | 932 | if (--cs->retry_count <= 0) |
933 | return 0; | 933 | return -EFAULT; |
934 | 934 | ||
935 | for (i = 0; i < cs->channels; ++i) | 935 | for (i = 0; i < cs->channels; ++i) |
936 | if (cs->bcs[i].at_state.cid > 0) | 936 | if (cs->bcs[i].at_state.cid > 0) |
937 | return 0; | 937 | return -EBUSY; |
938 | 938 | ||
939 | if (channel < 0) | 939 | if (channel < 0) |
940 | dev_warn(cs->dev, | 940 | dev_warn(cs->dev, |
@@ -945,7 +945,7 @@ static int reinit_and_retry(struct cardstate *cs, int channel) | |||
945 | cs->bcs[channel].at_state.pending_commands |= PC_CID; | 945 | cs->bcs[channel].at_state.pending_commands |= PC_CID; |
946 | } | 946 | } |
947 | schedule_init(cs, MS_INIT); | 947 | schedule_init(cs, MS_INIT); |
948 | return 1; | 948 | return 0; |
949 | } | 949 | } |
950 | 950 | ||
951 | static int at_state_invalid(struct cardstate *cs, | 951 | static int at_state_invalid(struct cardstate *cs, |
@@ -1016,7 +1016,7 @@ static int do_lock(struct cardstate *cs) | |||
1016 | if (cs->bcs[i].at_state.pending_commands) | 1016 | if (cs->bcs[i].at_state.pending_commands) |
1017 | return -EBUSY; | 1017 | return -EBUSY; |
1018 | 1018 | ||
1019 | if (!gigaset_get_channels(cs)) | 1019 | if (gigaset_get_channels(cs) < 0) |
1020 | return -EBUSY; | 1020 | return -EBUSY; |
1021 | 1021 | ||
1022 | break; | 1022 | break; |
@@ -1125,7 +1125,7 @@ static void do_action(int action, struct cardstate *cs, | |||
1125 | init_failed(cs, M_UNKNOWN); | 1125 | init_failed(cs, M_UNKNOWN); |
1126 | break; | 1126 | break; |
1127 | } | 1127 | } |
1128 | if (!reinit_and_retry(cs, -1)) | 1128 | if (reinit_and_retry(cs, -1) < 0) |
1129 | schedule_init(cs, MS_RECOVER); | 1129 | schedule_init(cs, MS_RECOVER); |
1130 | break; | 1130 | break; |
1131 | case ACT_FAILUMODE: | 1131 | case ACT_FAILUMODE: |
@@ -1268,7 +1268,7 @@ static void do_action(int action, struct cardstate *cs, | |||
1268 | case ACT_FAILCID: | 1268 | case ACT_FAILCID: |
1269 | cs->cur_at_seq = SEQ_NONE; | 1269 | cs->cur_at_seq = SEQ_NONE; |
1270 | channel = cs->curchannel; | 1270 | channel = cs->curchannel; |
1271 | if (!reinit_and_retry(cs, channel)) { | 1271 | if (reinit_and_retry(cs, channel) < 0) { |
1272 | dev_warn(cs->dev, | 1272 | dev_warn(cs->dev, |
1273 | "Could not get a call ID. Cannot dial.\n"); | 1273 | "Could not get a call ID. Cannot dial.\n"); |
1274 | at_state2 = &cs->bcs[channel].at_state; | 1274 | at_state2 = &cs->bcs[channel].at_state; |